Differences From
Artifact [b1a751a53e]:
1 +B = build
2 +E = ext
3 +
1 4 pq-inc != pkg-config --cflags libpq
2 5 pq-lib != pkg-config --libs libpq
3 6
4 -cc-flags = -std=c2x $(pq-inc)
5 -ld-flags = $(pq-lib)
7 +wg-inc = -I$E/wglib
6 8
7 -B = build
9 +dbg-flags = $(if $(debug),-g -D_cfg_debug,)
10 +cc-flags = -std=c2x $(pq-inc) $(wg-inc) $(dbg-flags)
11 +ld-flags = $(pq-lib) $(dbg-flags)
12 +
8 13
9 14 # link rule
10 15 .PHONY: wgsync
11 -$B/wgsync: $B/wgsync.o $B/wireguard.o | $B/
16 +$B/wgsync: $B/wgsync.o $B/pqp.o $B/def.o $B/wireguard.o | $B/
12 17 $(CC) $(ld-flags) $^ -o $@
13 18
14 19 # build rules
15 20 $B/%.o: src/%.c | $B/
16 21 $(CC) $(cc-flags) -c $< -o $@
17 22
18 -$B/wireguard.o: ext/wglib/wireguard.c ext/wglib/wireguard.h | $B/
23 +$B/wireguard.o: $E/wglib/wireguard.c $E/wglib/wireguard.h | $B/
19 24 $(CC) -std=c11 -c $< -o $@
20 25
21 26 # dep listings
22 -$B/wgsync.o: ext/wglib/wireguard.h
27 +$B/wgsync.o: $E/wglib/wireguard.h src/pqp.h src/def.h
28 +$B/pqp.o: src/pqp.h src/def.h
29 +$B/def.o: src/def.h
23 30
24 31 # fetch rules
25 32 %/:
26 33 mkdir -p $@
27 34
28 35 wg-lib-uri = https://git.zx2c4.com/wireguard-tools/plain/contrib/embeddable-wg-library
29 -ext/wglib/%: | ext/wglib/
36 +$E/wglib/%: | $E/wglib/
30 37 curl $(wg-lib-uri)/$* >$@