From 7af7598086e5a3f9a75507cd6f9907a98faf3d9d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 25 Oct 2026 02:41:48 +0200 Subject: Add sub system to abstract low level multi platform socket handling ourselves --- Makefile | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'Makefile') 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 LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread BINARY =opentracker -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 -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 -SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c +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 +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 +SOURCES_proxy=proxy.c ot_vector.c ot_mutex.c ot_random.c ot_scan.c ot_ip.c ot_socket.c OBJECTS = $(SOURCES:%.c=%.o) OBJECTS_debug = $(SOURCES:%.c=%.debug.o) -OBJECTS_proxy = $(SOURCES_proxy:%.c=%.o) -OBJECTS_proxy_debug = $(SOURCES_proxy:%.c=%.debug.o) +OBJECTS_proxy = $(SOURCES_proxy:%.c=%.proxy.o) +OBJECTS_proxy_debug = $(SOURCES_proxy:%.c=%.proxy.debug.o) -.SUFFIXES: .debug.o .o .c +.SUFFIXES: .proxy.debug.o .proxy.o .debug.o .o .c all: $(BINARY) $(BINARY).debug CFLAGS_production = $(CFLAGS) $(OPTS_production) $(FEATURES) CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $(FEATURES) +CFLAGS_proxy = $(CFLAGS_production) -DWANT_SYNC_LIVE +CFLAGS_proxy_debug = $(CFLAGS_debug) -DWANT_SYNC_LIVE + $(BINARY): $(OBJECTS) $(HEADERS) $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(STRIP) $@ @@ -94,6 +97,12 @@ proxy: $(OBJECTS_proxy) $(HEADERS) proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) $(CC) -o $@ $(OBJECTS_proxy_debug) $(LDFLAGS) +.c.proxy.debug.o : $(HEADERS) + $(CC) -c -o $@ $(CFLAGS_proxy_debug) $(<:.proxy.debug.o=.c) + +.c.proxy.o : $(HEADERS) + $(CC) -c -o $@ $(CFLAGS_proxy) $(<:.proxy.o=.c) + .c.debug.o : $(HEADERS) $(CC) -c -o $@ $(CFLAGS_debug) $(<:.debug.o=.c) @@ -105,12 +114,12 @@ proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) # has to. tests/stubs.c supplies the few symbols those modules reference but # the tests never reach. TESTBIN=tests/runner -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 -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 +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 +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 TEST_HEADERS=tests/test.h $(HEADERS) # Tests reach code that sits behind feature flags, so the units under test are # built with those features enabled. A test binary is not a production binary. -FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK +FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES_test) $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) @@ -122,7 +131,7 @@ check: $(TESTBIN) .PHONY: all check clean install clean: - rm -rf opentracker opentracker.debug $(TESTBIN) *.o *~ + rm -rf opentracker opentracker.debug proxy proxy.debug $(TESTBIN) *.o *~ install: install -m 755 opentracker $(DESTDIR)$(BINDIR) -- cgit v1.3