aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c86038f94c40dc9a5d28f397834f56c0b54b0d0d (plain) (blame)
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
PKGNAME = cg-tools


BIN = bin/cg-brilliance \
      bin/cg-darkroom \
      bin/cg-gamma \
      bin/cg-icc \
      bin/cg-limits \
      bin/cg-negative \
      bin/cg-query \
      bin/cg-rainbow \
      bin/cg-remove \
      bin/cg-sleepmode

OPTIMISE = -O2

WARN = -Wall -Wextra

DEF = -D'PKGNAME="$(PKGNAME)"' -D_DEFAULT_SOURCE


all: $(BIN)

bin/%: obj/%.o obj/cg-base.o
	@mkdir -p -- "$$(dirname -- "$@")"
	$(CC) -std=c99 $(OPTIMISE) $(WARN) $(DEF) -o $@ $^ $(LDFLAGS) -lm -lcoopgamma

bin/cg-query: obj/cg-query.o
	@mkdir -p -- "$$(dirname -- "$@")"
	$(CC) -std=c99 $(OPTIMISE) $(WARN) $(DEF) -o $@ $^ $(LDFLAGS) -lm -lcoopgamma

bin/cg-remove: obj/cg-remove.o
	@mkdir -p -- "$$(dirname -- "$@")"
	$(CC) -std=c99 $(OPTIMISE) $(WARN) $(DEF) -o $@ $^ $(LDFLAGS) -lm -lcoopgamma

obj/%.o: src/%.c src/*.h
	@mkdir -p -- "$$(dirname -- "$@")"
	$(CC) -std=c99 $(OPTIMISE) $(WARN) $(DEF) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

clean:
	-rm -r -- bin obj

.PHONY: all clean