<commit_before>CC ?= clang

override CFLAGS := -Wall -std=c99 -g -D_GNU_SOURCE $(CFLAGS)
LDFLAGS +=

INCLUDES = -Iinclude
LIBS = -lm

LIBOWF_SRCS = $(shell find src -type f -name '*.c')
LIBOWF_OBJS = $(LIBOWF_SRCS:.c=.o)

LIBOWF_TEST_SRCS = $(shell find test -type f -name '*.c')
LIBOWF_TEST_OBJS = $(LIBOWF_TEST_SRCS:.c=.o)

UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
	DL_EXT := .dylib
	BIN_EXT := 
else ifeq ($(UNAME), Linux)
	DL_EXT := .so
	BIN_EXT := 
else ifneq (,$(findstring CYGWIN, $(UNAME)))
	DL_EXT := .dll
	BIN_EXT := .exe
else
	$(error Unknown development platform, we support Darwin, Linux, and Cygwin)
endif

# define the executable file
LIBOWF = build/lib/libowf$(DL_EXT)
LIBOWF_TEST = build/bin/libowf-test$(BIN_EXT)

#
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#

.PHONY: depend clean test

all: $(LIBOWF)
tests: $(LIBOWF) $(LIBOWF_TEST)

test: $(LIBOWF) $(LIBOWF_TEST)
	PATH=build/lib LD_LIBRARY_PATH=build/lib $(LIBOWF_TEST)

$(LIBOWF): CFLAGS += -fPIC
$(LIBOWF): $(LIBOWF_OBJS)
	$(CC) $(CFLAGS) -shared $(INCLUDES) -o $(LIBOWF) $(LIBOWF_OBJS) $(LDFLAGS) $(LIBS)

$(LIBOWF_TEST): LDFLAGS += -Lbuild/lib -lm -lowf
$(LIBOWF_TEST): $(LIBOWF) $(LIBOWF_TEST_OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) -o $(LIBOWF_TEST) $(LIBOWF_TEST_OBJS) $(LDFLAGS) $(LIBS)

# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
	rm -f $(LIBOWF) $(LIBOWF_TEST)
	find src test -name '*.o' -exec rm -f {} \;

depend: $(SRCS)
	makedepend $(INCLUDES) $^<commit_msg>Modify Makefile to behave correctly in Cygwin<commit_after># OWF: the Open Waveform Format
# @file Makefile
# @author <NAME> <<EMAIL>>

# Set the C compiler
CC ?= clang

# Set the CFLAGS and LDFLAGS
override CFLAGS := -Wall -std=c99 -g -D_GNU_SOURCE $(CFLAGS)
override LDFLAGS := $(LDFLAGS)

# Define includes and linker libs
INCLUDES = -Iinclude
LIBS = 

LIBOWF_SRCS = $(shell find src -type f -name '*.c')
LIBOWF_OBJS = $(LIBOWF_SRCS:.c=.o)

LIBOWF_TEST_SRCS = $(shell find test -type f -name '*.c')
LIBOWF_TEST_OBJS = $(LIBOWF_TEST_SRCS:.c=.o)

# Export variables for subprocesses
export PATH := ./build/lib:./build/bin:$(PATH)
export LD_LIBRARY_PATH := ./build/lib:$(LD_LIBRARY_PATH)

# Perform some basic platform detection
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
	DL_EXT := .dylib
	BIN_EXT := 
	CFLAGS += -fPIC
else ifeq ($(UNAME), Linux)
	DL_EXT := .so
	BIN_EXT := 
	CFLAGS += -fPIC
else ifneq (,$(findstring CYGWIN, $(UNAME)))
	DL_EXT := .dll
	BIN_EXT := .exe
else
	$(error Unknown development platform, we support Darwin, Linux, and Cygwin)
endif

# Define the executable file
LIBOWF = build/lib/libowf$(DL_EXT)
LIBOWF_TEST = build/bin/libowf-test$(BIN_EXT)

.PHONY: depend clean test

all: $(LIBOWF)
tests: $(LIBOWF) $(LIBOWF_TEST)

test: $(LIBOWF) $(LIBOWF_TEST)
	$(LIBOWF_TEST)

$(LIBOWF): 
$(LIBOWF): $(LIBOWF_OBJS)
	$(CC) $(CFLAGS) -shared $(INCLUDES) -o $(LIBOWF) $(LIBOWF_OBJS) $(LDFLAGS) $(LIBS)

$(LIBOWF_TEST): LDFLAGS += -Lbuild/lib -lm -lowf
$(LIBOWF_TEST): $(LIBOWF) $(LIBOWF_TEST_OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) -o $(LIBOWF_TEST) $(LIBOWF_TEST_OBJS) $(LDFLAGS) $(LIBS)

# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
	rm -f $(LIBOWF) $(LIBOWF_TEST)
	find src test -name '*.o' -exec rm -f {} \;
{'fraction_non_alphanumeric': 0.16118251928020566, 'fraction_numerical': 0.0010282776349614395, 'mean_word_length': 4.457223001402524, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 6, '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': '1811087', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1530, 'n_words': 462}