summaryrefslogtreecommitdiff
path: root/Makefile
blob: afdc5289fcc7d5501e8cff6463dcd8dce53837b5 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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

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

.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)