CC = gcc CFLAGS = -ggdb -std=c99 -pedantic -Wall $(DEFINES) LDFLAGS = -Wl,--as-needed $(LIBS) util_CFLAGS=$(shell pkg-config --cflags gdk-pixbuf-2.0 glib-2.0) wimmel_CFLAGS=$(shell pkg-config --cflags gdk-pixbuf-2.0 glib-2.0) \ -DN_THREADS=$(shell grep -c ^processor /proc/cpuinfo || echo 2) wimmel_LIBS=-lm $(shell pkg-config --libs gdk-pixbuf-2.0 glib-2.0) wimmel_gl_CFLAGS=$(shell pkg-config --cflags egl glesv2 glib-2.0 gdk-pixbuf-2.0) wimmel_gl_LIBS=$(shell pkg-config --libs egl glesv2 glib-2.0 gdk-pixbuf-2.0) roi_CFLAGS=$(shell pkg-config --cflags gtk+-3.0 gdk-pixbuf-2.0 glib-2.0) roi_LIBS=$(shell pkg-config --libs gtk+-3.0 gdk-pixbuf-2.0 glib-2.0) capture_CFLAGS=$(shell pkg-config --cflags gtk+-3.0 opencv glib-2.0) capture_LIBS=$(shell pkg-config --libs gtk+-3.0 opencv glib-2.0) unvignette_CFLAGS=$(shell pkg-config --cflags cairo) unvignette_LIBS=$(shell pkg-config --libs cairo) -lm gauss_cv_CFLAGS=$(shell pkg-config --cflags gtk+-3.0 gmodule-2.0 opencv) gauss_cv_LIBS=$(shell pkg-config --libs gtk+-3.0 gmodule-2.0 opencv) PROGS = wimmel wimmel_gl roi capture unvignette gauss_cv OBJS = $(PROGS:=.o) util.o all: $(PROGS) wimmel: wimmel.o util.o wimmel_gl: wimmel_gl.o util.o roi: roi.o capture: capture.o unvignette: unvignette.o gauss_cv: gauss_cv.o .PHONY: clean all DEFAULT_VERBOSITY=0 # verbosity stuff V_CC = $(v_cc_$(V)) v_cc_ = $(v_cc_$(DEFAULT_VERBOSITY)) v_cc_0 = @echo " CC " $@; V_CCLD = $(v_ccld_$(V)) v_ccld_ = $(v_ccld_$(DEFAULT_VERBOSITY)) v_ccld_0 = @echo " CCLD " $@; define cc $(V_CC)$(CC) $(CFLAGS) $($(@:.o=)_CFLAGS) -c -o $@ $< endef %: $(V_CCLD)$(CC) -o $@ $+ $(LDFLAGS) $($@_LIBS) %.o: %.c $(call cc) %.o: %.c %.h $(call cc) clean: rm -f $(PROGS) $(OBJS)