<commit_before>.PHONY: all clean check dirs

gumbo_objs := $(patsubst %.c,build/%.o,$(wildcard src/*.c))
test_objs := $(patsubst %.cc,build/%.o,$(wildcard test/*.cc))
gtest_lib := googletest/make/gtest_main.a

CPPFLAGS := -Isrc
CFLAGS := -std=c99 -Os
CXXFLAGS := -isystem googletest/include -std=c++11 -Os
LDFLAGS := -pthread

all: check

build/src:
	mkdir -p "$@"

build/test:
	mkdir -p "$@"

build/src/%.o: src/%.c | build/src
	$(CC) -MMD $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

build/test/%.o: test/%.cc | build/test
	$(CXX) -MMD $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<

build/run_tests: $(gumbo_objs) $(test_objs) $(gtest_lib)
	$(CXX) -o $@ $+ $(LDFLAGS)

check: build/run_tests
	./build/run_tests

clean:
	$(RM) -r build

-include $(test_objs:.o=.d) $(gumbo_objs:.o=.d)<commit_msg>Make it easy to add sanitizer flags<commit_after>.PHONY: all clean check dirs

gumbo_objs := $(patsubst %.c,build/%.o,$(wildcard src/*.c))
test_objs := $(patsubst %.cc,build/%.o,$(wildcard test/*.cc))
gtest_lib := googletest/make/gtest_main.a

# make SANITIZEFLAGS='-fsanitize=undefined -fsanitize=address'
SANITIZEFLAGS :=
CPPFLAGS := -Isrc
CFLAGS := -std=c99 -Os
CXXFLAGS := -isystem googletest/include -std=c++11 -Os
LDFLAGS := -pthread

all: check

build/src:
	mkdir -p "$@"

build/test:
	mkdir -p "$@"

build/src/%.o: src/%.c | build/src
	$(CC) -MMD $(CPPFLAGS) $(CFLAGS) $(SANITIZEFLAGS) -c -o $@ $<

build/test/%.o: test/%.cc | build/test
	$(CXX) -MMD $(CPPFLAGS) $(CXXFLAGS) $(SANITIZEFLAGS) -c -o $@ $<

build/run_tests: $(gumbo_objs) $(test_objs) $(gtest_lib)
	$(CXX) -o $@ $+ $(LDFLAGS) $(SANITIZEFLAGS)

check: build/run_tests
	./build/run_tests

clean:
	$(RM) -r build

-include $(test_objs:.o=.d) $(gumbo_objs:.o=.d)
{'fraction_non_alphanumeric': 0.22202694786174576, 'fraction_numerical': 0.0046865846514352666, 'mean_word_length': 4.053254437869822, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3788154', 'n_tokens_mistral': 794, 'n_tokens_neox': 737, 'n_words': 152}