diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 12 insertions, 10 deletions
| @@ -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 | ||
| 34 | CFLAGS+=-Wall -Wextra -Wwrite-strings -pipe -pthread | 34 | CFLAGS?=-O3 |
| 35 | LDFLAGS+=-pthread | 35 | |
| 36 | # What the build requires, whatever you do to those. | ||
| 37 | OT_CFLAGS+=-Wall -Wextra -Wwrite-strings -pipe -pthread | ||
| 38 | OT_LDFLAGS+=-pthread | ||
| 36 | 39 | ||
| 37 | OPTS_production=-O3 | ||
| 38 | OPTS_debug=-D_DEBUG -g -ggdb | 40 | OPTS_debug=-D_DEBUG -g -ggdb |
| 39 | 41 | ||
| 42 | COMPILE=$(CPPFLAGS) $(OT_CFLAGS) $(FEATURES) | ||
| 43 | LINK=$(LDFLAGS) $(OT_LDFLAGS) $(LDLIBS) $(OT_LDLIBS) | ||
| 44 | |||
| 40 | BINARY=opentracker | 45 | BINARY=opentracker |
| 41 | HEADERS=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 | 46 | HEADERS=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 |
| 42 | SOURCES=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 | 47 | SOURCES=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 | |||
| 49 | BUILDSTAMP=.buildstamp | 54 | BUILDSTAMP=.buildstamp |
| 50 | BUILDDEPS=Makefile $(BUILDSTAMP) | 55 | BUILDDEPS=Makefile $(BUILDSTAMP) |
| 51 | 56 | ||
| 52 | CFLAGS_production=$(CFLAGS) $(OPTS_production) $(FEATURES) | ||
| 53 | CFLAGS_debug=$(CFLAGS) $(OPTS_debug) $(FEATURES) | ||
| 54 | |||
| 55 | all: $(BINARY) $(BINARY).debug | 57 | all: $(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 | ||
| 67 | clean: | 69 | clean: |
| 68 | rm -rf $(BINARIES) $(BINARIES:=.dSYM) $(BUILDSTAMP) *.o *~ | 70 | rm -rf $(BINARIES) $(BINARIES:=.dSYM) $(BUILDSTAMP) *.o *~ |
