<commit_before># Targets:
#   make all - Build the project and run tests.
#   make test - Build tests (requires NullUnit).
#   make clean - Removes temporary files.

# ==================== #
# Module configuration #
# ==================== #

LIB_MODULES = compiler runtime
TEST_MODULES = compilertest runtimetest
BIN_MODULES = degc degrun

compiler_DEPENDENCIES = runtime
compiler_LIBRARIES = boost_filesystem boost_system
compiler_SOURCE_FILES += $(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/parser.cpp
compiler_HEADER_FILES += $(SRC_PATH)/compiler/grammar/parser.hpp

compilertest_DEPENDENCIES = compiler
runtimetest_DEPENDENCIES = runtime

degc_DEPENDENCIES = compiler
degrun_DEPENDENCIES = runtime

# =================== #
# Build configuration #
# ------------------- #
# Do not modify.      #
# =================== #

BASE_PATH = .
SRC_PATH = $(BASE_PATH)/src
OBJ_PATH = $(BASE_PATH)/obj
BIN_PATH = $(BASE_PATH)/bin

CPPFLAGS = -I$(SRC_PATH)
CXXFLAGS = -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -ggdb

MODULES = $(LIB_MODULES) $(TEST_MODULES) $(BIN_MODULES)

define MODULE_template
$(1)_SOURCE_FILES += $$(shell find $$(SRC_PATH)/$(1) -name *.cpp)
$(1)_HEADER_FILES += $$(shell find $$(SRC_PATH)/$(1) -name *.h)
$(1)_OBJECT_FILES += $$(subst $$(SRC_PATH),$$(OBJ_PATH),$$($(1)_SOURCE_FILES:.cpp=.o))
SOURCE_FILES += $$($(1)_SOURCE_FILES)
HEADER_FILES += $$($(1)_HEADER_FILES)
OBJECT_FILES += $$($(1)_OBJECT_FILES)
$(1)_ACTUAL_LIBRARIES += $$($(1)_LIBRARIES) $$(foreach depend,$$($(1)_DEPENDENCIES),$$($$(depend)_LIBRARIES))
endef

define TEST_MODULE_template
$(1)_ACTUAL_LIBRARIES += nullunit
endef

define BIN_MODULE_template
$$(BIN_PATH)/$(1): $$($(1)_OBJECT_FILES) $$(foreach depend,$$($(1)_DEPENDENCIES),$$($$(depend)_OBJECT_FILES))
	mkdir -p $$(dir $$@)
	$$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) $$^ -o $$@ $$(foreach lib,$$($(1)_ACTUAL_LIBRARIES),-l$$(lib))
endef

.DEFAULT: all
.PHONY: all
all: test bin
	@ $(foreach test,$(TEST_MODULES),$(BIN_PATH)/$(test) &&) :
	
.PHONY: test
test: $(foreach test,$(TEST_MODULES),$(BIN_PATH)/$(test))

.PHONY: bin
bin: $(foreach bin,$(BIN_MODULES),$(BIN_PATH)/$(bin))

