summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-02 02:16:24 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-02 02:16:24 +0100
commit35757bced85cfe870d62590d73bdbcb5035efbba (patch)
tree294bba39a278fdd350f6fc432ca5596a98397882
parent4b7f4f04e39779c3496855ea46fff565c360a4d5 (diff)
Force rebuilds on the tracker when feature flags change
-rw-r--r--.gitignore1
-rw-r--r--Makefile31
2 files changed, 21 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 3e469ff..5a9567f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ proxy.debug
9tests/runner 9tests/runner
10tests/runner.poll 10tests/runner.poll
11tests/runner.sanitize 11tests/runner.sanitize
12.buildstamp
diff --git a/Makefile b/Makefile
index bf4883e..45c0f29 100644
--- a/Makefile
+++ b/Makefile
@@ -67,6 +67,15 @@ LDFLAGS+=-pthread
67CFLAGS_libowfat=-I$(LIBOWFAT_HEADERS) 67CFLAGS_libowfat=-I$(LIBOWFAT_HEADERS)
68LDFLAGS_libowfat=-L$(LIBOWFAT_LIBRARY) -lowfat 68LDFLAGS_libowfat=-L$(LIBOWFAT_LIBRARY) -lowfat
69 69
70# Record feature flags as a dep to allow rebuild when they change
71BUILDSTAMP=.buildstamp
72BUILDDEPS=Makefile $(BUILDSTAMP)
73
74$(BUILDSTAMP): FORCE
75 @echo "$(CFLAGS) $(FEATURES) $(LDFLAGS)" | cmp -s - $@ 2>/dev/null || echo "$(CFLAGS) $(FEATURES) $(LDFLAGS)" > $@
76
77FORCE:
78
70BINARY =opentracker 79BINARY =opentracker
71HEADERS=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 80HEADERS=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
72SOURCES=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 81SOURCES=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
@@ -80,14 +89,14 @@ CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES)
80CFLAGS_proxy = $(CFLAGS_production) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE 89CFLAGS_proxy = $(CFLAGS_production) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE
81CFLAGS_proxy_debug = $(CFLAGS_debug) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE 90CFLAGS_proxy_debug = $(CFLAGS_debug) $(CFLAGS_libowfat) -DWANT_SYNC_LIVE
82 91
83$(BINARY): $(SOURCES) $(HEADERS) 92$(BINARY): $(SOURCES) $(HEADERS) $(BUILDDEPS)
84 $(CC) -o $@ $(CFLAGS_production) $(SOURCES) $(LDFLAGS) 93 $(CC) -o $@ $(CFLAGS_production) $(SOURCES) $(LDFLAGS)
85 $(STRIP) $@ 94 $(STRIP) $@
86$(BINARY).debug: $(SOURCES) $(HEADERS) 95$(BINARY).debug: $(SOURCES) $(HEADERS) $(BUILDDEPS)
87 $(CC) -o $@ $(CFLAGS_debug) $(SOURCES) $(LDFLAGS) 96 $(CC) -o $@ $(CFLAGS_debug) $(SOURCES) $(LDFLAGS)
88proxy: $(SOURCES_proxy) $(HEADERS) 97proxy: $(SOURCES_proxy) $(HEADERS) $(BUILDDEPS)
89 $(CC) -o $@ $(CFLAGS_proxy) $(SOURCES_proxy) $(LDFLAGS) $(LDFLAGS_libowfat) 98 $(CC) -o $@ $(CFLAGS_proxy) $(SOURCES_proxy) $(LDFLAGS) $(LDFLAGS_libowfat)
90proxy.debug: $(SOURCES_proxy) $(HEADERS) 99proxy.debug: $(SOURCES_proxy) $(HEADERS) $(BUILDDEPS)
91 $(CC) -o $@ $(CFLAGS_proxy_debug) $(SOURCES_proxy) $(LDFLAGS) $(LDFLAGS_libowfat) 100 $(CC) -o $@ $(CFLAGS_proxy_debug) $(SOURCES_proxy) $(LDFLAGS) $(LDFLAGS_libowfat)
92 101
93# Unit tests. The modules under test are compiled straight into the test 102# Unit tests. The modules under test are compiled straight into the test
@@ -103,13 +112,13 @@ TEST_HEADERS=tests/test.h $(HEADERS)
103FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE 112FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE
104CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test) 113CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test)
105 114
106$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) 115$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS)
107 $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS) 116 $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS)
108 117
109check: $(TESTBIN) $(BINARY) 118check: $(TESTBIN) $(BINARY)
110 ./$(TESTBIN) 119 ./$(TESTBIN)
111 120
112$(TESTBIN).poll: $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) 121$(TESTBIN).poll: $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS)
113 $(CC) -o $@ $(CFLAGS_test) -DOT_EVENT_FORCE_POLL $(TEST_SOURCES) $(TEST_UNITS) 122 $(CC) -o $@ $(CFLAGS_test) -DOT_EVENT_FORCE_POLL $(TEST_SOURCES) $(TEST_UNITS)
114 123
115check-poll: $(TESTBIN).poll 124check-poll: $(TESTBIN).poll
@@ -122,7 +131,7 @@ CC_sanitize?=clang
122CFLAGS_sanitize=$(CFLAGS_test) -fsanitize=address,undefined -fno-omit-frame-pointer 131CFLAGS_sanitize=$(CFLAGS_test) -fsanitize=address,undefined -fno-omit-frame-pointer
123LDFLAGS_sanitize=$(LDFLAGS) -fsanitize=address,undefined 132LDFLAGS_sanitize=$(LDFLAGS) -fsanitize=address,undefined
124 133
125$(TESTBIN).sanitize: $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) 134$(TESTBIN).sanitize: $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS)
126 $(CC_sanitize) -o $@ $(CFLAGS_sanitize) $(TEST_SOURCES) $(TEST_UNITS) $(LDFLAGS_sanitize) 135 $(CC_sanitize) -o $@ $(CFLAGS_sanitize) $(TEST_SOURCES) $(TEST_UNITS) $(LDFLAGS_sanitize)
127 136
128check-sanitize: $(TESTBIN).sanitize 137check-sanitize: $(TESTBIN).sanitize
@@ -139,7 +148,7 @@ FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING -DWANT_ACCESSLIST_B
139CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer 148CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer
140LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined 149LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined
141 150
142opentracker.integration: $(SOURCES) $(HEADERS) 151opentracker.integration: $(SOURCES) $(HEADERS) $(BUILDDEPS)
143 $(CC) -o $@ $(CFLAGS_integration) $(SOURCES) $(LDFLAGS_integration) 152 $(CC) -o $@ $(CFLAGS_integration) $(SOURCES) $(LDFLAGS_integration)
144 153
145check-integration: opentracker.integration 154check-integration: opentracker.integration
@@ -149,7 +158,7 @@ check-integration: opentracker.integration
149CFLAGS_tsan=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=thread -fno-omit-frame-pointer 158CFLAGS_tsan=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=thread -fno-omit-frame-pointer
150LDFLAGS_tsan=$(LDFLAGS) -fsanitize=thread 159LDFLAGS_tsan=$(LDFLAGS) -fsanitize=thread
151 160
152opentracker.tsan: $(SOURCES) $(HEADERS) 161opentracker.tsan: $(SOURCES) $(HEADERS) $(BUILDDEPS)
153 $(CC) -o $@ $(CFLAGS_tsan) $(SOURCES) $(LDFLAGS_tsan) 162 $(CC) -o $@ $(CFLAGS_tsan) $(SOURCES) $(LDFLAGS_tsan)
154 163
155check-tsan: opentracker.tsan 164check-tsan: opentracker.tsan
@@ -163,12 +172,12 @@ check-all:
163 $(MAKE) check-integration 172 $(MAKE) check-integration
164 $(MAKE) check-tsan 173 $(MAKE) check-tsan
165 174
166.PHONY: all check check-poll check-sanitize check-integration check-tsan check-all clean install 175.PHONY: all FORCE check check-poll check-sanitize check-integration check-tsan check-all clean install
167 176
168BINARIES=opentracker opentracker.debug opentracker.integration opentracker.tsan proxy proxy.debug $(TESTBIN) $(TESTBIN).sanitize $(TESTBIN).poll 177BINARIES=opentracker opentracker.debug opentracker.integration opentracker.tsan proxy proxy.debug $(TESTBIN) $(TESTBIN).sanitize $(TESTBIN).poll
169 178
170clean: 179clean:
171 rm -rf $(BINARIES) $(BINARIES:=.dSYM) *.o *~ 180 rm -rf $(BINARIES) $(BINARIES:=.dSYM) $(BUILDSTAMP) *.o *~
172 181
173install: 182install:
174 install -m 755 opentracker $(DESTDIR)$(BINDIR) 183 install -m 755 opentracker $(DESTDIR)$(BINDIR)