diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 46 |
1 files changed, 30 insertions, 16 deletions
| @@ -68,36 +68,50 @@ CFLAGS+=-I$(LIBOWFAT_HEADERS) -DGIT_VERSION=$(GIT_VERSION) -Wall -pipe -pthread | |||
| 68 | LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread | 68 | LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread |
| 69 | 69 | ||
| 70 | BINARY =opentracker | 70 | BINARY =opentracker |
| 71 | HEADERS=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 | 71 | HEADERS=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 |
| 72 | SOURCES=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 | 72 | SOURCES=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 |
| 73 | SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c | 73 | SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c ot_socket.c |
| 74 | 74 | ||
| 75 | OBJECTS = $(SOURCES:%.c=%.o) | 75 | OBJECTS = $(SOURCES:%.c=%.o) |
| 76 | OBJECTS_debug = $(SOURCES:%.c=%.debug.o) | 76 | OBJECTS_debug = $(SOURCES:%.c=%.debug.o) |
| 77 | OBJECTS_proxy = $(SOURCES_proxy:%.c=%.o) | 77 | OBJECTS_proxy = $(SOURCES_proxy:%.c=%.proxy.o) |
| 78 | OBJECTS_proxy_debug = $(SOURCES_proxy:%.c=%.debug.o) | 78 | OBJECTS_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 | ||
| 82 | all: $(BINARY) $(BINARY).debug | 82 | all: $(BINARY) $(BINARY).debug |
| 83 | 83 | ||
| 84 | CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) | 84 | CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) |
| 85 | CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) | 85 | CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) |
| 86 | 86 | ||
| 87 | $(BINARY): $(OBJECTS) $(HEADERS) | 87 | CFLAGS_proxy = $(CFLAGS_production) -DWANT_SYNC_LIVE |
| 88 | CFLAGS_proxy_debug = $(CFLAGS_debug) -DWANT_SYNC_LIVE | ||
| 89 | |||
| 90 | $(BINARY): $(OBJECTS) | ||
| 88 | $(CC) -o $@ $(OBJECTS) $(LDFLAGS) | 91 | $(CC) -o $@ $(OBJECTS) $(LDFLAGS) |
| 89 | $(STRIP) $@ | 92 | $(STRIP) $@ |
| 90 | $(BINARY).debug: $(OBJECTS_debug) $(HEADERS) | 93 | $(BINARY).debug: $(OBJECTS_debug) |
| 91 | $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS) | 94 | $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS) |
| 92 | proxy: $(OBJECTS_proxy) $(HEADERS) | 95 | proxy: $(OBJECTS_proxy) |
| 93 | $(CC) -o $@ $(OBJECTS_proxy) $(CFLAGS_production) $(LDFLAGS) | 96 | $(CC) -o $@ $(OBJECTS_proxy) $(CFLAGS_production) $(LDFLAGS) |
| 94 | proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) | 97 | proxy.debug: $(OBJECTS_proxy_debug) |
| 95 | $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) | 98 | $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) |
| 96 | 99 | ||
| 97 | .c.debug.o : $(HEADERS) | 100 | $(OBJECTS): $(HEADERS) |
| 101 | $(OBJECTS_debug): $(HEADERS) | ||
| 102 | $(OBJECTS_proxy): $(HEADERS) | ||
| 103 | $(OBJECTS_proxy_debug): $(HEADERS) | ||
| 104 | |||
| 105 | .c.proxy.debug.o : | ||
| 106 | $(CC) -c -o $@ $(CFLAGS_proxy_debug) $(<:.proxy.debug.o=.c) | ||
| 107 | |||
| 108 | .c.proxy.o : | ||
| 109 | $(CC) -c -o $@ $(CFLAGS_proxy) $(<:.proxy.o=.c) | ||
| 110 | |||
| 111 | .c.debug.o : | ||
| 98 | $(CC) -c -o $@ $(CFLAGS_debug) $(<:.debug.o=.c) | 112 | $(CC) -c -o $@ $(CFLAGS_debug) $(<:.debug.o=.c) |
| 99 | 113 | ||
| 100 | .c.o : $(HEADERS) | 114 | .c.o : |
| 101 | $(CC) -c -o $@ $(CFLAGS_production) $< | 115 | $(CC) -c -o $@ $(CFLAGS_production) $< |
| 102 | 116 | ||
| 103 | # Unit tests. The modules under test are compiled straight into the test | 117 | # Unit tests. The modules under test are compiled straight into the test |
| @@ -105,12 +119,12 @@ proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) | |||
| 105 | # has to. tests/stubs.c supplies the few symbols those modules reference but | 119 | # has to. tests/stubs.c supplies the few symbols those modules reference but |
| 106 | # the tests never reach. | 120 | # the tests never reach. |
| 107 | TESTBIN=tests/runner | 121 | TESTBIN=tests/runner |
| 108 | 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 | 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 |
| 109 | TEST_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 | 123 | TEST_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 |
| 110 | TEST_HEADERS=tests/test.h $(HEADERS) | 124 | TEST_HEADERS=tests/test.h $(HEADERS) |
| 111 | # Tests reach code that sits behind feature flags, so the units under test are | 125 | # 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. | 126 | # built with those features enabled. A test binary is not a production binary. |
| 113 | FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK | 127 | FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE |
| 114 | CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test) | 128 | CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test) |
| 115 | 129 | ||
| 116 | $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) | 130 | $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) |
| @@ -122,7 +136,7 @@ check: $(TESTBIN) | |||
| 122 | .PHONY: all check clean install | 136 | .PHONY: all check clean install |
| 123 | 137 | ||
| 124 | clean: | 138 | clean: |
| 125 | rm -rf opentracker opentracker.debug $(TESTBIN) *.o *~ | 139 | rm -rf opentracker opentracker.debug proxy proxy.debug $(TESTBIN) *.o *~ |
| 126 | 140 | ||
| 127 | install: | 141 | install: |
| 128 | install -m 755 opentracker $(DESTDIR)$(BINDIR) | 142 | install -m 755 opentracker $(DESTDIR)$(BINDIR) |
