<commit_before># Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

.PHONY: default
default: exes

RELEASE_TARGETS:=_build/release/cli/sledge_cli.exe _build/release/sledge.install _build/release/report/sledge_report.exe

TARGETS:=$(subst release,debug,$(RELEASE_TARGETS)) $(subst release,trace,$(RELEASE_TARGETS)) $(RELEASE_TARGETS) _build/release/sledge-help.txt

dune_build_release:=dune build $(RELEASE_TARGETS)
dune_install_release:=dune install --context=release --prefix=_build/_install/release sledge 2>/dev/null

dune_build_trace:=$(subst release,trace,$(dune_build_release))
dune_install_trace:=$(subst release,trace,$(dune_install_release))

dune_build_debug:=$(subst release,debug,$(dune_build_release))
dune_install_debug:=$(subst release,debug,$(dune_install_release))

export PATH:=../facebook/dependencies/bin:$(PATH)

LLVM_OCAML_SRC:=$(shell git ls-files -- vendor/llvm-dune)

# file to use as a sentinel indicating llvm ocaml bindings are up-to-date
LLVM_OCAML_SENTINEL=vendor/llvm-dune/src/llvm/common/dune

# Note that llvm-config is broken and does not correctly detect llvm
# shared libraries. A filthy workaround seems to be to create the
# libLLVM-11.dylib file llvm-config looks for as a symbolic link to
# libLLVM.dylib.
link_llvm_dylib:
	@set -e ;\
	LLVMLIB=$$($$(opam var conf-llvm:config) --libdir) ;\
	ln -s $$LLVMLIB/libLLVM.dylib $$LLVMLIB/libLLVM-11.dylib

$(LLVM_OCAML_SENTINEL): $(LLVM_OCAML_SRC)
	cd vendor/llvm-dune; ./setup.sh $$(opam var conf-llvm:config) # &>/dev/null

clean_llvm:
	rm -rf vendor/llvm-dune/{src,llvm_*.opam}

.PHONY: setup
setup: $(LLVM_OCAML_SENTINEL)

.PHONY: check
check: setup
	dune build @check

.PHONY: exes
exes: setup
	dune build $(TARGETS)
	$(dune_install_debug)
	$(dune_install_trace)
	$(dune_install_release)

.PHONY: debug
debug: setup
	$(dune_build_debug)
	$(dune_install_debug)

.PHONY: trace
trace: setup
	$(dune_build_trace)
	$(dune_install_trace)

.PHONY: release
release: setup
	$(dune_build_release)
	$(dune_install_release)

.PHONY: watch
watch: setup
	dune build --watch --terminal-persistence=clear-on-rebuild $(TARGETS)

.PHONY: test
test:
	-dune build @_build/debug/runtest --auto-promote
	dune build @_build/debug/fmt --auto-promote 2>/dev/null

.PHONY: ci-test
ci-test:
	dune build @_build/debug/fmt @_build/debug/runtest

.PHONY: clean
clean:
	dune clean
<commit_msg>[sledge] Add watch-test build target<commit_after># Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

.PHONY: default
default: exes

RELEASE_TARGETS:=_build/release/cli/sledge_cli.exe _build/release/sledge.install _build/release/report/sledge_report.exe _build/release/sledge-help.txt
DEBUG_TARGETS:=$(subst release,debug,$(RELEASE_TARGETS))
TRACE_TARGETS:=$(subst release,trace,$(RELEASE_TARGETS))

TARGETS:=$(DEBUG_TARGETS) $(TRACE_TARGETS) $(RELEASE_TARGETS)

dune_install_release:=dune install --context=release --prefix=_build/_install/release sledge 2>/dev/null
dune_install_trace:=$(subst release,trace,$(dune_install_release))
dune_install_debug:=$(subst release,debug,$(dune_install_release))

export PATH:=../facebook/dependencies/bin:$(PATH)

LLVM_OCAML_SRC:=$(shell git ls-files -- vendor/llvm-dune)

# file to use as a sentinel indicating llvm ocaml bindings are up-to-date
LLVM_OCAML_SENTINEL=vendor/llvm-dune/src/llvm/common/dune

# Note that llvm-config is broken and does not correctly detect llvm
# shared libraries. A filthy workaround seems to be to create the
# libLLVM-11.dylib file llvm-config looks for as a symbolic link to
# libLLVM.dylib.
link_llvm_dylib:
	@set -e ;\
	LLVMLIB=$$($$(opam var conf-llvm:config) --libdir) ;\
	ln -s $$LLVMLIB/libLLVM.dylib $$LLVMLIB/libLLVM-11.dylib

$(LLVM_OCAML_SENTINEL): $(LLVM_OCAML_SRC)
	cd vendor/llvm-dune; ./setup.sh $$(opam var conf-llvm:config) # &>/dev/null

clean_llvm:
	rm -rf vendor/llvm-dune/{src,llvm_*.opam}

.PHONY: setup
setup: $(LLVM_OCAML_SENTINEL)

.PHONY: check
check: setup
	dune build @check

.PHONY: exes
exes: setup
	dune build $(TARGETS)
	$(dune_install_debug)
	$(dune_install_trace)
	$(dune_install_release)

.PHONY: debug
debug: setup
	dune build $(DEBUG_TARGETS)
	$(dune_install_debug)

.PHONY: trace
trace: setup
	dune build $(TRACE_TARGETS)
	$(dune_install_trace)

.PHONY: release
release: setup
	dune build $(RELEASE_TARGETS)
	$(dune_install_release)

.PHONY: watch
watch: setup
	dune build --watch --terminal-persistence=clear-on-rebuild $(TARGETS)

.PHONY: watch
watch-test: setup
	dune build --watch @_build/debug/runtest --auto-promote $(DEBUG_TARGETS)

.PHONY: test
test:
	-dune build @_build/debug/runtest --auto-promote
	dune build @_build/debug/fmt --auto-promote 2>/dev/null

.PHONY: ci-test
ci-test:
	dune build @_build/debug/fmt @_build/debug/runtest

.PHONY: clean
clean:
	dune clean

{'fraction_non_alphanumeric': 0.1276553106212425, 'fraction_numerical': 0.002404809619238477, 'mean_word_length': 5.415167095115681, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2045257', 'n_tokens_mistral': 1925, 'n_tokens_neox': 1885, 'n_words': 431}