Skip to content

Commit 831fcda

Browse files
committed
New Makefile.
Cache binary of setup.ml therefore makes incremental build faster.
1 parent 2ae4be0 commit 831fcda

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ _build/
33
*.native
44
setup.data
55
setup.log
6+
setup-dev

Makefile

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,54 @@
1-
# OASIS_START
2-
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
1+
# Generic Makefile for oasis project
32

4-
SETUP = ocaml setup.ml
3+
# Set to setup for the release
4+
SETUP := setup-dev
55

6-
build: setup.data
7-
$(SETUP) -build $(BUILDFLAGS)
6+
# Default rule
7+
default: build
88

9-
doc: setup.data build
10-
$(SETUP) -doc $(DOCFLAGS)
9+
# Setup for the development version
10+
setup-dev: _oasis setup.ml
11+
grep -v '^#' setup.ml > setup_dev.ml
12+
ocamlfind ocamlopt -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || ocamlfind ocamlc -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || true
13+
rm -f setup_dev.*
1114

12-
test: setup.data build
13-
$(SETUP) -test $(TESTFLAGS)
15+
# Setup for the release
16+
setup: setup.ml
17+
ocamlopt.opt -o $@ $< || ocamlopt -o $@ $< || ocamlc -o $@ $<
18+
rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo
1419

15-
all:
16-
$(SETUP) -all $(ALLFLAGS)
20+
build: $(SETUP) setup.data
21+
./$(SETUP) -build $(BUILDFLAGS)
1722

18-
install: setup.data
19-
$(SETUP) -install $(INSTALLFLAGS)
23+
doc: $(SETUP) setup.data build
24+
./$(SETUP) -doc $(DOCFLAGS)
2025

21-
uninstall: setup.data
22-
$(SETUP) -uninstall $(UNINSTALLFLAGS)
26+
test: $(SETUP) setup.data build
27+
./$(SETUP) -test $(TESTFLAGS)
2328

24-
reinstall: setup.data
25-
$(SETUP) -reinstall $(REINSTALLFLAGS)
29+
all: $(SETUP)
30+
./$(SETUP) -all $(ALLFLAGS)
2631

27-
clean:
28-
$(SETUP) -clean $(CLEANFLAGS)
32+
install: $(SETUP) setup.data
33+
./$(SETUP) -install $(INSTALLFLAGS)
2934

30-
distclean:
31-
$(SETUP) -distclean $(DISTCLEANFLAGS)
35+
uninstall: $(SETUP) setup.data
36+
./$(SETUP) -uninstall $(UNINSTALLFLAGS)
3237

33-
setup.data:
34-
$(SETUP) -configure $(CONFIGUREFLAGS)
38+
reinstall: $(SETUP) setup.data
39+
./$(SETUP) -reinstall $(REINSTALLFLAGS)
3540

36-
.PHONY: build doc test all install uninstall reinstall clean distclean configure
41+
clean: $(SETUP)
42+
./$(SETUP) -clean $(CLEANFLAGS)
3743

38-
# OASIS_STOP
44+
distclean: $(SETUP)
45+
./$(SETUP) -distclean $(DISTCLEANFLAGS)
46+
rm -f $(SETUP)
47+
48+
configure: $(SETUP)
49+
./$(SETUP) -configure $(CONFIGUREFLAGS)
50+
51+
setup.data: $(SETUP)
52+
./$(SETUP) -configure $(CONFIGUREFLAGS)
53+
54+
.PHONY: default build doc test all install uninstall reinstall clean distclean configure

0 commit comments

Comments
 (0)