Fix refcounting in genConcat - take 2
[hiphop-php.git] / hphp / hack / Makefile.dune
blob929c4ca9b1b51350c7af07845246e5d93d601b7e
1 BYTECODE=
3 ROOT=$(shell pwd)
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 ################################################################################
13 #                                    Rules                                     #
14 ################################################################################
16 .NOTPARALLEL:
18 all: build-hack copy-hack-files
20 debug: build-hack-debug copy-hack-debug-files
22 clean:
23         find ./bin -mindepth 1 -not -path ./bin/README -delete
24         dune clean
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)
31 # 1=bc 2=-debug
32 define build_hack
33 $(eval ext := $(if $(filter $(2),-debug),".bc",""))
34 build-hack$(2):
35         dune build \
36                 src/hh_server.$(1) \
37                 src/hh_client.$(1) \
38                 src/hh_single_type_check.$(1) \
39                 src/hackfmt.$(1) \
40                 src/hh_parse.$(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)"
51 endef
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))
59 .PHONY: test do-test
60 test: build-hack copy-hack-files
61         $(MAKE) -f Makefile.dune do-test
63 do-test:
64         dune runtest
65         # python3 ./test/integration/runner.py ./bin/hh_server ./bin/hh_client