forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.dune
68 lines (54 loc) · 2.4 KB
/
Makefile.dune
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
BYTECODE=
ROOT=$(shell pwd)
# Dune creates read-only files as of https://github.com/ocaml/dune/pull/3092
#
# We later copy these executables into the `bin/` dir; if we just use `cp`,
# this will only succeed once: a second build will fail as `cp` will refuse
# to overwrite files that do not have write permissions.
COPY_EXE := install -m 755
################################################################################
# Rules #
################################################################################
.NOTPARALLEL:
all: build-hack copy-hack-files
debug: build-hack-debug copy-hack-debug-files
clean:
find ./bin -mindepth 1 -not -path ./bin/README -delete
dune clean
# First argument is the extension to use.
# Second argument is a suffix for the rules name. Optional
#
# The only supported configuration are:
# 1=exe 2= (literaly nothing, not even a space)
# 1=bc 2=-debug
define build_hack
$(eval ext := $(if $(filter $(2),-debug),".bc",""))
build-hack$(2):
dune build \
src/hh_server.$(1) \
src/hh_client.$(1) \
src/hh_single_type_check.$(1) \
src/hackfmt.$(1) \
src/hh_parse.$(1) \
src/generate_full_fidelity.$(1) \
src/hh_fanout/hh_fanout.$(1)
copy-hack$(2)-files: build-hack$(2)
mkdir -p "$(HACK_BIN_DIR)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_server.$(1)" "$(HACK_BIN_DIR)/hh_server$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_client.$(1)" "$(HACK_BIN_DIR)/hh_client$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_single_type_check.$(1)" "$(HACK_BIN_DIR)/hh_single_type_check$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hackfmt.$(1)" "$(HACK_BIN_DIR)/hackfmt$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_parse.$(1)" "$(HACK_BIN_DIR)/hh_parse$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/generate_full_fidelity.$(1)" "$(HACK_BIN_DIR)/generate_full_fidelity$(ext)"
${COPY_EXE} "$(DUNE_BUILD_DIR)/default/hack/src/hh_fanout/hh_fanout.$(1)" "$(HACK_BIN_DIR)/hh_fanout$(ext)"
endef
# Define rules for normal build / debug build
# The name of the rules is important as it matches what is expected by cmake
$(eval $(call build_hack,exe,))
$(eval $(call build_hack,bc,-debug))
.PHONY: test do-test
test: build-hack copy-hack-files
$(MAKE) -f Makefile.dune do-test
do-test:
dune runtest
# python3 ./test/integration/runner.py ./bin/hh_server ./bin/hh_client