<commit_before>HOST:=$(shell hostname)

ifeq ($(HOST), origin)
 ORIGIN=1
else
 ifeq ($(HOST), nigiro)
  ORIGIN=1
 endif
endif
		
ifeq ($(ORIGIN), 1)
# When building on our dev.system
	include /home/system/Development/Switch/Makefile.dfl
	LIBTREE_PATH:=/home/system/Development/Switch/ext/ebtree/libtree.a
	CXXFLAGS:=$(CPPFLAGS_SANITY_DEBUG) #-fsanitize=address
	LDFLAGS:=$(LDFLAGS_SANITY) -L$(SWITCH_BASE) -lswitch -pthread -ldl \
	/usr/lib/x86_64-linux-gnu/libssl.a /usr/lib/x86_64-linux-gnu/libcrypto.a  \
	-lz -ljemalloc  $(LIBTREE_PATH)
	SWITCH_LIB:=-lswitch
	CXXFLAGS += -DTRACE_REACHABILITY_OVERSEER
else
# Lean switch bundled in this repo
	CXX:=clang++
	LIBTREE_PATH:=$(shell pwd)/Switch/ext/ebtree/libtree.a
	CXXFLAGS:=-std=c++1z  -Wstrict-aliasing=2 -Wsequence-point -Warray-bounds -Wextra -Winit-self -Wformat=2 -Wno-format-nonliteral -Wformat-security \
		-Wno-c++1z-extensions \
		-I ./Switch/ext/ \
		-Wunused-variable -Wunused-value -Wreturn-type -Wparentheses -Wmissing-braces -Wno-invalid-source-encoding -Wno-invalid-offsetof \
		-Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare -Wno-invalid-offsetof   \
		-fno-rtti -ffast-math  -D_REENTRANT -DREENTRANT  -g3 -ggdb -fno-omit-frame-pointer   \
		-fno-strict-aliasing    -DLEAN_SWITCH  -ISwitch/ -I./ -Wno-uninitialized -Wno-unused-function -Wno-uninitialized -funroll-loops  -Ofast
	LDFLAGS:=-ldl -ffunction-sections -pthread -ldl -lz -LSwitch/ext_snappy/ -lsnappy $(LIBTREE_PATH)
	SWITCH_LIB:=Switch/libswitch.a
	SWITCH_DEP:=switch
	EXT_DEP:=ext
	# Docker complains about clang++ dep.
	#CXX:=clang++
endif


SERVICE_OBJS:=$(patsubst %.cpp,%.o,$(wildcard service*.cpp))
CLIENT_OBJS:=$(patsubst %.cpp,%.o,$(wildcard client*.cpp))
TEST_SERVICE_OBJS:=$(patsubst %.cpp,%.o,$(wildcard test_service*.cpp))
TEST_CLIENT_OBJS:=$(patsubst %.cpp,%.o,$(wildcard test_client*.cpp))


#all: cli-tool client
all: service ##cli-tool client

switch:
	@make -C Switch/ext_snappy/ all
	@make -C Switch/ all

ext:
	@make -C Switch/ext/ebtree/ all

test_client: $(CLIENT_OBJS) $(SWITCH_DEP) $(EXT_DEP) $(TEST_CLIENT_OBJS)<commit_msg>Makefile<commit_after>HOST:=$(shell hostname)

ifeq ($(HOST), origin)
 ORIGIN=1
else
 ifeq ($(HOST), nigiro)
  ORIGIN=1
 endif
endif
		
ifeq ($(ORIGIN), 1)
# When building on our dev.system
	include /home/system/Development/Switch/Makefile.dfl
	LIBTREE_PATH:=/home/system/Development/Switch/ext/ebtree/libtree.a
	CXXFLAGS:=$(CPPFLAGS_SANITY_DEBUG) #-fsanitize=address
	LDFLAGS:=$(LDFLAGS_SANITY) -L$(SWITCH_BASE) -lswitch -pthread -ldl \
	/usr/lib/x86_64-linux-gnu/libssl.a /usr/lib/x86_64-linux-gnu/libcrypto.a  \
	-lz -ljemalloc  $(LIBTREE_PATH)
	SWITCH_LIB:=-lswitch
	CXXFLAGS += -DTRACE_REACHABILITY_OVERSEER
else
# Lean switch bundled in this repo
	CXX:=clang++
	LIBTREE_PATH:=$(shell pwd)/Switch/ext/ebtree/libtree.a
	CXXFLAGS:=-std=c++1z  -Wstrict-aliasing=2 -Wsequence-point -Warray-bounds -Wextra -Winit-self -Wformat=2 -Wno-format-nonliteral -Wformat-security \
		-Wno-c++1z-extensions \
		-I ./Switch/ext/ \
		-Wunused-variable -Wunused-value -Wreturn-type -Wparentheses -Wmissing-braces -Wno-invalid-source-encoding -Wno-invalid-offsetof \
		-Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare -Wno-invalid-offsetof   \
		-fno-rtti -ffast-math  -D_REENTRANT -DREENTRANT  -g3 -ggdb -fno-omit-frame-pointer   \
		-fno-strict-aliasing    -DLEAN_SWITCH  -ISwitch/ -I./ -Wno-uninitialized -Wno-unused-function -Wno-uninitialized -funroll-loops  -Ofast
	LDFLAGS:=-ldl -ffunction-sections -pthread -ldl -lz -LSwitch/ext_snappy/ -lsnappy $(LIBTREE_PATH)
	SWITCH_LIB:=Switch/libswitch.a
	SWITCH_DEP:=switch
	EXT_DEP:=ext
	# Docker complains about clang++ dep.
	#CXX:=clang++
endif


SERVICE_OBJS:=$(patsubst %.cpp,%.o,$(wildcard service*.cpp))
CLIENT_OBJS:=$(patsubst %.cpp,%.o,$(wildcard client*.cpp))
TEST_SERVICE_OBJS:=$(patsubst %.cpp,%.o,$(wildcard test_service*.cpp))
TEST_CLIENT_OBJS:=$(patsubst %.cpp,%.o,$(wildcard test_client*.cpp))


all: service cli-tool client

switch:
	@make -C Switch/ext_snappy/ all
	@make -C Switch/ all

ext:
	@make -C Switch/ext/ebtree/ all

test_client: $(CLIENT_OBJS) $(SWITCH_DEP) $(EXT_DEP) $(TEST_CLIENT_OBJS)
{'fraction_non_alphanumeric': 0.16006639791320845, 'fraction_numerical': 0.00758833293810766, 'mean_word_length': 4.400768245838669, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6210260', 'n_tokens_mistral': 1815, 'n_tokens_neox': 1733, 'n_words': 286}