summaryrefslogtreecommitdiff
path: root/Makefile
blob: 616c4747bf440587fbfd86d08923f699b410f0ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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)

PROGS = wimmel wimmel_gl roi capture
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

.PHONY: clean all

define cc
	$(CC) $(CFLAGS) $($(@:.o=)_CFLAGS) -c -o $@ $<
endef

%:
	$(CC) -o $@ $+ $(LDFLAGS) $($@_LIBS)
%.o: %.c
	$(call cc)
%.o: %.c %.h
	$(call cc)

clean:
	rm -f $(PROGS) $(OBJS)