diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-04-04 18:22:47 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-04-04 18:22:47 +0200 |
commit | 659a02d3aa2b1b4e16982a3bb87aaf4d7c16ae5a (patch) | |
tree | 40abf040e3c68b7e2aee3d137bf3eb61294a09af /Makefile | |
parent | 040a45bba01edb885faddac75025f88e655b89be (diff) | |
download | cv-659a02d3aa2b1b4e16982a3bb87aaf4d7c16ae5a.tar.gz cv-659a02d3aa2b1b4e16982a3bb87aaf4d7c16ae5a.tar.bz2 cv-659a02d3aa2b1b4e16982a3bb87aaf4d7c16ae5a.zip |
Makefile: Use variables instead of many-rules for cflags/ldflags
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 48 |
1 files changed, 25 insertions, 23 deletions
@@ -1,12 +1,23 @@ CC = gcc -CFLAGS = -ggdb -std=c99 -pedantic -Wall $(DEFINES) \ - $(shell pkg-config --cflags gdk-pixbuf-2.0 glib-2.0 gthread-2.0) \ - -DN_THREADS=$(shell grep -c ^processor /proc/cpuinfo || echo 2) -LDFLAGS = -Wl,--as-needed $(LIBS) -lm \ - $(shell pkg-config --libs gdk-pixbuf-2.0 glib-2.0 gthread-2.0) +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) PROGS = wimmel wimmel_gl roi capture -OBJS = wimmel.o wimmel_gl.o util.o roi.o capture.o +OBJS = $(PROGS:=.o) util.o all: $(PROGS) @@ -17,25 +28,16 @@ capture: capture.o .PHONY: clean all -%: - $(CC) -o $@ $+ $(LDFLAGS) +define cc + $(CC) $(CFLAGS) $($(@:.o=)_CFLAGS) -c -o $@ $< +endef +%: + $(CC) -o $@ $+ $(LDFLAGS) $($@_LIBS) +%.o: %.c + $(call cc) %.o: %.c %.h - $(CC) $(CFLAGS) -c -o $@ $< - - -wimmel_gl: - $(CC) -o $@ $+ $(LDFLAGS) `pkg-config --cflags --libs egl glesv2` - -roi.o: roi.c - $(CC) -c -o $@ $+ $(CFLAGS) `pkg-config --cflags gtk+-3.0` -roi: - $(CC) -o $@ $+ $(LDFLAGS) `pkg-config --libs gtk+-3.0` - -capture.o: capture.c - $(CC) -c -o $@ $+ $(CFLAGS) `pkg-config --cflags gtk+-3.0 opencv` -capture: - $(CC) -o $@ $+ $(LDFLAGS) `pkg-config --libs gtk+-3.0 opencv` + $(call cc) clean: rm -f $(PROGS) $(OBJS) |