<commit_before>
UNAME := $(shell uname)
CFLAGS=-Iinclude -Iinclude/evhtp -O2 -fomit-frame-pointer
LDFLAGS=-Llib -Wl,--gc-sections

ifeq ($(UNAME),Darwin)
LIBS=-levhtp -levent -levent_openssl -lssl -lcrypto -lpthread
else
CC=$(CURDIR)/bin/musl-gcc
LIBS=-levhtp -levent -levent_openssl -lssl -lcrypto -lpthread -lrt
endif

all: general

include libc.mk
include libssl.mk
include libevent.mk
include libevhtp.mk
include libpaxos.mk

general: main.o servedns.o base64.o city.o $(LIBC_LIBS) $(LIBEVHTP_LIBS) $(LIBEVENT_LIBS) $(LIBSSL_LIBS)
	$(CC) $(LDFLAGS) -o $@ main.o servedns.o base64.o $(LIBS)

certs:
	mkdir certs

certs/localhost.key: bin/openssl certs
	bin/openssl genpkey -algorithm RSA -out certs/localhost.key -pkeyopt rsa_keygen_bits:2048

certs/localhost.csr: certs/localhost.key bin/openssl certs
	bin/openssl req -subj '/C=US/ST=CA/L=San Francisco/CN=localhost' -new -key certs/localhost.key -out certs/localhost.csr

certs/localhost.cert: certs/localhost.key certs/localhost.csr bin/openssl certs
	bin/openssl req -x509 -days 365 -key certs/localhost.key -in certs/localhost.csr -out certs/localhost.cert

certs/localhost.pem: certs/localhost.cert certs/localhost.key certs
	cat certs/localhost.key certs/localhost.cert > certs/localhost.pem

test: general certs/localhost.pem
	(./general -c certs/localhost.pem & (sleep 1 && curl --insecure https://localhost:5443/ ; echo ; kill $$!))

clean:
	rm -rf general *.o

distclean: clean
	rm -rf lib bin include share ssl
	rm -rf libevhtp/build
	cd libevhtp && git checkout build/placeholder
	make -C openssl clean && rm openssl/Makefile || exit 0
	make -C libevent distclean || exit 0
	make -C musl distclean || exit 0

main.o servedns.o base64.o city.o: $(LIBC_ALL) $(LIBEVHTP_HFILES) $(LIBEVENT_HFILES) $(LIBSSL_HFILES)
<commit_msg>remove libpaxos reference from makefile<commit_after>
UNAME := $(shell uname)
CFLAGS=-Iinclude -Iinclude/evhtp -O2 -fomit-frame-pointer
LDFLAGS=-Llib -Wl,--gc-sections

ifeq ($(UNAME),Darwin)
LIBS=-levhtp -levent -levent_openssl -lssl -lcrypto -lpthread
else
CC=$(CURDIR)/bin/musl-gcc
LIBS=-levhtp -levent -levent_openssl -lssl -lcrypto -lpthread -lrt
endif

all: general

include libc.mk
include libssl.mk
include libevent.mk
include libevhtp.mk

general: main.o servedns.o base64.o city.o $(LIBC_LIBS) $(LIBEVHTP_LIBS) $(LIBEVENT_LIBS) $(LIBSSL_LIBS)
	$(CC) $(LDFLAGS) -o $@ main.o servedns.o base64.o $(LIBS)

certs:
	mkdir certs

certs/localhost.key: bin/openssl certs
	bin/openssl genpkey -algorithm RSA -out certs/localhost.key -pkeyopt rsa_keygen_bits:2048

certs/localhost.csr: certs/localhost.key bin/openssl certs
	bin/openssl req -subj '/C=US/ST=CA/L=San Francisco/CN=localhost' -new -key certs/localhost.key -out certs/localhost.csr

certs/localhost.cert: certs/localhost.key certs/localhost.csr bin/openssl certs
	bin/openssl req -x509 -days 365 -key certs/localhost.key -in certs/localhost.csr -out certs/localhost.cert

certs/localhost.pem: certs/localhost.cert certs/localhost.key certs
	cat certs/localhost.key certs/localhost.cert > certs/localhost.pem

test: general certs/localhost.pem
	(./general -c certs/localhost.pem & (sleep 1 && curl --insecure https://localhost:5443/ ; echo ; kill $$!))

clean:
	rm -rf general *.o

distclean: clean
	rm -rf lib bin include share ssl
	rm -rf libevhtp/build
	cd libevhtp && git checkout build/placeholder
	make -C openssl clean && rm openssl/Makefile || exit 0
	make -C libevent distclean || exit 0
	make -C musl distclean || exit 0

main.o servedns.o base64.o city.o: $(LIBC_ALL) $(LIBEVHTP_HFILES) $(LIBEVENT_HFILES) $(LIBSSL_HFILES)

{'fraction_non_alphanumeric': 0.12632459564974902, 'fraction_numerical': 0.013943112102621304, 'mean_word_length': 4.321958456973293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4161936', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1348, 'n_words': 344}