<commit_before>MODEL ?= 64
BUILD ?= debug

ifneq ($(MODEL), 32)
	ifneq ($(MODEL), 64)
		$(error Unsupported architecture: $(MODEL))
	endif
endif

ifneq ($(BUILD), debug)
	ifneq ($(BUILD), release)
		ifneq ($(BUILD), test)
			$(error Unknown build mode: $(BUILD))
		endif
	endif
endif

DFLAGS = -v -w -wi -ignore -X -m$(MODEL)

ifeq ($(BUILD), release)
	DFLAGS += -release -O -inline -noboundscheck
else
	DFLAGS += -debug -gc

	ifeq ($(BUILD), test)
		DFLAGS += -unittest -cov
	endif
endif

all: lib/libluad.a

clean:
	-rm -f lib/libluad.o
	-rm -f lib/libluad.a
	-rm -f lib/libluad.deps
	-rm -f lib/libluad.json
	-rm -f lib/luad.*.lst

LUAD_DFLAGS = $(DFLAGS)
LUAD_DFLAGS += -Xf"lib/libluad.json" -deps="lib/libluad.deps" -L-llua

ifneq ($(BUILD), test)
	LUAD_DFLAGS += -lib
else
	LUAD_DFLAGS += -version=luad_unittest_main
endif

lib/libluad.a: $(LUAD_SOURCES)
	if [ ! -d lib ]; then \
		mkdir lib; \
	fi
	dmd $(LUAD_DFLAGS) -of$@ $(LUAD_SOURCES);
	if [ ${BUILD} = "test" ]; then \
		gdb --command=luad.gdb lib/libluad.a; \
	fi

LUAD_SOURCES = \<commit_msg>Various Makefile tweaks<commit_after>MODEL ?= 64
BUILD ?= debug

ifneq ($(MODEL), 32)
	ifneq ($(MODEL), 64)
		$(error Unsupported architecture: $(MODEL))
	endif
endif

ifneq ($(BUILD), debug)
	ifneq ($(BUILD), release)
		ifneq ($(BUILD), test)
			$(error Unknown build mode: $(BUILD))
		endif
	endif
endif

DFLAGS = -w -wi -ignore -X -m$(MODEL)

ifeq ($(BUILD), release)
	DFLAGS += -release -O -inline -noboundscheck
else
	DFLAGS += -debug -gc

	ifeq ($(BUILD), test)
		DFLAGS += -unittest -cov
	endif
endif

ifeq ($(BUILD), test)
	LUAD_OUTPUT = test/luad_unittest
else
	LUAD_OUTPUT = lib/libluad.a
endif

all: $(LUAD_OUTPUT)

clean:
	-rm -f lib/libluad.o
	-rm -f lib/libluad.a
	-rm -f lib/libluad.deps
	-rm -f lib/libluad.json
	-rm -f lib/luad.*.lst
	-rm -f test/luad_unittest
	-rm -f test/luad_unittest.o
	-rm -f *.lst

LUAD_DFLAGS = $(DFLAGS)
LUAD_DFLAGS += -Xf"lib/libluad.json" -deps="lib/libluad.deps" -L-llua5.1

ifneq ($(BUILD), test)
	LUAD_DFLAGS += -lib
else
	LUAD_DFLAGS += -version=luad_unittest_main
endif

lib/libluad.a: $(LUAD_SOURCES)
	if ! test -d lib; then mkdir lib; fi
	dmd $(LUAD_DFLAGS) -of$@ $(LUAD_SOURCES);

test/luad_unittest: $(LUAD_SOURCES)
	if ! test -d test; then mkdir test; fi
	dmd $(LUAD_DFLAGS) -of$@ $(LUAD_SOURCES);
	gdb --command=luad.gdb test/luad_unittest;

LUAD_SOURCES = \
{'fraction_non_alphanumeric': 0.17046413502109706, 'fraction_numerical': 0.00590717299578059, 'mean_word_length': 3.5421455938697317, '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': '991673', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1029, 'n_words': 259}