summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 688a2c4..ddf1e05 100644
--- a/Makefile
+++ b/Makefile
@@ -29,14 +29,19 @@ include Mk/gzip.mk
29 29
30# arc4random is part of libc on the BSDs, on macOS and on glibc 2.36 and 30# arc4random is part of libc on the BSDs, on macOS and on glibc 2.36 and
31# newer. On an older glibc or on musl it comes from libbsd instead. 31# newer. On an older glibc or on musl it comes from libbsd instead.
32#LDFLAGS+=-lbsd 32#OT_LDLIBS+=-lbsd
33 33
34CFLAGS+=-Wall -Wextra -Wwrite-strings -pipe -pthread 34CFLAGS?=-O3
35LDFLAGS+=-pthread 35
36# What the build requires, whatever you do to those.
37OT_CFLAGS+=-Wall -Wextra -Wwrite-strings -pipe -pthread
38OT_LDFLAGS+=-pthread
36 39
37OPTS_production=-O3
38OPTS_debug=-D_DEBUG -g -ggdb 40OPTS_debug=-D_DEBUG -g -ggdb
39 41
42COMPILE=$(CPPFLAGS) $(OT_CFLAGS) $(FEATURES)
43LINK=$(LDFLAGS) $(OT_LDFLAGS) $(LDLIBS) $(OT_LDLIBS)
44
40BINARY=opentracker 45BINARY=opentracker
41HEADERS=trackerlogic.h ot_urlencoded.h ot_batch.h ot_buf.h ot_event.h ot_fdstate.h ot_fmt.h ot_hex.h ot_ip.h ot_config.h ot_scan.h ot_socket.h ot_tcp.h ot_worker.h ot_workqueue.h ot_mutex.h ot_random.h ot_stats.h ot_vector.h ot_clean.h ot_udp.h ot_iovec.h ot_fullscrape.h ot_accesslist.h ot_http.h ot_livesync.h ot_rijndael.h 46HEADERS=trackerlogic.h ot_urlencoded.h ot_batch.h ot_buf.h ot_event.h ot_fdstate.h ot_fmt.h ot_hex.h ot_ip.h ot_config.h ot_scan.h ot_socket.h ot_tcp.h ot_worker.h ot_workqueue.h ot_mutex.h ot_random.h ot_stats.h ot_vector.h ot_clean.h ot_udp.h ot_iovec.h ot_fullscrape.h ot_accesslist.h ot_http.h ot_livesync.h ot_rijndael.h
42SOURCES=opentracker.c trackerlogic.c ot_urlencoded.c ot_batch.c ot_buf.c ot_event.c ot_fdstate.c ot_fmt.c ot_hex.c ot_ip.c ot_config.c ot_scan.c ot_socket.c ot_tcp.c ot_worker.c ot_workqueue.c ot_mutex.c ot_random.c ot_stats.c ot_vector.c ot_clean.c ot_udp.c ot_iovec.c ot_fullscrape.c ot_accesslist.c ot_http.c ot_livesync.c ot_rijndael.c 47SOURCES=opentracker.c trackerlogic.c ot_urlencoded.c ot_batch.c ot_buf.c ot_event.c ot_fdstate.c ot_fmt.c ot_hex.c ot_ip.c ot_config.c ot_scan.c ot_socket.c ot_tcp.c ot_worker.c ot_workqueue.c ot_mutex.c ot_random.c ot_stats.c ot_vector.c ot_clean.c ot_udp.c ot_iovec.c ot_fullscrape.c ot_accesslist.c ot_http.c ot_livesync.c ot_rijndael.c
@@ -49,20 +54,17 @@ BINARIES=$(BINARY) $(BINARY).debug
49BUILDSTAMP=.buildstamp 54BUILDSTAMP=.buildstamp
50BUILDDEPS=Makefile $(BUILDSTAMP) 55BUILDDEPS=Makefile $(BUILDSTAMP)
51 56
52CFLAGS_production=$(CFLAGS) $(OPTS_production) $(FEATURES)
53CFLAGS_debug=$(CFLAGS) $(OPTS_debug) $(FEATURES)
54
55all: $(BINARY) $(BINARY).debug 57all: $(BINARY) $(BINARY).debug
56 58
57$(BINARY): $(SOURCES) $(HEADERS) $(BUILDDEPS) 59$(BINARY): $(SOURCES) $(HEADERS) $(BUILDDEPS)
58 $(CC) -o $@ $(CFLAGS_production) $(SOURCES) $(LDFLAGS) 60 $(CC) -o $@ $(CFLAGS) $(COMPILE) $(SOURCES) $(LINK)
59 $(STRIP) $@ 61 $(STRIP) $@
60 62
61$(BINARY).debug: $(SOURCES) $(HEADERS) $(BUILDDEPS) 63$(BINARY).debug: $(SOURCES) $(HEADERS) $(BUILDDEPS)
62 $(CC) -o $@ $(CFLAGS_debug) $(SOURCES) $(LDFLAGS) 64 $(CC) -o $@ $(OPTS_debug) $(COMPILE) $(SOURCES) $(LINK)
63 65
64$(BUILDSTAMP): FORCE 66$(BUILDSTAMP): FORCE
65 @echo "$(CFLAGS) $(FEATURES) $(LDFLAGS)" | cmp -s - $@ 2>/dev/null || echo "$(CFLAGS) $(FEATURES) $(LDFLAGS)" > $@ 67 @echo "$(CFLAGS) $(COMPILE) $(LINK)" | cmp -s - $@ 2>/dev/null || echo "$(CFLAGS) $(COMPILE) $(LINK)" > $@
66 68
67clean: 69clean:
68 rm -rf $(BINARIES) $(BINARIES:=.dSYM) $(BUILDSTAMP) *.o *~ 70 rm -rf $(BINARIES) $(BINARIES:=.dSYM) $(BUILDSTAMP) *.o *~