diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 50 |
1 files changed, 33 insertions, 17 deletions
| @@ -47,10 +47,6 @@ include Makefile.gzip | |||
| 47 | #FEATURES+=-DWANT_DEV_RANDOM | 47 | #FEATURES+=-DWANT_DEV_RANDOM |
| 48 | FEATURES+=-DWANT_FULLSCRAPE | 48 | FEATURES+=-DWANT_FULLSCRAPE |
| 49 | 49 | ||
| 50 | # You need libowfat version 0.34 to allow for automatic release of chunks during | ||
| 51 | # full scrape transfer, if you rely on an older versions, enable this flag | ||
| 52 | #FEATURES+=-DWANT_NO_AUTO_FREE | ||
| 53 | |||
| 54 | # opentracker takes its randomness from arc4random, which is part of libc on | 50 | # opentracker takes its randomness from arc4random, which is part of libc on |
| 55 | # the BSDs, on macOS and on glibc 2.36 and newer. On an older glibc or on musl | 51 | # the BSDs, on macOS and on glibc 2.36 and newer. On an older glibc or on musl |
| 56 | # it comes from libbsd instead, so uncomment the next include to link it. | 52 | # it comes from libbsd instead, so uncomment the next include to link it. |
| @@ -64,13 +60,18 @@ GIT_VERSION=`sh -c 'command -v git >/dev/null && test -d .git && git rev-parse H | |||
| 64 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage | 60 | OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage |
| 65 | OPTS_production=-O3 | 61 | OPTS_production=-O3 |
| 66 | 62 | ||
| 67 | CFLAGS+=-I$(LIBOWFAT_HEADERS) -DGIT_VERSION=$(GIT_VERSION) -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic | 63 | CFLAGS+=-DGIT_VERSION=$(GIT_VERSION) -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic |
| 68 | LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread | 64 | LDFLAGS+=-pthread |
| 65 | |||
| 66 | # Only the proxy, which has not been ported since the tracker went dual stack, | ||
| 67 | # still wants libowfat. | ||
| 68 | CFLAGS_libowfat=-I$(LIBOWFAT_HEADERS) | ||
| 69 | LDFLAGS_libowfat=-L$(LIBOWFAT_LIBRARY) -lowfat | ||
| 69 | 70 | ||
| 70 | BINARY =opentracker | 71 | BINARY =opentracker |
| 71 | HEADERS=trackerlogic.h scan_urlencoded_query.h ot_batch.h ot_buf.h ot_hex.h ot_ip.h ot_config.h ot_scan.h ot_socket.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 | 72 | 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_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 |
| 72 | SOURCES=opentracker.c trackerlogic.c scan_urlencoded_query.c ot_batch.c ot_buf.c ot_hex.c ot_ip.c ot_config.c ot_scan.c ot_socket.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 | 73 | 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_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 |
| 73 | SOURCES_proxy=proxy.c ot_batch.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c ot_socket.c | 74 | SOURCES_proxy=proxy.c ot_batch.c ot_fdstate.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c ot_socket.c |
| 74 | 75 | ||
| 75 | OBJECTS = $(SOURCES:%.c=%.o) | 76 | OBJECTS = $(SOURCES:%.c=%.o) |
| 76 | OBJECTS_debug = $(SOURCES:%.c=%.debug.o) | 77 | OBJECTS_debug = $(SOURCES:%.c=%.debug.o) |
| @@ -84,8 +85,8 @@ all: $(BINARY) $(BINARY).debug | |||
| 84 | CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) | 85 | CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) |
| 85 | CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) | 86 | CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) |
| 86 | 87 | ||
| 87 | CFLAGS_proxy = $(CFLAGS_production) -DWANT_SYNC_LIVE | 88 | CFLAGS_proxy = $(CFLAGS_production) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE |
| 88 | CFLAGS_proxy_debug = $(CFLAGS_debug) -DWANT_SYNC_LIVE | 89 | CFLAGS_proxy_debug = $(CFLAGS_debug) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE |
| 89 | 90 | ||
| 90 | $(BINARY): $(OBJECTS) | 91 | $(BINARY): $(OBJECTS) |
| 91 | $(CC) -o $@ $(OBJECTS) $(LDFLAGS) | 92 | $(CC) -o $@ $(OBJECTS) $(LDFLAGS) |
| @@ -93,9 +94,9 @@ $(BINARY): $(OBJECTS) | |||
| 93 | $(BINARY).debug: $(OBJECTS_debug) | 94 | $(BINARY).debug: $(OBJECTS_debug) |
| 94 | $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS) | 95 | $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS) |
| 95 | proxy: $(OBJECTS_proxy) | 96 | proxy: $(OBJECTS_proxy) |
| 96 | $(CC) -o $@ $(OBJECTS_proxy) $(CFLAGS_production) $(LDFLAGS) | 97 | $(CC) -o $@ $(OBJECTS_proxy) $(CFLAGS_production) $(LDFLAGS) $(LDFLAGS_libowfat) |
| 97 | proxy.debug: $(OBJECTS_proxy_debug) | 98 | proxy.debug: $(OBJECTS_proxy_debug) |
| 98 | $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) | 99 | $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) $(LDFLAGS_libowfat) |
| 99 | 100 | ||
| 100 | $(OBJECTS): $(HEADERS) | 101 | $(OBJECTS): $(HEADERS) |
| 101 | $(OBJECTS_debug): $(HEADERS) | 102 | $(OBJECTS_debug): $(HEADERS) |
| @@ -119,8 +120,8 @@ $(OBJECTS_proxy_debug): $(HEADERS) | |||
| 119 | # has to. tests/stubs.c supplies the few symbols those modules reference but | 120 | # has to. tests/stubs.c supplies the few symbols those modules reference but |
| 120 | # the tests never reach. | 121 | # the tests never reach. |
| 121 | TESTBIN=tests/runner | 122 | TESTBIN=tests/runner |
| 122 | TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_scan_urlencoded_query.c tests/t_iovec.c tests/t_vector.c tests/t_random.c tests/t_hex.c tests/t_accesslist.c tests/t_scan.c tests/t_buf.c tests/t_ip.c tests/t_socket.c tests/t_mutex.c tests/t_batch.c | 123 | TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_urlencoded.c tests/t_iovec.c tests/t_vector.c tests/t_random.c tests/t_hex.c tests/t_accesslist.c tests/t_scan.c tests/t_buf.c tests/t_ip.c tests/t_socket.c tests/t_mutex.c tests/t_batch.c tests/t_fdstate.c tests/t_event.c tests/t_fmt.c |
| 123 | TEST_UNITS=scan_urlencoded_query.c ot_batch.c ot_buf.c ot_ip.c ot_socket.c ot_iovec.c ot_vector.c ot_random.c ot_hex.c ot_scan.c ot_accesslist.c ot_mutex.c | 124 | TEST_UNITS=ot_urlencoded.c ot_fmt.c ot_event.c ot_batch.c ot_fdstate.c ot_buf.c ot_ip.c ot_socket.c ot_iovec.c ot_vector.c ot_random.c ot_hex.c ot_scan.c ot_accesslist.c ot_mutex.c |
| 124 | TEST_HEADERS=tests/test.h $(HEADERS) | 125 | TEST_HEADERS=tests/test.h $(HEADERS) |
| 125 | # Tests reach code that sits behind feature flags, so the units under test are | 126 | # Tests reach code that sits behind feature flags, so the units under test are |
| 126 | # built with those features enabled. A test binary is not a production binary. | 127 | # built with those features enabled. A test binary is not a production binary. |
| @@ -133,10 +134,25 @@ $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) | |||
| 133 | check: $(TESTBIN) $(BINARY) | 134 | check: $(TESTBIN) $(BINARY) |
| 134 | ./$(TESTBIN) | 135 | ./$(TESTBIN) |
| 135 | 136 | ||
| 136 | .PHONY: all check clean install | 137 | # Black box tests: these drive the real binary over the wire, so they cover |
| 138 | # the event loop and the parsers working together, which the unit tests | ||
| 139 | # cannot reach. Built with the sanitizers on, so the tracker reports its own | ||
| 140 | # memory errors and the harness turns those into failures. | ||
| 141 | PYTHON?=python3 | ||
| 142 | FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING | ||
| 143 | CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer | ||
| 144 | LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined | ||
| 145 | |||
| 146 | opentracker.integration: $(SOURCES) $(HEADERS) | ||
| 147 | $(CC) -o $@ $(CFLAGS_integration) $(SOURCES) $(LDFLAGS_integration) -lz | ||
| 148 | |||
| 149 | check-integration: opentracker.integration | ||
| 150 | OPENTRACKER=./opentracker.integration $(PYTHON) -m unittest discover -s tests/integration | ||
| 151 | |||
| 152 | .PHONY: all check check-integration clean install | ||
| 137 | 153 | ||
| 138 | clean: | 154 | clean: |
| 139 | rm -rf opentracker opentracker.debug proxy proxy.debug $(TESTBIN) *.o *~ | 155 | rm -rf opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) *.o *~ |
| 140 | 156 | ||
| 141 | install: | 157 | install: |
| 142 | install -m 755 opentracker $(DESTDIR)$(BINDIR) | 158 | install -m 755 opentracker $(DESTDIR)$(BINDIR) |
