-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (70 loc) · 2.16 KB
/
Makefile
File metadata and controls
84 lines (70 loc) · 2.16 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
# $Id$
BINDIR=/usr/local/bin
LIBDIR=/usr/local/lib
MANDIR=/usr/local/man/man1
OCAMLC=ocamlc
OCAMLOPT=ocamlopt
CAMLP5=camlp5r -I ext -I $(shell ocamlfind query camlp-streams) camlp_streams.cma
OBJS=cursor.cmo ledit.cmo go.cmo
INCLUDES= -I $(shell ocamlfind query camlp5) -I $(shell ocamlfind query camlp-streams)
OTHER_OBJS=unix.cma gramlib.cma camlp_streams.cma
OTHER_XOBJS=unix.cmxa gramlib.cmxa camlp_streams.cmxa
TARGET=ledit.out
MKDIR=mkdir -p
EXT=ext/pa_def.cmo ext/pa_local.cmo
CUSTOM=-custom
LEDIT_LIBDIR=$(shell $(OCAMLC) -where)/ledit
all: $(EXT) $(TARGET) ledit.1
all: ledit.cma
opt: ledit.cmxa
$(TARGET): $(OBJS)
$(OCAMLC) $(CUSTOM) $(INCLUDES) $(OTHER_OBJS) $(OBJS) -o $(TARGET)
$(TARGET:.out=.opt): $(OBJS:.cmo=.cmx)
$(OCAMLOPT) $(INCLUDES) $(OTHER_XOBJS) $(OBJS:.cmo=.cmx) -o $(TARGET:.out=.opt)
ledit.1: ledit.1.tpl go.ml
VERSION=`sed -n -e 's/^.* version = "\(.*\)".*$$/\1/p' go.ml`; \
sed s/LEDIT_VERSION/$$VERSION/ ledit.1.tpl > ledit.1
ledit.cma: cursor.cmo ledit.cmo
$(OCAMLC) -a -o $@ $^
ledit.cmxa: cursor.cmx ledit.cmx
$(OCAMLOPT) -a -o $@ $^
clean:
/bin/rm -f *.cm[iox] *.pp[oi] *.o ext/*.cm[io] *.bak $(TARGET) ledit.1
rm -f ledit.cma ledit.cmxa *.a
rm -f META
install:
-$(MKDIR) $(BINDIR) $(MANDIR)
-cp ledit.out $(BINDIR)/ledit
-cp ledit.1 $(MANDIR)/ledit.1
install-lib: META
-$(MKDIR) $(LEDIT_LIBDIR)
cp META $(LEDIT_LIBDIR)/
cp ledit.cma ledit.cmi cursor.cmi $(LEDIT_LIBDIR)/
if [ -f ledit.cmxa ] ; then cp ledit.cmxa ledit.a $(LEDIT_LIBDIR)/ ; fi
META: META.tpl
VERSION=`sed -n -e 's/^.* version = "\(.*\)".*$$/\1/p' go.ml`; \
sed s/LEDIT_VERSION/$$VERSION/ META.tpl > META
depend:
> .depend.new
for i in $(OBJS:.cmo=.ml); do \
$(CAMLP5) pr_depend.cmo $$i >> .depend.new; \
done
mv .depend .depend.old
mv .depend.new .depend
include .depend
ext/%.cmo: ext/%.ml
$(CAMLP5) -loc loc $< -o ext/$*.ppo
$(OCAMLC) $(INCLUDES) -c -impl ext/$*.ppo
rm -f ext/$*.ppo
%.cmo: %.ml
$(CAMLP5) $< -o $*.ppo
$(OCAMLC) $(INCLUDES) -c -impl $*.ppo
/bin/rm -f $*.ppo
%.cmx: %.ml
$(CAMLP5) $< -o $*.ppo
$(OCAMLOPT) $(INCLUDES) -c -impl $*.ppo
/bin/rm -f $*.ppo
%.cmi: %.mli
$(CAMLP5) $< -o $*.ppi
$(OCAMLC) $(INCLUDES) -c -intf $*.ppi
/bin/rm -f $*.ppi