Makefile 1.16 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
OCAMLBUILD := \
  ocamlbuild \
  -use-ocamlfind \
  -classic-display \
18
  -plugin-tag 'package(cppo_ocamlbuild)' \
19 20

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

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

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

# Rules.

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

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

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

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

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

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