-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (54 loc) · 1.37 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
69
70
71
PACKAGES = extlib,libMagick,xmlm
FILES = xmlm_shit.ml main.ml
NAME = gpxer
VERSION := $(shell head -n 1 VERSION)
CAMLC = ocamlfind ocamlc $(LIB)
CAMLOPT = ocamlfind ocamlopt $(LIB)
CAMLDEP = ocamlfind ocamldep
LIB = -package $(PACKAGES)
PP =
ifndef PREFIX
PREFIX=/usr/local
endif
OBJS = $(FILES:.ml=.cmo)
OPTOBJS = $(FILES:.ml=.cmx)
BYTE = bin/$(NAME)
OPT = bin/$(NAME).opt
STATIC = bin/$(NAME).static
all: $(BYTE) $(OPT)
static: $(STATIC)
$(BYTE): $(OBJS)
mkdir -p bin
$(CAMLC) -linkpkg -o $@ $^
$(OPT): $(OPTOBJS)
mkdir -p bin
$(CAMLOPT) -linkpkg -o $@ $^
$(STATIC): $(OPTOBJS)
mkdir -p bin
$(CAMLOPT) -linkpkg -noautolink -cclib '-Wl,-Bstatic -limagemagick_stubs -Wl,-Bdynamic -lMagickCore -lbigarray -lunix -lz' -o $@ $^
.SUFFIXES:
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) $(PP) -c $<
.mli.cmi:
$(CAMLC) -c $<
.ml.cmx:
$(CAMLOPT) $(PP) -c $<
install: $(BYTE) $(OPT)
install -m 755 $(BYTE) $(PREFIX)/$(BYTE)
install -m 755 $(OPT) $(PREFIX)/$(OPT)
install -d share/$(NAME) $(PREFIX)/share/$(NAME)
install -m 644 share/$(NAME)/* $(PREFIX)/share/$(NAME)
uninstall:
rm $(PREFIX)/$(BYTE)
rm $(PREFIX)/$(OPT)
rm -r $(PREFIX)/share/$(NAME)
clean:
-rm -f *.cm[ioxa] *.cmx[as] *.o *.a *~
-rm -f .depend
-rm -f $(BYTE) $(OPT) $(STATIC)
depend: .depend
.depend: $(FILES)
$(CAMLDEP) $(PP) $(LIB) $(FILES:.ml=.mli) $(FILES) > .depend
FORCE:
-include .depend