<commit_before>all: doxygen asan tsan clang release clang-release analyzed

doxygen:
	doxygen Doxyfile

build-dir = \
	rm -rf $1-build && mkdir $1-build && cd $1-build

debug:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Debug && $(MAKE)

release:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Release && $(MAKE) chatsync

asan:
	$(call build-dir, $@) && CXXFLAGS="-fsanitize=address" CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && $(MAKE) chatsync

tsan:
	$(call build-dir, $@) && CXXFLAGS="-fsanitize=thread" CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && $(MAKE) chatsync

clang:
	$(call build-dir, $@) && CXX=clang++ CC=clang cmake .. && $(MAKE) chatsync

clang-release:
	$(call build-dir, $@) && CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=Release && $(MAKE) chatsync

analyzed:
	$(call build-dir, $@) && scan-build cmake ..  && scan-build $(MAKE) chatsync

clean:
	rm -rf *-build

memcheck:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Debug && $(MAKE) &&  (valgrind --tool=memcheck --track-origins=yes --leak-check=full --trace-children=yes --db-attach=yes --show-reachable=yes ./unit_tests 2>/tmp/unit-test-valg.log)</dev/null && sed '/in use/!d;s/.*exit:\s\([[:digit:]]\+\)\sbytes.*/\1/' /tmp/unit-test-valg.log | sort -n | uniq


dockerimage:
	cd dockerbuild && (docker images | grep chatsync-deploy) || docker build -t chatsync-deploy .
<commit_msg>[Tooling] Added tidy target<commit_after>all: doxygen asan tsan clang release clang-release analyzed

doxygen:
	doxygen Doxyfile

build-dir = \
	rm -rf $1-build && mkdir $1-build && cd $1-build

debug:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Debug && $(MAKE)

release:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Release && $(MAKE) chatsync

asan:
	$(call build-dir, $@) && CXXFLAGS="-fsanitize=address" CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && $(MAKE) chatsync

tsan:
	$(call build-dir, $@) && CXXFLAGS="-fsanitize=thread" CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && $(MAKE) chatsync

clang:
	$(call build-dir, $@) && CXX=clang++ CC=clang cmake .. && $(MAKE) chatsync

clang-release:
	$(call build-dir, $@) && CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=Release && $(MAKE) chatsync

analyzed:
	$(call build-dir, $@) && scan-build cmake ..  && scan-build $(MAKE) chatsync

tidy:
	$(call build-dir, $@) && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=True ..  && clang-tidy -p debug-build ../src/*.cpp

clean:
	rm -rf *-build

memcheck:
	$(call build-dir, $@) && cmake .. -DCMAKE_BUILD_TYPE=Debug && $(MAKE) &&  (valgrind --tool=memcheck --track-origins=yes --leak-check=full --trace-children=yes --db-attach=yes --show-reachable=yes ./unit_tests 2>/tmp/unit-test-valg.log)</dev/null && sed '/in use/!d;s/.*exit:\s\([[:digit:]]\+\)\sbytes.*/\1/' /tmp/unit-test-valg.log | sort -n | uniq


dockerimage:
	cd dockerbuild && (docker images | grep chatsync-deploy) || docker build -t chatsync-deploy .

{'fraction_non_alphanumeric': 0.20246831220813877, 'fraction_numerical': 0.00333555703802535, 'mean_word_length': 4.100340136054422, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2024153', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1162, 'n_words': 240}