-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (50 loc) · 1.82 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
include mk/toplevel-util.mk
SHELL := bash
OCAML := $(call check-opt,ocaml)
OCAMLOPT := $(call check-opt,ocamlopt) -g
OCAMLC := $(call check-opt,ocamlc)
OCAMLTOP := $(call check-opt,ocamlmktop)
OCAMLDEP := $(call check-opt,ocamldep)
OCAMLYACC := $(call check-opt,ocamlyacc)
OCAMLLEX := $(call check-opt,ocamllex)
OCAMLDOC := $(call check-opt,ocamldoc)
PERL := perl
STATIC :=
# other programs:
# echo, cp, chmod, rm, mkdir
include mk/bits.mk
# list of packages to consider
TOPLEVEL := Parsec Ctrs Util Smt Rewriting Io Termination Confluence Completion Inductive Tool
# flags for linking
STDLIBS := nums str unix
LINK := $(if $(STATIC),-ccopt -static,) -cc g++ $(STDLIBS:=.cmxa)
# default target. (see src/ttt2/build.mk)
all: ctrl
.SUFFIXES:
include mk/toplevel.mk
# helpers for building file names
make-xcmi = $(BUILD_$(1))/$(call lower,$(1))x.cmi
make-mli = $(SRC_$(1))/$(call lower,$(1)).mli
make-inc = -I $(DIR_$(1))
# make an ocaml toplevel interpreter that includes the Tool packages
top: top.build/top $(DIR)/build.mk
cp $(LIBS_Tool:.cmxa=.cmi) $(call map,make-xcmi,$(PACKS_Tool)) top.build
@( echo '#! /bin/bash' ; \
echo 'exec $(shell pwd)/top.build/top -I $(shell pwd)/top.build "$$@"' ) > top
chmod +x top
top.build/top: $$(subst .cmxa,.cma,$$(LIBS_Tool)) $(EXTRA_Tool) | top.build/.dir
$(OCAMLTOP) $(LINK:.cmxa=.cma) $(subst .cmx,.cmo,$(LINK_Logic:.cmxa=.cma)) -o $@ $(LIBS_Tool:.cmxa=.cma) $(LINK_Tool)
# build documentation
doc: $(LIBS_Tool) README.txt | doc/.dir
$(OCAMLDOC) -html -d doc -text README.txt $(call map,make-mli,$(PACKS_Tool)) $(call map,make-inc,$(PACKS_Tool))
README.txt: README
cp $< $@
.INTERMEDIATE: README.txt
# extra housekeeping
distclean::
rm -rf top top.build doc build $(add_suffix .tar.gz,$(TOOLS))
clean::
rm -f README.txt
help:
@cat README
.PHONY: doc help