<commit_before># Extensions
SRC_EXT=c
OBJ_EXT=o
STATIC_LIB_EXT=a
SHARED_LIB_EXT=so

# Directories
SRC_DIR=src
INC_DIR:=$(SRC_DIR)/include
OBJ_DIR=obj
BIN_DIR=bin
DOC_DIR=doc

# Configuration
PROJECT_NAME=libbad
PROJECT_TYPE=staticlib
STATIC_TARGET=$(PROJECT_NAME).$(STATIC_LIB_EXT)
SHARED_TARGET=$(PROJECT_NAME).$(SHARED_LIB_EXT)

# Compiler configuration
CC=gcc
WARNS=-Wall -Wextra -pedantic
INCS:=-I$(INC_DIR)
CFLAGS:=$(WARNS) -std=c99 -fPIC $(INCS) -c
LDFLAGS:=$(WARNS)

# Files
DIR_GUARD=@mkdir -p $(@D)
SOURCES=$(wildcard $(SRC_DIR)/*.$(SRC_EXT))
OBJECTS=$(patsubst $(SRC_DIR)/%.$(SRC_EXT),$(OBJ_DIR)/%.$(OBJ_EXT),$(SOURCES))

# Targets
.PHONY: all doc clean clean_build clean_doc static shared

all: static

doc: $(SOURCES)
	doxygen

clean: clean_build clean_doc

clean_build:
	$(RM) -rf $(OBJ_DIR)
	$(RM) -rf $(BIN_DIR)

clean_doc:
	$(RM) -rf $(DOC_DIR)/* ^$(DOC_DIR)/.gitignore

static: $(BIN_DIR)/$(STATIC_TARGET)

shared: $(BIN_DIR)/$(SHARED_TARGET)

$(BIN_DIR)/$(STATIC_TARGET): $(OBJECTS)
	$(DIR_GUARD)
	ar rcs $@ $^

$(BIN_DIR)/$(SHARED_TARGET): $(OBJECTS)
	$(DIR_GUARD)
	$(CC) -shared $(LDFLAGS) $^ -o $@

$(OBJECTS): $(SOURCES)
	$(DIR_GUARD)
	$(CC) $(CFLAGS) $< -o $@<commit_msg>Update Makefile with testing rule<commit_after># Extensions
SRC_EXT=c
OBJ_EXT=o
STATIC_LIB_EXT=a
SHARED_LIB_EXT=so

# Directories
SRC_DIR=src
INC_DIR:=$(SRC_DIR)/include
OBJ_DIR=obj
BIN_DIR=bin
DOC_DIR=doc

# Configuration
PROJECT_NAME=libbad
PROJECT_TYPE=staticlib
STATIC_TARGET=$(PROJECT_NAME).$(STATIC_LIB_EXT)
SHARED_TARGET=$(PROJECT_NAME).$(SHARED_LIB_EXT)

# Compiler configuration
CC=gcc
WARNS=-Wall -Wextra -pedantic
INCS:=-I$(INC_DIR)
CFLAGS:=$(WARNS) -std=c99 -fPIC $(INCS) -c
LDFLAGS:=$(WARNS)

# Files
DIR_GUARD=@mkdir -p $(@D)
SOURCES=$(wildcard $(SRC_DIR)/*.$(SRC_EXT))
OBJECTS=$(patsubst $(SRC_DIR)/%.$(SRC_EXT),$(OBJ_DIR)/%.$(OBJ_EXT),$(SOURCES))

# Targets
.PHONY: all doc clean clean_build clean_doc static shared test

all: static

doc: $(SOURCES)
	doxygen

clean: clean_build clean_doc

clean_build:
	$(RM) -rf $(OBJ_DIR)
	$(RM) -rf $(BIN_DIR)

clean_doc:
	$(RM) -rf $(DOC_DIR)/* ^$(DOC_DIR)/.gitignore

static: $(BIN_DIR)/$(STATIC_TARGET)

shared: $(BIN_DIR)/$(SHARED_TARGET)

$(BIN_DIR)/$(STATIC_TARGET): $(OBJECTS)
	$(DIR_GUARD)
	ar rcs $@ $^

$(BIN_DIR)/$(SHARED_TARGET): $(OBJECTS)
	$(DIR_GUARD)
	$(CC) -shared $(LDFLAGS) $^ -o $@

$(OBJECTS): $(SOURCES)
	$(DIR_GUARD)
	$(CC) $(CFLAGS) $< -o $@

test:
	$(eval DIR:=$(firstword $(wildcard tmp_test)))
ifeq ($(DIR),"")
	@echo "Unsupported currently"
	@echo $(DIR)
else
	$(CC) -I$(INC_DIR) -o $(DIR)/test.o -c $(DIR)/test.c
	$(CC) -L$(BIN_DIR) -lbad -o $(DIR)/test $(DIR)/test.o
	@$(DIR)/test
endif
{'fraction_non_alphanumeric': 0.20307807807807807, 'fraction_numerical': 0.0015015015015015015, 'mean_word_length': 6.321428571428571, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2379121', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1148, 'n_words': 210}