<commit_before>OCAMLC=ocamlfind ocamlc -thread -package batteries -linkpkg -g
OCAMLOPT=ocamlfind ocamlopt -thread -package batteries -linkpkg -g
OCAMLDEP=ocamldep
INCLUDES=                 # all relevant -I options here
OCAMLFLAGS=$(INCLUDES)    -w -8 # add other options for ocamlc here
OCAMLOPTFLAGS=$(INCLUDES) -w -8 # add other options for ocamlopt here

# always bump version for a release
VERSION=$(shell cat ../version.txt)

NAME=fstar_$(VERSION)_$(shell echo `uname`_`uname -m`)

BASE_OBJS=prims.cmx
FSTAR_LIBS=FStar_ST.cmx FStar_All.cmx FStar_Option.cmx FStar_List.cmx FStar_Char.cmx FStar_String.cmx FStar_Util.cmx FStar_Bytes.cmx FStar_Getopt.cmx FStar_Range.cmx FStar_Parser_Util.cmx FStar_Platform.cmx FStar_Unionfind.cmx 
FSTAR_OBJS=$(BASE_OBJS) $(FSTAR_LIBS) FStar_Version.cmx FStar_Options.cmx FStar_Absyn_Syntax.cmx FStar_Absyn_Const.cmx FStar_Absyn_Visit.cmx FStar_Absyn_Util.cmx FStar_Absyn_Print.cmx FStar_Absyn_SSyntax.cmx FStar_Tc_Env.cmx FStar_Tc_Recheck.cmx FStar_Tc_Normalize.cmx FStar_Tc_Errors.cmx FStar_Tc_Rel.cmx FStar_Tc_Util.cmx FStar_Tc_Tc.cmx FStar_Parser_AST.cmx FStar_Parser_DesugarEnv.cmx FStar_Parser_Desugar.cmx FStar_Parser_Parse.cmx FStar_Parser_Lexhelp.cmx FStar_Parser_LexFStar.cmx FStar_Parser_ParseIt.cmx FStar_Parser_Driver.cmx FStar_ToSMT_Term.cmx FStar_ToSMT_Z3.cmx FStar_ToSMT_SplitQueryCases.cmx FStar_ToSMT_Encode.cmx FSharp_Format.cmx FStar_Extraction_ML_Syntax.cmx FStar_Extraction_ML_Env.cmx FStar_Extraction_ML_Util.cmx FStar_Extraction_ML_Code.cmx FStar_Extraction_ML_ExtractTyp.cmx FStar_Extraction_ML_ExtractExp.cmx FStar_Extraction_ML_ExtractMod.cmx FStar_FStar.cmx

SUPPORT_DIR=../support/ocaml/fstar-lib/src

default: fstar.exe

# the `fexport` function takes a path relative to the top of the F* repo
# and exports the contents of that directory to the `fstar` dir
fexport = cd ../.. && git archive "--format=tar" "--prefix=$(1)/" HEAD:$(1)/ | tar -x -C src/ocaml-output/fstar

