<commit_before>CC ?= gcc
DESTDIR ?= /usr/local
LD ?= gcc
C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-unused-variable -Wno-pointer-sign -I./include -I./uthash -I./src
MAJOR_VERSION = 0
MINOR_VERSION = 1
VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION)"
SONAME = libucl.so.$(MAJOR_VERSION)
OBJDIR ?= ./.obj
SRCDIR ?= ./src
MKDIR ?= mkdir
INSTALL ?= install
RM ?= rm
RMDIR ?= rmdir
LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) -shared

all: $(OBJDIR)/$(SONAME)

$(OBJDIR)/$(SONAME): $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)
	$(CC) -o $(OBJDIR)/$(SONAME) $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(LD_SHARED_FLAGS) $(LDFLAGS) $(SSL_LIBS) $(FETCH_LIBS)

$(OBJDIR):
	$(MKDIR) $(OBJDIR)

$(OBJDIR)/ucl_util.o: $(SRCDIR)/ucl_util.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_util.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_util.c
$(OBJDIR)/ucl_parser.o: $(SRCDIR)/ucl_parser.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_parser.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_parser.c
$(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_emitter.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c

clean:
	$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen
	$(RMDIR) $(OBJDIR)
	
chargen: $(OBJDIR) utils/chargen.c
	$(CC) -o $(OBJDIR)/chargen $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/chargen.c

install: $(OBJDIR)/$(SONAME)
	$(INSTALL) -m0755 $(SONAME) $(DESTDIR)/lib/$(SONAME)
	$(INSTALL) -m0644 include/ucl.h $(DESTDIR)/include/ucl.h<commit_msg>Fix makefile to enable tests.<commit_after>CC ?= gcc
DESTDIR ?= /usr/local
LD ?= gcc
C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-unused-variable -Wno-pointer-sign -I./include -I./uthash -I./src
MAJOR_VERSION = 0
MINOR_VERSION = 1
VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION)"
SONAME = libucl.so
SONAME_FULL = $(SONAME).$(MAJOR_VERSION)
OBJDIR ?= .obj
TESTDIR ?= tests
SRCDIR ?= src
MKDIR ?= mkdir
INSTALL ?= install
RM ?= rm
RMDIR ?= rmdir
LN ?= ln
LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) -shared

all: $(OBJDIR)/$(SONAME)

$(OBJDIR)/$(SONAME): $(OBJDIR)/$(SONAME_FULL)
	$(LN) -sf $(SONAME_FULL) $(OBJDIR)/$(SONAME)

$(OBJDIR)/$(SONAME_FULL): $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)
	$(CC) -o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(LD_SHARED_FLAGS) $(LDFLAGS) $(SSL_LIBS) $(FETCH_LIBS)

$(OBJDIR):
	$(MKDIR) $(OBJDIR)

# Compile rules
$(OBJDIR)/ucl_util.o: $(SRCDIR)/ucl_util.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_util.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_util.c
$(OBJDIR)/ucl_parser.o: $(SRCDIR)/ucl_parser.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_parser.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_parser.c
$(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_emitter.c $(OBJDIR)
	$(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c

clean:
	$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic
	$(RMDIR) $(OBJDIR)
	
# Utils

chargen: $(OBJDIR) utils/chargen.c
	$(CC) -o $(OBJDIR)/chargen $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) utils/chargen.c

# Tests

test: $(OBJDIR)/test_basic
	TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic
	
$(OBJDIR)/test_basic: $(TESTDIR)/test_basic.c $(OBJDIR)/$(SONAME)
	$(CC) -o $(OBJDIR)/test_basic $(CPPFLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_basic.c -L$(OBJDIR) -Wl,-rpath,$(OBJDIR) -lucl

install: $(OBJDIR)/$(SONAME)
	$(INSTALL) -m0755 $(SONAME) $(DESTDIR)/lib/$(SONAME)
	$(INSTALL) -m0644 include/ucl.h $(DESTDIR)/include/ucl.h
{'fraction_non_alphanumeric': 0.22650964670508644, 'fraction_numerical': 0.005011275369581559, 'mean_word_length': 5.6755852842809364, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5224655', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1719, 'n_words': 298}