<commit_before>
S = $(src)
VPATH = $(src)

sanitize.debug = -fsanitize=address -fsanitize=leak -fsanitize=undefined
sanitize.release =

opt.debug = -O0
opt.release = -O2 -flto

sanitize = $(sanitize.$(mode))
opt = $(opt.$(mode))

libs = -laio -ltcmalloc

CXXFLAGS = -std=gnu++1y -g -Wall -Werror $(opt) -MD -MT $@ -MP $(sanitize) -fvisibility=hidden $(libs)
CXXFLAGS += -pthread

# Ubuntu fails without this, see https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201
CXXFLAGS += -Wl,--no-as-needed 

tests = test-reactor fileiotest virtiotest l3_test ip_test

link = $(CXX) $(CXXFLAGS) -o $@ $^

%: %.o
	$(link)

all: seastar $(tests) httpd

clean:
	rm seastar $(tests) *.o

seastar: main.o reactor.o
	$(link)

test-reactor: test-reactor.o reactor.o

httpd: httpd.o reactor.o

fileiotest: fileiotest.o reactor.o

virtiotest: virtiotest.o virtio.o reactor.o net.o ip.o ethernet.o arp.o

l3_test: l3_test.o virtio.o reactor.o net.o ip.o ethernet.o arp.o

ip_test: ip_test.o virtio.o reactor.o net.o ip.o arp.o ethernet.o

-include *.d<commit_msg>build: support subdirectories<commit_after>
S = $(src)
VPATH = $(src)

sanitize.debug = -fsanitize=address -fsanitize=leak -fsanitize=undefined
sanitize.release =

opt.debug = -O0
opt.release = -O2 -flto

sanitize = $(sanitize.$(mode))
opt = $(opt.$(mode))

libs = -laio -ltcmalloc

CXXFLAGS = -std=gnu++1y -g -Wall -Werror $(opt) -MD -MT $@ -MP $(sanitize) -fvisibility=hidden $(libs)
CXXFLAGS += -pthread
CXXFLAGS += -I $(src)

# Ubuntu fails without this, see https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201
CXXFLAGS += -Wl,--no-as-needed 

tests = test-reactor fileiotest virtiotest l3_test ip_test

link = mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -o $@ $^
compile = mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c -o $@ $<

%: %.o
	$(link)

%.o: %.cc
	$(compile)

all: seastar $(tests) httpd

clean:
	rm seastar $(tests) *.o

seastar: main.o reactor.o
	$(link)

test-reactor: test-reactor.o reactor.o

httpd: httpd.o reactor.o

fileiotest: fileiotest.o reactor.o

virtiotest: virtiotest.o virtio.o reactor.o net.o ip.o ethernet.o arp.o

l3_test: l3_test.o virtio.o reactor.o net.o ip.o ethernet.o arp.o

ip_test: ip_test.o virtio.o reactor.o net.o ip.o arp.o ethernet.o

-include $(shell find -name '*.d')
{'fraction_non_alphanumeric': 0.17223198594024605, 'fraction_numerical': 0.011423550087873463, 'mean_word_length': 3.7536534446764094, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1703496', 'n_tokens_mistral': 1020, 'n_tokens_neox': 949, 'n_words': 229}