package: parser fstar.exe
	rm -f $(NAME).zip $(NAME).tar.gz
	rm -dfr fstar && mkdir fstar
	cp ../../README.md ../../LICENSE ../../setenv.sh fstar/
	mkdir fstar/bin
	cp fstar.exe fstar/bin/fstar.exe
	@cp ../../bin/*z3* fstar/bin &> /dev/null || cp `which z3` fstar/bin &> /dev/null || echo " ********** WARNING: you don't have Z3 in \\$FSTAR_HOME/bin or in your \\$PATH, skipped from package ************** "
	$(call fexport,lib)
	$(call fexport,examples)
	$(call fexport,contrib)
	$(call fexport,doc/tutorial)
	cd fstar/doc/tutorial; make
ifeq ($(OS),Windows_NT)
	zip -r -9 $(NAME).zip fstar
else
	tar czf $(NAME).tar.gz fstar
endif

PARSER_MLS=FStar_Parser_LexFStar.ml FStar_Parser_Parse.ml FStar_Parser_ParseIt.ml parse.ml parse.mli

prep: parser base_objs depend 

base_objs: $(addprefix $(SUPPORT_DIR)/, $(BASE_OBJS:.cmx=.ml) $(FSTAR_LIBS:.cmx=.ml))
	cp $^ .

parser:
	cat ../parser/parse.fsy | sed 's/^[/][/].*//g' | sed 's/^[#].*//g' | sed 's/^open .*//g' > parse.mly
	ocamlyacc parse.mly
	rm -f FStar_Parser_Parse.ml
	echo "open Prims" > FStar_Parser_Parse.ml
	echo "open FStar_List" >> FStar_Parser_Parse.ml
	echo "open FStar_Util" >> FStar_Parser_Parse.ml
	echo "open FStar_Range" >> FStar_Parser_Parse.ml
	echo "open FStar_Options" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Syntax" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Const" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Util" >> FStar_Parser_Parse.ml
	echo "open FStar_Parser_AST" >> FStar_Parser_Parse.ml
	echo "open FStar_Parser_Util" >> FStar_Parser_Parse.ml
	cat parse.ml >> FStar_Parser_Parse.ml
#	cp ../support/ocaml/fstar-lang/src/FSLangLexer.mll lex.mll
	ocamllex ../lex.mll -o FStar_Parser_LexFStar.ml
	cp ../parseit.ml FStar_Parser_ParseIt.ml
ifneq (, $(shell which unix2dos))
	unix2dos $(PARSER_MLS) parse.mly
endif

fstarml.ml: ../main.ml
	cp $^ $@

fstar.exe: $(FSTAR_OBJS) fstarml.ml
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -o fstar.exe $^
	cp fstar.exe ../../bin/fstar.exe

FStar_Version.ml:
	echo 'let version = "unknown version"' > FStar_Version.ml
	echo 'let platform = "unknown platform"' >> FStar_Version.ml
	echo 'let compiler = "unknown compiler"' >> FStar_Version.ml
	echo 'let date = "unknown date"' >> FStar_Version.ml

# Common rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx

.ml.cmo:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.mli.cmi:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.ml.cmx:
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<

# Clean up all files generated by targets in _this_ Makefile
clean:
	rm -dfr fstar
	rm -f .depend fstar.exe *.cmi *.cmx *.cmo *.o
	rm -f fstarml* support.ml
	rm -f $(PARSER_MLS) parse.mly $(BASE_OBJS:.cmx=.ml) $(FSTAR_LIBS:.cmx=.ml)
	rm -f *.tar.gz *.zip<commit_msg>Made --version do something useful for OCaml binary<commit_after>.PHONY: default  __force__

OCAMLC=ocamlfind ocamlc -thread -package batteries -linkpkg -g
OCAMLOPT=ocamlfind ocamlopt -thread -package batteries -linkpkg -g
OCAMLDEP=ocamldep
INCLUDES=                 # all relevant -I options here
OCAMLFLAGS=$(INCLUDES)    -w -8 # add other options for ocamlc here
OCAMLOPTFLAGS=$(INCLUDES) -w -8 # add other options for ocamlopt here

BASE_OBJS=prims.cmx
FSTAR_LIBS=FStar_ST.cmx FStar_All.cmx FStar_Option.cmx FStar_List.cmx FStar_Char.cmx FStar_String.cmx FStar_Util.cmx FStar_Bytes.cmx FStar_Getopt.cmx FStar_Range.cmx FStar_Parser_Util.cmx FStar_Platform.cmx FStar_Unionfind.cmx 
FSTAR_OBJS=$(BASE_OBJS) $(FSTAR_LIBS) FStar_Version.cmx FStar_Options.cmx FStar_Absyn_Syntax.cmx FStar_Absyn_Const.cmx FStar_Absyn_Visit.cmx FStar_Absyn_Util.cmx FStar_Absyn_Print.cmx FStar_Absyn_SSyntax.cmx FStar_Tc_Env.cmx FStar_Tc_Recheck.cmx FStar_Tc_Normalize.cmx FStar_Tc_Errors.cmx FStar_Tc_Rel.cmx FStar_Tc_Util.cmx FStar_Tc_Tc.cmx FStar_Parser_AST.cmx FStar_Parser_DesugarEnv.cmx FStar_Parser_Desugar.cmx FStar_Parser_Parse.cmx FStar_Parser_Lexhelp.cmx FStar_Parser_LexFStar.cmx FStar_Parser_ParseIt.cmx FStar_Parser_Driver.cmx FStar_ToSMT_Term.cmx FStar_ToSMT_Z3.cmx FStar_ToSMT_SplitQueryCases.cmx FStar_ToSMT_Encode.cmx FSharp_Format.cmx FStar_Extraction_ML_Syntax.cmx FStar_Extraction_ML_Env.cmx FStar_Extraction_ML_Util.cmx FStar_Extraction_ML_Code.cmx FStar_Extraction_ML_ExtractTyp.cmx FStar_Extraction_ML_ExtractExp.cmx FStar_Extraction_ML_ExtractMod.cmx FStar_FStar.cmx

SUPPORT_DIR=../support/ocaml/fstar-lib/src

default: fstar.exe

# the `fexport` function takes a path relative to the top of the F* repo
# and exports the contents of that directory to the `fstar` dir
fexport = cd ../.. && git archive "--format=tar" "--prefix=$(1)/" HEAD:$(1)/ | tar -x -C src/ocaml-output/fstar


VERSION=$(shell cat ../version.txt)  # always bump version for a release
PLATFORM=$(shell echo `uname`_`uname -m`)
NAME=fstar_$(VERSION)_$(PLATFORM)
COMPILER = $(shell ocamlc -version)
DATE = $(shell date -Iseconds)

FStar_Version.ml:__force__
	echo 'let version = "$(VERSION)"' > FStar_Version.ml
	echo 'let platform = "$(PLATFORM)"' >> FStar_Version.ml
	echo 'let compiler = "OCaml $(COMPILER)"' >> FStar_Version.ml
	echo 'let date = "$(DATE)"' >> FStar_Version.ml

package: parser fstar.exe
	rm -f $(NAME).zip $(NAME).tar.gz
	rm -dfr fstar && mkdir fstar
	cp ../../README.md ../../LICENSE ../../setenv.sh fstar/
	mkdir fstar/bin
	cp fstar.exe fstar/bin/fstar.exe
	@cp ../../bin/*z3* fstar/bin &> /dev/null || cp `which z3` fstar/bin &> /dev/null || echo " ********** WARNING: you don't have Z3 in \\$FSTAR_HOME/bin or in your \\$PATH, skipped from package ************** "
	$(call fexport,lib)
	$(call fexport,examples)
	$(call fexport,contrib)
	$(call fexport,doc/tutorial)
	cd fstar/doc/tutorial; make
ifeq ($(OS),Windows_NT)
	zip -r -9 $(NAME).zip fstar
else
	tar czf $(NAME).tar.gz fstar
endif

PARSER_MLS=FStar_Parser_LexFStar.ml FStar_Parser_Parse.ml FStar_Parser_ParseIt.ml parse.ml parse.mli

prep: parser base_objs depend 

base_objs: $(addprefix $(SUPPORT_DIR)/, $(BASE_OBJS:.cmx=.ml) $(FSTAR_LIBS:.cmx=.ml))
	cp $^ .

parser:
	cat ../parser/parse.fsy | sed 's/^[/][/].*//g' | sed 's/^[#].*//g' | sed 's/^open .*//g' > parse.mly
	ocamlyacc parse.mly
	rm -f FStar_Parser_Parse.ml
	echo "open Prims" > FStar_Parser_Parse.ml
	echo "open FStar_List" >> FStar_Parser_Parse.ml
	echo "open FStar_Util" >> FStar_Parser_Parse.ml
	echo "open FStar_Range" >> FStar_Parser_Parse.ml
	echo "open FStar_Options" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Syntax" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Const" >> FStar_Parser_Parse.ml
	echo "open FStar_Absyn_Util" >> FStar_Parser_Parse.ml
	echo "open FStar_Parser_AST" >> FStar_Parser_Parse.ml
	echo "open FStar_Parser_Util" >> FStar_Parser_Parse.ml
	cat parse.ml >> FStar_Parser_Parse.ml
#	cp ../support/ocaml/fstar-lang/src/FSLangLexer.mll lex.mll
	ocamllex ../lex.mll -o FStar_Parser_LexFStar.ml
	cp ../parseit.ml FStar_Parser_ParseIt.ml
ifneq (, $(shell which unix2dos))
	unix2dos $(PARSER_MLS) parse.mly
endif

fstarml.ml: ../main.ml
	cp $^ $@

fstar.exe: $(FSTAR_OBJS) fstarml.ml
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -o fstar.exe $^
	cp fstar.exe ../../bin/fstar.exe

# Common rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx

.ml.cmo:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.mli.cmi:
	$(OCAMLC) $(OCAMLFLAGS) -c $<

.ml.cmx:
	$(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<

# Clean up all files generated by targets in _this_ Makefile
clean:
	rm -dfr fstar
	rm -f .depend fstar.exe *.cmi *.cmx *.cmo *.o
	rm -f fstarml* support.ml
	rm -f $(PARSER_MLS) parse.mly $(BASE_OBJS:.cmx=.ml) $(FSTAR_LIBS:.cmx=.ml)
	rm -f *.tar.gz *.zip
{'fraction_non_alphanumeric': 0.13571275913656763, 'fraction_numerical': 0.0023509296858303056, 'mean_word_length': 4.654984894259819, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 65, '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': '208807', 'n_tokens_mistral': 4009, 'n_tokens_neox': 3822, 'n_words': 813}