-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (51 loc) · 1.22 KB
/
Makefile
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
#
# Makefile for HXC (the HX compiler)
#
# Project root and build directory
ROOT:=$(shell dirname $(firstword $(MAKEFILE_LIST)))
BUILD_DIR:=$(ROOT)/_build
# The build command, sources (projects), and build flags.
BUILD=dune build
PROJECTS=hx
COMMON_FLAGS=$(PROJECTS) --build-dir=$(BUILD_DIR)
DEV_FLAGS=$(COMMON_FLAGS) --profile=dev
REL_FLAGS=$(COMMON_FLAGS) --profile=release
FLAGS=
#
# Build rules.
#
# The default is to build everything in release mode.
.DEFAULT_GOAL:= all
.PHONY: all
all: release
# Prepare release build
.PHONY: release
release: FLAGS:=$(REL_FLAGS)
release: build
# Prepare development build
.PHONY: development
development: FLAGS:=$(DEV_FLAGS)
development: build
.PHONY: dev
dev: development
# Generic build rule
.PHONY: build
build: unlink-executable assemble link-executable
.PHONY: assemble
assemble: dune dune-project
$(BUILD) $(FLAGS) @install
.PHONY: link-executable
link-executable: $(BUILD_DIR)/default/hx
ln -fs $(BUILD_DIR)/default/hx $(ROOT)/hx
.PHONY: unlink-executable
unlink-executable:
rm -f $(ROOT)/hx
# Debug build rules
.PHONY: debug-parser
debug-parser: text/parser.mly
menhir --explain text/parser.mly
mv text/parser.conflicts .
# Clean up
.PHONY: clean
clean: unlink-executable
dune clean