5 # Dune creates read-only files as of https://github.com/ocaml/dune/pull/3092
7 # We later copy these executables into the `bin/` dir; if we just use `cp`,
8 # this will only succeed once: a second build will fail as `cp` will refuse
9 # to overwrite files that do not have write permissions.
10 COPY_EXE := install -m 755
12 ################################################################################
14 ################################################################################
18 all: build-hack copy-hack-files
20 debug: build-hack-debug copy-hack-debug-files
23 find ./bin -mindepth 1 -not -path ./bin/README -delete
26 # First argument is the extension to use.
27 # Second argument is a suffix for the rules name. Optional
29 # The only supported configuration are:
30 # 1=exe 2= (literaly nothing, not even a space)
33 $(eval ext := $(if $(filter $(2),-debug),".bc",""))
38 src/hh_single_type_check.$(1) \
41 src/generate_full_fidelity.$(1)
43 copy-hack$(2)-files: build-hack$(2)
44 mkdir -p "$(HACK_BIN_DIR)"
45 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_server.$(1)" "$(HACK_BIN_DIR)/hh_server$(ext)"
46 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_client.$(1)" "$(HACK_BIN_DIR)/hh_client$(ext)"
47 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_single_type_check.$(1)" "$(HACK_BIN_DIR)/hh_single_type_check$(ext)"
48 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hackfmt.$(1)" "$(HACK_BIN_DIR)/hackfmt$(ext)"
49 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_parse.$(1)" "$(HACK_BIN_DIR)/hh_parse$(ext)"
50 ${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/generate_full_fidelity.$(1)" "$(HACK_BIN_DIR)/generate_full_fidelity$(ext)"
53 # Define rules for normal build / debug build
54 # The name of the rules is important as it matches what is expected by cmake
55 $(eval $(call build_hack,exe,))
56 $(eval $(call build_hack,bc,-debug))
60 test: build-hack copy-hack-files
61 $(MAKE) -f Makefile.dune do-test
65 # python3 ./test/integration/runner.py ./bin/hh_server ./bin/hh_client