<commit_before>EXT_DIR=external

GTEST_REPO=https://github.com/google/googletest.git
GTEST_TAG=release-1.8.0
GTEST_DIR=$(EXT_DIR)/googletest
DEPENDS=$(GTEST_DIR)

GTEST_INC=$(GTEST_DIR)/googletest/include

EXT_INC=$(GTEST_INC)

SRC_INC=src

TEST_DIR=tests
TEST_SRCS=$(shell find $(TEST_DIR) -name *.cpp)
TEST_OBJS=$(subst .cpp,.o,$(TEST_SRCS))
TEST_OUT=$(TEST_DIR)/tests.exe

INC=$(SRC_INC) $(EXT_INC)

CPP=g++
CPPFLAGS=$(foreach d, $(INC), -I$d) #Source: https://stackoverflow.com/a/4134861

GIT=git

.PHONY: default depend test test-tidy test-clean clean dist-clean maintainer-clean

default: all

$(GTEST_DIR):
	$(GIT) clone $(GTEST_REPO) -b $(GTEST_TAG) $@

depend: $(DEPENDS)

%.o: %.cpp $(DEPENDS)
	$(CPP) $(CPPFLAGS) -c $< -o $@

$(TEST_OUT): $(TEST_OBJS)
	$(CPP) $< -o $@

test: $(TEST_OUT)
	$<

test-tidy:
	rm -f $(TEST_OBJS)

test-clean: test-tidy
	rm -f $(TEST_OUT)

clean: test-clean

dist-clean: clean
	rm -rf $(EXT_DIR)

maintainer-clean: dist-clean
	git clean -xdf<commit_msg>Rewrite makefile to allow for test compliation<commit_after>EXT_DIR=external

GTEST_REPO=https://github.com/google/googletest.git
# Ideally, this would be a release tag but mingw compilation requires unreleased features
GTEST_TAG=master
GTEST_BASE_DIR=$(EXT_DIR)/googletest
GTEST_DIR=$(GTEST_BASE_DIR)/googletest
GTEST_INC=$(GTEST_DIR)/include
GTEST_CPPFLAGS=-isystem $(GTEST_INC) -I$(GTEST_DIR)
GTEST_OBJS=$(GTEST_DIR)/src/gtest-all.o
GTEST_OUT=$(GTEST_DIR)/libgtest.a

DEPENDS=$(GTEST_OUT)

EXT_INC=$(GTEST_INC)
SRC_INC=src
INC=$(SRC_INC) $(EXT_INC)
CPPFLAGS=$(foreach d, $(INC), -I$d) # Source: https://stackoverflow.com/a/4134861

AR=ar
GIT=git
CPP=g++

TEST_DIR=tests
TEST_SRCS=$(shell find $(TEST_DIR) -name *.cpp)
TEST_OBJS=$(subst .cpp,.o,$(TEST_SRCS))
TEST_OUT=$(TEST_DIR)/tests.exe
TEST_LD_FLAGS=$(DEPENDS)

.PHONY: default depend test test-tidy test-clean clean dist-clean maintainer-clean

default: all

$(GTEST_BASE_DIR):
	$(GIT) clone $(GTEST_REPO) -b $(GTEST_TAG) $@

$(GTEST_OBJS): %.o: %.cc
	$(CPP) $(GTEST_CPPFLAGS) -c $< -o $@

$(GTEST_OUT): $(GTEST_OBJS)
	$(AR) -rv $@ $?

depend: $(DEPENDS)

%.o: %.cpp
	$(CPP) $(CPPFLAGS) -c $< -o $@

$(TEST_OUT): $(TEST_OBJS) $(DEPENDS)
	$(CPP) $< -o $@ -L $(GTEST_DIR) -lgtest

test: $(TEST_OUT)
	$<

test-tidy:
	rm -f $(TEST_OBJS)

test-clean: test-tidy
	rm -f $(TEST_OUT)

clean: test-clean

dist-clean: clean
	rm -rf $(EXT_DIR)

maintainer-clean: dist-clean
	git clean -xdf
{'fraction_non_alphanumeric': 0.18391752577319587, 'fraction_numerical': 0.0070103092783505155, 'mean_word_length': 5.401055408970977, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '27611', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1029, 'n_words': 200}