Makefile 982 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
# ------------------------------------------------------------------------------

# Variables.

PACKAGE := \
  visitors

PLUGIN := \
  ppx_deriving_$(PACKAGE)

11 12 13 14
RUNTIME := \
  VisitorsRuntime

# Not sure whether all of the following files are really required.
POTTIER Francois's avatar
POTTIER Francois committed
15
TARGET := \
16 17
  $(patsubst %,$(PLUGIN).%,a cma cmxa cmxs) \
  $(patsubst %,$(RUNTIME).%,a cma cmi cmo cmx cmxa o) \
18

POTTIER Francois's avatar
POTTIER Francois committed
19 20
OCAMLBUILD := \
  ocamlbuild \
21 22 23 24 25 26 27
  -use-ocamlfind \
  -classic-display \

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

# Rules.

POTTIER Francois's avatar
POTTIER Francois committed
28
.PHONY: all clean install uninstall reinstall
29

30
all:
POTTIER Francois's avatar
POTTIER Francois committed
31
	$(OCAMLBUILD) $(TARGET)
32 33 34

clean:
	rm -f *~
POTTIER Francois's avatar
POTTIER Francois committed
35
	$(OCAMLBUILD) -clean
36 37

install: all
POTTIER Francois's avatar
POTTIER Francois committed
38
	ocamlfind install $(PACKAGE) META $(patsubst %,_build/%,$(TARGET))
39

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

45
reinstall: uninstall
POTTIER Francois's avatar
POTTIER Francois committed
46
	@ $(MAKE) install