<commit_before>OCAMLBUILD=ocamlbuild
MENHIRFLAGS=-use-menhir -menhir "menhir -v --explain --strict"
FINDLIBFLAGS=-use-ocamlfind -classic-display
CFLAGS=-cflags "-w +a-e-9-45-44"
COREFLAGS=-pkg core \
    -tag short_paths \
    -cflags -strict-sequence


UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
  CLIBFLAGS=-lflags -cclib,-Xlinker,-cclib,--no-as-needed,-cclib,-Lc_src,-cclib,-larith,-cclib,-Xlinker,-cclib,-rpath,-cclib,`pwd`/_build/c_src
endif
ifeq ($(UNAME_S),Darwin)
  CLIBFLAGS=-lflags -cclib,-Lc_src,-cclib,-larith
endif

OCAMLBUILDFLAGS= $(CFLAGS) $(COREFLAGS) $(FINDLIBFLAGS) $(MENHIRFLAGS)

###########################################################################
# main targets

.PHONY: all dmasm clean doc test-dmasm-assemble test-dmasm-reg \
  run_tests run-run_tests tests

all: dmasm

unit-tests: run-run_tests test-arith

dmasm:
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) src/Main/dmasm.native

clean:
	-@rm doc/dmasm.html
	-@rm dmasm.native
	-@rm run_tests.native
	$(OCAMLBUILD) -clean

doc:
	cd doc && make

###########################################################################
# Targets for development and testing

test-dmasm-reg: dmasm
	./dmasm.native -p -t "register_allocate[10]" examples/test/register-alloc.mil

test-dmasm-square: dmasm
	./dmasm.native -p -t "expand[n=4],ssa,register_allocate[15],strip_comments,asm[x86-64]" examples/test/add_call.mil

test-dmasm-add-call: dmasm
	./dmasm.native -p -t "expand[n=3],ssa,strip_comments,register_allocate[15],asm[x86-64]" examples/test/add_call.mil

demo: dmasm
	./scripts/demo.sh

test-dmasm-typing: dmasm
	./dmasm.native -p -t "typecheck" tests/typing/must_fail/t_01.mil

test-dmasm-parser: dmasm
	./dmasm.native -p -t "typecheck" tests/parser/ok/t_01.mil

test-dmasm-interp: dmasm
	./dmasm.native -t "interp[n=4][][test_fun][[2,3,4,5]]" tests/interp/ok/t_01.mil

run_tests:
	test -d _build/c_src || mkdir -p _build/c_src
	gcc -shared -o _build/c_src/libarith.so \
	  c_src/arith.c
	gcc -o _build/c_src/mont_amd64_64 \
	  c_src/arith.c \<commit_msg>add test target for conv file<commit_after>OCAMLBUILD=ocamlbuild
MENHIRFLAGS=-use-menhir -menhir "menhir -v --explain --strict"
FINDLIBFLAGS=-use-ocamlfind -classic-display
CFLAGS=-cflags "-w +a-e-9-45-44"
COREFLAGS=-pkg core \
    -tag short_paths \
    -cflags -strict-sequence


UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
  CLIBFLAGS=-lflags -cclib,-Xlinker,-cclib,--no-as-needed,-cclib,-Lc_src,-cclib,-larith,-cclib,-Xlinker,-cclib,-rpath,-cclib,`pwd`/_build/c_src
endif
ifeq ($(UNAME_S),Darwin)
  CLIBFLAGS=-lflags -cclib,-Lc_src,-cclib,-larith
endif

OCAMLBUILDFLAGS= $(CFLAGS) $(COREFLAGS) $(FINDLIBFLAGS) $(MENHIRFLAGS)

###########################################################################
# main targets

.PHONY: all dmasm clean doc test-dmasm-assemble test-dmasm-reg \
  run_tests run-run_tests tests

all: dmasm

unit-tests: run-run_tests test-arith

dmasm:
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) src/Main/dmasm.native

clean:
	-@rm doc/dmasm.html
	-@rm dmasm.native
	-@rm run_tests.native
	$(OCAMLBUILD) -clean

doc:
	cd doc && make

###########################################################################
# Targets for development and testing

test-conv:
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) src/IL/IL_conv.native
	./IL_conv.native

test-dmasm-reg: dmasm
	./dmasm.native -p -t "register_allocate[10]" examples/test/register-alloc.mil

test-dmasm-square: dmasm
	./dmasm.native -p -t "expand[n=4],ssa,register_allocate[15],strip_comments,asm[x86-64]" examples/test/add_call.mil

test-dmasm-add-call: dmasm
	./dmasm.native -p -t "expand[n=3],ssa,strip_comments,register_allocate[15],asm[x86-64]" examples/test/add_call.mil

demo: dmasm
	./scripts/demo.sh

test-dmasm-typing: dmasm
	./dmasm.native -p -t "typecheck" tests/typing/must_fail/t_01.mil

test-dmasm-parser: dmasm
	./dmasm.native -p -t "typecheck" tests/parser/ok/t_01.mil

test-dmasm-interp: dmasm
	./dmasm.native -t "interp[n=4][][test_fun][[2,3,4,5]]" tests/interp/ok/t_01.mil

run_tests:
	test -d _build/c_src || mkdir -p _build/c_src
	gcc -shared -o _build/c_src/libarith.so \
	  c_src/arith.c
	gcc -o _build/c_src/mont_amd64_64 \
	  c_src/arith.c \
{'fraction_non_alphanumeric': 0.22158273381294963, 'fraction_numerical': 0.017266187050359712, 'mean_word_length': 4.5836680053547525, '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': '1499725', 'n_tokens_mistral': 1806, 'n_tokens_neox': 1672, 'n_words': 282}