<commit_before># usage:
#	checks_SOURCES = ...
#	checks_CFLAGS = ...
#	checks_LDADD = ...
#
#	include ../checkdir.mk

# convenience definitions

OPENSSL_CFLAGS		= -I../../deps/sources/openssl/include
OPENSSL_LIBS		= ../../deps/sources/openssl/libssl.a ../../deps/sources/openssl/libcrypto.a -pthread -lrt -lresolv
DONNA_CFLAGS		= -I../../deps/sources/donna
DONNA_LIBS		= ../../deps/sources/donna/ed25519.o
LIBCOMMON_CFLAGS	=
LIBCOMMON_LIBS		= ../../libs/common/libcommon.a
LIBCORE_CFLAGS		=
LIBCORE_LIBS		= ../../libs/core/libcore.a
LIBSIGNET_CFLAGS	=
LIBSIGNET_LIBS		= ../../libs/signet/libsignet.a
LIBSIGNETRESOLVER_CFLAGS =
LIBSIGNETRESOLVER_LIBS	= ../../libs/signet-resolver/libsignet-resolver.a
LIBDMESSAGE_CFLAGS	=
LIBDMESSAGE_LIBS	= ../../libs/dmessage/libdmessage.a

# implementation

topdir = $(dir $(lastword $(MAKEFILE_LIST)))
include $(topdir)/common.mk

CHECK_CFLAGS	:= $(shell pkg-config --cflags check)
CHECK_LIBS	:= $(shell pkg-config --libs check)

check_PROGRAMS	= checks
CC		=  gcc
LIBS 		= $(checks_LDADD) $(CHECK_LIBS) -lz -lresolv
CFLAGS		= $(checks_CFLAGS) $(CHECK_CFLAGS) $(CWARNS) $(CDEBUG) -I../../include -std=gnu99
SRCFILES	= $(checks_SOURCES)
OBJDIRNAME	= .objs
DEPDIRNAME	= .deps
df = $(DEPDIRNAME)/$(*F)
DEPFILES	= $(patsubst %.c,$(DEPDIRNAME)/%.d,$(SRCFILES))
OBJFILES	= $(patsubst %.c,$(OBJDIRNAME)/%.o,$(SRCFILES))

.PHONY: all clean run-checks
all: $(check_PROGRAMS) run-checks

clean:
	@rm -rf $(OBJDIRNAME) $(DEPDIRNAME)
	@rm -f $(check_PROGRAMS)

$(check_PROGRAMS): $(OBJFILES)
	$(RUN)$(CC) -o $@ $(OBJFILES) $(LIBS)

$(OBJDIRNAME) $(DEPDIRNAME):
	@test -d $@ || mkdir $@

$(OBJDIRNAME)/%.o : %.c | $(OBJDIRNAME) $(DEPDIRNAME)
	@echo Compiling $(YELLOW)$<$(NORMAL)<commit_msg>Executables depend on the static libraries<commit_after># usage:
#	checks_SOURCES = ...
#	checks_CFLAGS = ...
#	checks_LDADD = ...
#
#	include ../checkdir.mk

# convenience definitions

OPENSSL_CFLAGS		= -I../../deps/sources/openssl/include
OPENSSL_LIBS		= ../../deps/sources/openssl/libssl.a ../../deps/sources/openssl/libcrypto.a -pthread -lrt -lresolv
DONNA_CFLAGS		= -I../../deps/sources/donna
DONNA_LIBS		= ../../deps/sources/donna/ed25519.o
LIBCOMMON_CFLAGS	=
LIBCOMMON_LIBS		= ../../libs/common/libcommon.a
LIBCORE_CFLAGS		=
LIBCORE_LIBS		= ../../libs/core/libcore.a
LIBSIGNET_CFLAGS	=
LIBSIGNET_LIBS		= ../../libs/signet/libsignet.a
LIBSIGNETRESOLVER_CFLAGS =
LIBSIGNETRESOLVER_LIBS	= ../../libs/signet-resolver/libsignet-resolver.a
LIBDMESSAGE_CFLAGS	=
LIBDMESSAGE_LIBS	= ../../libs/dmessage/libdmessage.a

# implementation

topdir = $(dir $(lastword $(MAKEFILE_LIST)))
include $(topdir)/common.mk

CHECK_CFLAGS	:= $(shell pkg-config --cflags check)
CHECK_LIBS	:= $(shell pkg-config --libs check)

check_PROGRAMS	= checks
CC		=  gcc
LIBS 		= $(checks_LDADD) $(CHECK_LIBS) -lz -lresolv
CFLAGS		= $(checks_CFLAGS) $(CHECK_CFLAGS) $(CWARNS) $(CDEBUG) -I../../include -std=gnu99
SRCFILES	= $(checks_SOURCES)
OBJDIRNAME	= .objs
DEPDIRNAME	= .deps
df = $(DEPDIRNAME)/$(*F)
DEPFILES	= $(patsubst %.c,$(DEPDIRNAME)/%.d,$(SRCFILES))
OBJFILES	= $(patsubst %.c,$(OBJDIRNAME)/%.o,$(SRCFILES))

.PHONY: all clean run-checks
all: $(check_PROGRAMS) run-checks

clean:
	@rm -rf $(OBJDIRNAME) $(DEPDIRNAME)
	@rm -f $(check_PROGRAMS)

$(check_PROGRAMS): $(OBJFILES) $(filter %.a,$(LIBS))
	@echo "Linking $(GREEN)$@$(NORMAL)"
	$(RUN)$(CC) -o $@ $(OBJFILES) $(LIBS)

$(OBJDIRNAME) $(DEPDIRNAME):
	@test -d $@ || mkdir $@

$(OBJDIRNAME)/%.o : %.c | $(OBJDIRNAME) $(DEPDIRNAME)
	@echo Compiling $(YELLOW)$<$(NORMAL)
{'fraction_non_alphanumeric': 0.19908987485779295, 'fraction_numerical': 0.003981797497155859, 'mean_word_length': 4.08972503617945, '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': '6210473', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1477, 'n_words': 241}