Makefile 1.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# ------------------------------------------------------------------------------

# Variables.

PACKAGE := \
  visitors

PLUGIN := \
  ppx_deriving_$(PACKAGE)

11 12 13
RUNTIME := \
  VisitorsRuntime

14 15 16 17 18 19
OCAMLBUILD := \
  ocamlbuild \
  -use-ocamlfind \
  -classic-display \

# The targets that should be built (using ocamlbuild).
20
# Not sure whether all of the following files are really required.
POTTIER Francois's avatar
POTTIER Francois committed
21
TARGET := \
22 23
  $(patsubst %,$(PLUGIN).%,a cma cmxa cmxs) \
  $(patsubst %,$(RUNTIME).%,a cma cmi cmo cmx cmxa o) \
24

25 26 27 28 29
# The files that should be installed (using ocamlfind).
FILES := \
  META \
  Makefile.preprocess \
  $(patsubst %,_build/%,$(TARGET)) \
30 31 32 33 34

# ------------------------------------------------------------------------------

# Rules.

POTTIER Francois's avatar
POTTIER Francois committed
35
.PHONY: all clean install uninstall reinstall
36

37
all:
POTTIER Francois's avatar
POTTIER Francois committed
38
	$(OCAMLBUILD) $(TARGET)
39 40 41

clean:
	rm -f *~
POTTIER Francois's avatar
POTTIER Francois committed
42
	$(OCAMLBUILD) -clean
43 44

install: all
45
	ocamlfind install $(PACKAGE) $(FILES)
46

47 48
# [make uninstall] attempts to uninstall, but succeeds even if uninstallation
# fails (probably because the package was not installed in the first place).
49
uninstall:
50
	ocamlfind remove $(PACKAGE) || true
POTTIER Francois's avatar
POTTIER Francois committed
51

52
reinstall: uninstall
POTTIER Francois's avatar
POTTIER Francois committed
53
	@ $(MAKE) install