<commit_before># include user specific configurations
OS = $(shell uname -s 2>/dev/null | tr [:upper:] [:lower:])
-include Makefile.$(OS)
-include Makefile.conf

ifeq ($(LIB_EXT),)
  $(error Makfile not properly configured)
endif

# libs
MAIN_LIB_DIR  = lib
MAIN_LIB_NAME = libpandora
MAIN_LIB = $(MAIN_LIB_DIR)/$(MAIN_LIB_NAME)

LIB = $(LIB_PATS) $(LIB_NAMES)

# complete set of flags for target release
CXXFLAGS_RELEASE = $(FLAGS_GLOBAL) -O1
# complete set of flags for target debug 
CXXFLAGS_DEBUG   = $(FLAGS_GLOBAL) $(FLAGS_DEBUG) -O0

# define source and object files for the project
SRCS = $(wildcard src/*.cpp)
OBJS_RELEASE = $(patsubst src%.cpp, obj/release%.o, $(SRCS))
OBJS_DEBUG   = $(patsubst src%.cpp, obj/debug%.o, $(SRCS))

# define source and executable files for tests
SRCS_TEST = $(wildcard test/src/*.cpp)
EXEC_TEST = $(patsubst test/src%.cpp, test/bin%, $(SRCS_TEST))

#
# make all
#
all: clean release

#
# make library and main executable for release
#
release: $(MAIN_LIB).$(LIB_EXT)
	$(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) $(MAIN).cpp $(MAIN_LIB).$(LIB_EXT) $(LIB) -o $(MAIN)

$(MAIN_LIB).$(LIB_EXT): $(OBJS_RELEASE)
	mkdir -p $(MAIN_LIB_DIR)
	$(CXX) $(CXXFLAGS_RELEASE) $(LIB) -shared $^ -o $(MAIN_LIB).$(LIB_EXT)

obj/release/%.o: src/%.cpp
	mkdir -p obj/release
	$(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $^ -o $@

#
# make library and main executable with debug symbols
#
debug: $(MAIN_LIB).dbg.$(LIB_EXT)
	$(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) $(MAIN).cpp $(MAIN_LIB).dbg.$(LIB_EXT) $(LIB) -o $(MAIN)

$(MAIN_LIB).dbg.$(LIB_EXT): $(OBJS_DEBUG)
	mkdir -p $(MAIN_LIB_DIR)
	$(CXX) $(CXXFLAGS_DEBUG) $(LIB) -shared $^ -o $(MAIN_LIB).dbg.$(LIB_EXT)

obj/debug/%.o: src/%.cpp
	mkdir -pv obj/debug
	$(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $^ -o $@

#
# build tests
# all tests are currently build with the debug target
#
test: debug $(EXEC_TEST)

test/bin%: test/src%.cpp
	mkdir -p test/bin
	$(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) $^ $(MAIN_LIB).dbg.$(LIB_EXT) $(LIB) -o $@

#
# run tests
# 
#    make checkTestName -> starts the test with the executable test/bin/TestName
#    make check         -> runs all tests in test/bin
#
check%: test/bin/%
	$^

check: test
	for testprog in $(EXEC_TEST); do ./$$testprog; done

# create documentation
.PHONY: doc
doc:
	mkdir -p doc
	doxygen ./Doxyfile

.PHONY: clean
clean:
	rm -vrf $(MAIN) obj/* doc/* test/bin/* $(MAIN_LIB).dbg.$(LIB_EXT) $(MAIN_LIB).$(LIB_EXT)<commit_msg>Makefile: Hide compiler/linker command unless verbose=1<commit_after># include user specific configurations
OS = $(shell uname -s 2>/dev/null | tr [:upper:] [:lower:])
-include Makefile.$(OS)
-include Makefile.conf

ifeq ($(LIB_EXT),)
  $(error Makfile not properly configured)
endif

#commandline options for makefile
verbose ?= 0

# libs
MAIN_LIB_DIR  = lib
MAIN_LIB_NAME = libpandora
MAIN_LIB = $(MAIN_LIB_DIR)/$(MAIN_LIB_NAME)

LIB = $(LIB_PATS) $(LIB_NAMES)

# complete set of flags for target release
CXXFLAGS_RELEASE = $(FLAGS_GLOBAL) -O1
# complete set of flags for target debug 
CXXFLAGS_DEBUG   = $(FLAGS_GLOBAL) $(FLAGS_DEBUG) -O0

# define source and object files for the project
SRCS = $(wildcard src/*.cpp)
OBJS_RELEASE = $(patsubst src%.cpp, obj/release%.o, $(SRCS))
OBJS_DEBUG   = $(patsubst src%.cpp, obj/debug%.o, $(SRCS))

# define source and executable files for tests
SRCS_TEST = $(wildcard test/src/*.cpp)
EXEC_TEST = $(patsubst test/src%.cpp, test/bin%, $(SRCS_TEST))

### misc
ifeq ($(verbose), 1)
  ECHO :=
else
  ECHO := @
endif

ifeq ($(OS), darwin)
  ECHO_FLAGS :=
else
  ECHO_FLAGS := -e
endif

#
# make all
#
all: clean release

#
# make library and main executable for release
#
release: $(MAIN_LIB).$(LIB_EXT)
	@echo $(ECHO_FLAGS) " [CXX+LNK]\t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) $(MAIN).cpp $(MAIN_LIB).$(LIB_EXT) $(LIB) -o $(MAIN)

$(MAIN_LIB).$(LIB_EXT): $(OBJS_RELEASE)
	$(ECHO) mkdir -p $(MAIN_LIB_DIR)
	@echo $(ECHO_FLAGS) " [LNK]  \t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_RELEASE) $(LIB) -shared $^ -o $(MAIN_LIB).$(LIB_EXT)

obj/release/%.o: src/%.cpp
	$(ECHO)mkdir -p obj/release
	@echo $(ECHO_FLAGS) " [CXX]  \t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $^ -o $@

#
# make library and main executable with debug symbols
#
debug: $(MAIN_LIB).dbg.$(LIB_EXT)
	@echo $(ECHO_FLAGS) " [CXX+LNK] {D} \t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) $(MAIN).cpp $(MAIN_LIB).dbg.$(LIB_EXT) $(LIB) -o $(MAIN)

$(MAIN_LIB).dbg.$(LIB_EXT): $(OBJS_DEBUG)
	$(ECHO)mkdir -p $(MAIN_LIB_DIR)
	@echo $(ECHO_FLAGS) " [LNK] {D} \t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_DEBUG) $(LIB) -shared $^ -o $(MAIN_LIB).dbg.$(LIB_EXT)

obj/debug/%.o: src/%.cpp
	$(ECHO)mkdir -pv obj/debug
	@echo $(ECHO_FLAGS) " [CXX] {D} \t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $^ -o $@

#
# build tests
# all tests are currently build with the debug target
#
test: debug $(EXEC_TEST)

test/bin%: test/src%.cpp
	$(ECHO mkdir -p test/bin
	@echo $(ECHO_FLAGS) " [LNK]\t$@"
	$(ECHO) $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) $^ $(MAIN_LIB).dbg.$(LIB_EXT) $(LIB) -o $@

#
# run tests
# 
#    make checkTestName -> starts the test with the executable test/bin/TestName
#    make check         -> runs all tests in test/bin
#
check%: test/bin/%
	$^

check: test
	@echo $(ECHO_FLAGS) " [TESTING] "
	$(ECHO) for testprog in $(EXEC_TEST); do ./$$testprog; done



# create documentation
ifeq ($(verbose), 1)
  OUT_REDIR :=
else
  OUT_REDIR := > /dev/null
endif

.PHONY: doc
doc:
	$(ECHO) mkdir -p doc
	@echo $(ECHO_FLAGS) "[DOC]"
	$(ECHO)doxygen ./Doxyfile $(OUT_REDIR)

.PHONY: clean
clean:
	rm -vrf $(MAIN) obj/* doc/* test/bin/* $(MAIN_LIB).dbg.$(LIB_EXT) $(MAIN_LIB).$(LIB_EXT)
{'fraction_non_alphanumeric': 0.19047619047619047, 'fraction_numerical': 0.0017768301350390902, 'mean_word_length': 4.402111324376199, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '428391', 'n_tokens_mistral': 2353, 'n_tokens_neox': 2191, 'n_words': 579}