-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
103 lines (70 loc) · 2.53 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
WORD_SIZE = 64
current_dir := ${shell pwd}
BUILD_CONTEXT = wacoq
COQBUILDDIR_REL := vendor/coq
COQBUILDDIR := $(current_dir)/_build/$(BUILD_CONTEXT)/$(COQBUILDDIR_REL)
PACKAGE_VERSION = ${shell node -p 'require("./package.json").version'}
OPAM_ENV = eval `opam env --set-switch --switch $(BUILD_CONTEXT)`
DUNE = $(OPAM_ENV) && dune
.PHONY: default bootstrap setup deps wacoq wacoq-only symb install clean distclean _*
default: wacoq
bootstrap: setup deps
setup:
etc/setup.sh
deps: coq coq-serapi
wacoq: | _build _wrapup # need to sequentialize for ${wildcard}
_build:
$(DUNE) build @coq @wacoq coq-pkgs
_wrapup:
mkdir -p dist && cp _build/$(BUILD_CONTEXT)/cli.js dist/cli.js
ln -sf ${foreach m, ${wildcard _build/$(BUILD_CONTEXT)/coq-pkgs/*}, ../../$m} bin/coq/
wacoq-only:
$(DUNE) build @wacoq
symb:
node dist/cli.js inspect
install:
$(DUNE) build ${foreach p, coq-core coq-stdlib, vendor/coq/$p.install}
$(DUNE) install coq-core coq-stdlib
dist-npm:
rm -rf package
npx webpack --mode production --env outDir=package/dist \
${addprefix --config-name , cli worker subproc}
cp package.json index.js README.md package/
mkdir package/bin && ln -s ${addprefix ../../bin/, icoq.bc coq} package/bin/
mkdir package/etc && cp etc/postinstall.js package/etc
tar zchf wacoq-bin-$(PACKAGE_VERSION).tar.gz \
--exclude='coqlib/**' --exclude='*.*.js' --exclude='*.so' \
${addprefix package/, package.json index.js dist bin etc}
########################################################################
# Externals
########################################################################
.PHONY: coq
COQ_SRC = vendor/coq
COQ_BRANCH = V8.16.0
COQ_REPOS=https://github.com/coq/coq.git
COQ_PATCHES = timeout extern $(COQ_PATCHES|$(WORD_SIZE))
COQ_PATCHES|64 = coerce-32bit
coq_configure = ./tools/configure/configure.exe
$(COQ_SRC):
git clone -c advice.detachedHead=false --depth=1 -b $(COQ_BRANCH) $(COQ_REPOS) $@
cd $@ && git apply ${foreach p,$(COQ_PATCHES),$(current_dir)/etc/patches/$p.patch}
coq: $(COQ_SRC)
rm -rf _build/$(BUILD_CONTEXT)/$(COQ_SRC) # safeguard
cd $(COQ_SRC) && \
dune exec --context=$(BUILD_CONTEXT) $(coq_configure) \
-- -prefix $(current_dir) -native-compiler no -bytecode-compiler no -coqide no
.PHONY: coq-serapi
SERAPI_SRC = vendor/coq-serapi
coq-serapi:
git submodule update $(SERAPI_SRC)
clean:
$(DUNE) clean
rm -f wacoq-bin-*.tar.gz
distclean: clean
rm -rf vendor/coq
ci:
$(MAKE) distclean
$(MAKE) coq
$(MAKE) && $(MAKE) dist-npm
$(MAKE) install
npm link # makes `wacoq` cli available