<commit_before># Get absolute path to containing directory: http://stackoverflow.com/a/324782
TOP := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
LOCAL_INCLUDE_DIR := $(realpath $(TOP)include)

# Special compiler flags
CFLAGS := -std=c11 -Wall -pedantic $(CFLAGS)
CPPFLAGS := -I$(LOCAL_INCLUDE_DIR) $(CPPFLAGS)
# Create .d for each .o file.
CPP_ADD_DEFINES = -MMD

# The shell command to rerun.
WATCH_COMMAND = make test
# I like to use this in iTerm 2:
#
# 	make watch WATCH_COMMAND='printf "\e]50;ClearScrollback\a"; make test'
#
# It clears scrollback when ever make test is rerun; makes isolating compile
# errors and the latest test failures quite easy.

NAME = brainmuk
VERSION = 0.1.0

BIN = $(NAME)
TESTBIN = tests/$(NAME)_tests
SRCS = $(wildcard src/*.c)
OBJS = $(patsubst %.c,%.o,$(SRCS))
DEPS := $(patsubst %.c,%.d,$(SRCS))

DISTNAME = $(NAME)-$(VERSION)

### Symbolic targets ###

all: $(BIN)

clean:
	-$(RM) $(BIN) $(TESTBIN)
	-$(RM) $(OBJS)
	-$(RM) $(DEPS)
	-$(RM) $(DISTNAME).tar.gz

dist: $(DISTNAME).tar.gz

test: $(TESTBIN)
	./$<

# Requires rerun <https://github.com/alexch/rerun> to be installed.
watch:
	@if hash rerun ; \
		then exit 0; \
		else echo "Requires rerun:\n\t$$ gem install rerun"; exit -1; fi
	-rerun --exit --clear --pattern '**/*.{c,h}' -- '$(WATCH_COMMAND)'

### Actual targets! ###

# Include dependencies from -d
-include $(DEPS)

# Generates the binaries from the objects
$(BIN): $(BIN).c $(OBJS)
$(TESTBIN): $(TESTBIN).c $(OBJS)
<commit_msg>Add TEST_OPTIONS to customize launch in Makefile.<commit_after># Get absolute path to containing directory: http://stackoverflow.com/a/324782
TOP := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
LOCAL_INCLUDE_DIR := $(realpath $(TOP)include)

# Special compiler flags
CFLAGS := -std=c11 -Wall -pedantic $(CFLAGS)
CPPFLAGS := -I$(LOCAL_INCLUDE_DIR) $(CPPFLAGS)
# Create .d for each .o file.
CPP_ADD_DEFINES = -MMD

# The shell command to rerun.
WATCH_COMMAND = make test
# I like to use this in iTerm 2:
#
# 	make watch WATCH_COMMAND='printf "\e]50;ClearScrollback\a"; make test'
#
# It clears scrollback when ever make test is rerun; makes isolating compile
# errors and the latest test failures quite easy.

# Options directed to the test launcher.
# Useful is -v -s [suite]
TEST_OPTIONS =

NAME = brainmuk
VERSION = 0.1.0

BIN = $(NAME)
TESTBIN = tests/$(NAME)_tests
SRCS = $(wildcard src/*.c)
OBJS = $(patsubst %.c,%.o,$(SRCS))
DEPS := $(patsubst %.c,%.d,$(SRCS))

DISTNAME = $(NAME)-$(VERSION)

### Symbolic targets ###

all: $(BIN)

clean:
	-$(RM) $(BIN) $(TESTBIN)
	-$(RM) $(OBJS)
	-$(RM) $(DEPS)
	-$(RM) $(DISTNAME).tar.gz

dist: $(DISTNAME).tar.gz

test: $(TESTBIN)
	./$< $(TEST_OPTIONS)

# Requires rerun <https://github.com/alexch/rerun> to be installed.
watch:
	@if hash rerun ; \
		then exit 0; \
		else echo "Requires rerun:\n\t$$ gem install rerun"; exit -1; fi
	-rerun --exit --clear --pattern '**/*.{c,h}' -- '$(WATCH_COMMAND)'

### Actual targets! ###

# Include dependencies from -d
-include $(DEPS)

# Generates the binaries from the objects
$(BIN): $(BIN).c $(OBJS)
$(TESTBIN): $(TESTBIN).c $(OBJS)

{'fraction_non_alphanumeric': 0.18620908802033684, 'fraction_numerical': 0.010168414362885288, 'mean_word_length': 4.211920529801325, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '27306', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1171, 'n_words': 345}