.PHONY: clean
clean:
	-@rm -rf $(BIN_PATH) $(OBJ_PATH) 2> /dev/null || true
	-@rm $(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/parser.cpp 2> /dev/null || true
	-@rm $(SRC_PATH)/compiler/grammar/parser.hpp $(SRC_PATH)/compiler/grammar/parser.output 2> /dev/null || true
	
$(foreach module,$(MODULES),$(eval $(call MODULE_template,$(module))))
$(foreach module,$(BIN_MODULES),$(eval $(call BIN_MODULE_template,$(module))))
$(foreach module,$(TEST_MODULES),$(eval $(call TEST_MODULE_template,$(module))))
$(foreach module,$(TEST_MODULES),$(eval $(call BIN_MODULE_template,$(module))))

$(compiler_SOURCE_FILES) $(compiler_HEADER_FILES): $(SRC_PATH)/compiler/grammar/parser.hpp

$(SRC_PATH)/compiler/grammar/lexer.cpp: $(SRC_PATH)/compiler/grammar/lexer.lex
	flex --outfile=$(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/lexer.lex
	<commit_msg>Resolved cyclical dependency in Makefile.<commit_after># Targets:
#   make all - Build the project and run tests.
#   make test - Build tests (requires NullUnit).
#   make clean - Removes temporary files.

# ==================== #
# Module configuration #
# ==================== #

LIB_MODULES = compiler runtime
TEST_MODULES = compilertest runtimetest
BIN_MODULES = degc degrun

compiler_DEPENDENCIES = runtime
compiler_LIBRARIES = boost_filesystem boost_system
compiler_SOURCE_FILES += $(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/parser.cpp
compiler_HEADER_FILES += $(SRC_PATH)/compiler/grammar/parser.hpp

compilertest_DEPENDENCIES = compiler
runtimetest_DEPENDENCIES = runtime

degc_DEPENDENCIES = compiler
degrun_DEPENDENCIES = runtime

# =================== #
# Build configuration #
# ------------------- #
# Do not modify.      #
# =================== #

BASE_PATH = .
SRC_PATH = $(BASE_PATH)/src
OBJ_PATH = $(BASE_PATH)/obj
BIN_PATH = $(BASE_PATH)/bin

CPPFLAGS = -I$(SRC_PATH)
CXXFLAGS = -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -ggdb

MODULES = $(LIB_MODULES) $(TEST_MODULES) $(BIN_MODULES)

define MODULE_template
$(1)_SOURCE_FILES += $$(shell find $$(SRC_PATH)/$(1) -name *.cpp)
$(1)_HEADER_FILES += $$(shell find $$(SRC_PATH)/$(1) -name *.h)
$(1)_OBJECT_FILES += $$(subst $$(SRC_PATH),$$(OBJ_PATH),$$($(1)_SOURCE_FILES:.cpp=.o))
SOURCE_FILES += $$($(1)_SOURCE_FILES)
HEADER_FILES += $$($(1)_HEADER_FILES)
OBJECT_FILES += $$($(1)_OBJECT_FILES)
$(1)_ACTUAL_LIBRARIES += $$($(1)_LIBRARIES) $$(foreach depend,$$($(1)_DEPENDENCIES),$$($$(depend)_LIBRARIES))
endef

define TEST_MODULE_template
$(1)_ACTUAL_LIBRARIES += nullunit
endef

define BIN_MODULE_template
$$(BIN_PATH)/$(1): $$($(1)_OBJECT_FILES) $$(foreach depend,$$($(1)_DEPENDENCIES),$$($$(depend)_OBJECT_FILES))
	mkdir -p $$(dir $$@)
	$$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) $$^ -o $$@ $$(foreach lib,$$($(1)_ACTUAL_LIBRARIES),-l$$(lib))
endef

.DEFAULT: all
.PHONY: all
all: test bin
	@ $(foreach test,$(TEST_MODULES),$(BIN_PATH)/$(test) &&) :
	
.PHONY: test
test: $(foreach test,$(TEST_MODULES),$(BIN_PATH)/$(test))

.PHONY: bin
bin: $(foreach bin,$(BIN_MODULES),$(BIN_PATH)/$(bin))

.PHONY: clean
clean:
	-@rm -rf $(BIN_PATH) $(OBJ_PATH) 2> /dev/null || true
	-@rm $(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/parser.cpp 2> /dev/null || true
	-@rm $(SRC_PATH)/compiler/grammar/parser.hpp $(SRC_PATH)/compiler/grammar/parser.output 2> /dev/null || true
	
$(foreach module,$(MODULES),$(eval $(call MODULE_template,$(module))))
$(foreach module,$(BIN_MODULES),$(eval $(call BIN_MODULE_template,$(module))))
$(foreach module,$(TEST_MODULES),$(eval $(call TEST_MODULE_template,$(module))))
$(foreach module,$(TEST_MODULES),$(eval $(call BIN_MODULE_template,$(module))))

$(SRC_PATH)/compiler/grammar/lexer.cpp: $(SRC_PATH)/compiler/grammar/lexer.lex $(SRC_PATH)/compiler/grammar/parser.hpp
	flex --outfile=$(SRC_PATH)/compiler/grammar/lexer.cpp $(SRC_PATH)/compiler/grammar/lexer.lex
	
{'fraction_non_alphanumeric': 0.21756225425950196, 'fraction_numerical': 0.007208387942332897, 'mean_word_length': 6.293906810035843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4271277', 'n_tokens_mistral': 2274, 'n_tokens_neox': 2192, 'n_words': 382}