summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 19 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 27d635d..2587b62 100644
--- a/Makefile
+++ b/Makefile
@@ -68,22 +68,25 @@ CFLAGS+=-I$(LIBOWFAT_HEADERS) -DGIT_VERSION=$(GIT_VERSION) -Wall -pipe -pthread
68LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread 68LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread
69 69
70BINARY =opentracker 70BINARY =opentracker
71HEADERS=trackerlogic.h scan_urlencoded_query.h ot_buf.h ot_hex.h ot_ip.h ot_scan.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 71HEADERS=trackerlogic.h scan_urlencoded_query.h ot_buf.h ot_hex.h ot_ip.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
72SOURCES=opentracker.c trackerlogic.c scan_urlencoded_query.c ot_buf.c ot_hex.c ot_ip.c ot_scan.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 72SOURCES=opentracker.c trackerlogic.c scan_urlencoded_query.c ot_buf.c ot_hex.c ot_ip.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
73SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c 73SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c ot_socket.c
74 74
75OBJECTS = $(SOURCES:%.c=%.o) 75OBJECTS = $(SOURCES:%.c=%.o)
76OBJECTS_debug = $(SOURCES:%.c=%.debug.o) 76OBJECTS_debug = $(SOURCES:%.c=%.debug.o)
77OBJECTS_proxy = $(SOURCES_proxy:%.c=%.o) 77OBJECTS_proxy = $(SOURCES_proxy:%.c=%.proxy.o)
78OBJECTS_proxy_debug = $(SOURCES_proxy:%.c=%.debug.o) 78OBJECTS_proxy_debug = $(SOURCES_proxy:%.c=%.proxy.debug.o)
79 79
80.SUFFIXES: .debug.o .o .c 80.SUFFIXES: .proxy.debug.o .proxy.o .debug.o .o .c
81 81
82all: $(BINARY) $(BINARY).debug 82all: $(BINARY) $(BINARY).debug
83 83
84CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) 84CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES)
85CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) 85CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES)
86 86
87CFLAGS_proxy = $(CFLAGS_production) -DWANT_SYNC_LIVE
88CFLAGS_proxy_debug = $(CFLAGS_debug) -DWANT_SYNC_LIVE
89
87$(BINARY): $(OBJECTS) $(HEADERS) 90$(BINARY): $(OBJECTS) $(HEADERS)
88 $(CC) -o $@ $(OBJECTS) $(LDFLAGS) 91 $(CC) -o $@ $(OBJECTS) $(LDFLAGS)
89 $(STRIP) $@ 92 $(STRIP) $@
@@ -94,6 +97,12 @@ proxy: $(OBJECTS_proxy) $(HEADERS)
94proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) 97proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS)
95 $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) 98 $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS)
96 99
100.c.proxy.debug.o : $(HEADERS)
101 $(CC) -c -o $@ $(CFLAGS_proxy_debug) $(<:.proxy.debug.o=.c)
102
103.c.proxy.o : $(HEADERS)
104 $(CC) -c -o $@ $(CFLAGS_proxy) $(<:.proxy.o=.c)
105
97.c.debug.o : $(HEADERS) 106.c.debug.o : $(HEADERS)
98 $(CC) -c -o $@ $(CFLAGS_debug) $(<:.debug.o=.c) 107 $(CC) -c -o $@ $(CFLAGS_debug) $(<:.debug.o=.c)
99 108
@@ -105,12 +114,12 @@ proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS)
105# has to. tests/stubs.c supplies the few symbols those modules reference but 114# has to. tests/stubs.c supplies the few symbols those modules reference but
106# the tests never reach. 115# the tests never reach.
107TESTBIN=tests/runner 116TESTBIN=tests/runner
108TEST_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 117TEST_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
109TEST_UNITS=scan_urlencoded_query.c ot_buf.c ot_ip.c ot_iovec.c ot_vector.c ot_random.c ot_hex.c ot_scan.c ot_accesslist.c 118TEST_UNITS=scan_urlencoded_query.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
110TEST_HEADERS=tests/test.h $(HEADERS) 119TEST_HEADERS=tests/test.h $(HEADERS)
111# Tests reach code that sits behind feature flags, so the units under test are 120# Tests reach code that sits behind feature flags, so the units under test are
112# built with those features enabled. A test binary is not a production binary. 121# built with those features enabled. A test binary is not a production binary.
113FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK 122FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE
114CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test) 123CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test)
115 124
116$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) 125$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS)
@@ -122,7 +131,7 @@ check: $(TESTBIN)
122.PHONY: all check clean install 131.PHONY: all check clean install
123 132
124clean: 133clean:
125 rm -rf opentracker opentracker.debug $(TESTBIN) *.o *~ 134 rm -rf opentracker opentracker.debug proxy proxy.debug $(TESTBIN) *.o *~
126 135
127install: 136install:
128 install -m 755 opentracker $(DESTDIR)$(BINDIR) 137 install -m 755 opentracker $(DESTDIR)$(BINDIR)