fd31cc972f0b07d2f7ee59ef864ec658f1254507
[bpt/coccinelle.git] / ocamlsexp / Makefile
1 ##############################################################################
2 # Variables
3 ##############################################################################
4
5 SRC= \
6 type.ml \
7 parser.ml \
8 lexer.ml \
9 pre_sexp.ml \
10 sexp_intf.ml \
11 sexp.ml \
12 path.ml \
13 conv.ml \
14 conv_error.ml
15 #SOURCES = \
16 # parser.mly \
17 # lexer.mll \
18 # sexp.mli path.mli conv.mli
19
20
21 TARGET=sexplib1
22 TARGETPACK=sexplib
23 #LIB_PACK_NAME = sexplib
24
25 ##############################################################################
26 # Generic variables
27 ##############################################################################
28
29 INCLUDES=
30 #-I +camlp4
31 SYSLIBS= str.cma unix.cma bigarray.cma num.cma
32 #INCDIRS = +camlp4
33 #pad: take care for bigarray otherwise get some caml_ba_get_1 error msg
34
35 ##############################################################################
36 #OCAMLFLAGS = -for-pack Sexplib
37
38 #PACKS = type-conv
39 #RESULT = sexplib
40
41 #TRASH = pa_sexp_conv.cmi pa_sexp_conv.cmo pa_sexp_conv.annot
42
43 #all: \
44 # pack-byte-code pack-native-code \
45 # sexplib.cma sexplib.cmxa \
46 # pa_sexp_conv.cmi pa_sexp_conv.cmo
47 #
48 #LIBINSTALL_FILES = \
49 # sexp.mli path.mli conv.mli \
50 # sexplib.cmi sexplib.cma sexplib.cmxa sexplib.a \
51 # pa_sexp_conv.cmi pa_sexp_conv.cmo
52 #
53 #install: libinstall
54 #uninstall: libuninstall
55 #
56 #clean:: clean-doc
57 #
58 #-include $(OCAMLMAKEFILE)
59
60 ##############################################################################
61
62 ##############################################################################
63 # Generic variables
64 ##############################################################################
65
66 #dont use -custom, it makes the bytecode unportable.
67 OCAMLCFLAGS= -g -dtypes # -w A
68 #-for-pack Sexplib
69
70 # This flag is also used in subdirectories so don't change its name here.
71 OPTFLAGS=
72
73
74 OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) $(SYSINCLUDES) -thread
75 OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) $(SYSINCLUDES) -thread
76 OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower
77 OCAMLYACC=ocamlyacc -v
78 OCAMLDEP=ocamldep $(INCLUDES)
79 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) -thread
80
81 #-ccopt -static
82 STATIC=
83
84
85 ##############################################################################
86 # Top rules
87 ##############################################################################
88
89 OBJS = $(SRC:.ml=.cmo)
90 OPTOBJS = $(SRC:.ml=.cmx)
91
92 all: $(TARGET).cma $(TARGETPACK).cmo
93 all.opt: $(TARGET).cmxa
94
95 $(TARGET).cma: $(OBJS)
96 $(OCAMLC) -a -o $(TARGET).cma $(OBJS)
97
98 $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
99 $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
100
101 $(TARGET).top: $(OBJS) $(LIBS)
102 $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS)
103
104 clean::
105 rm -f $(TARGET).top
106
107
108
109 $(TARGETPACK).cmo: $(OBJS)
110 $(OCAMLC) -pack -o $(TARGETPACK).cmo $(OBJS)
111
112 # special handling, fun that they use cpp whereas they claim camplp4 can do everything
113 pre_sexp.cmo: pre_sexp.ml
114 $(OCAMLC) -pp cpp -c $<
115
116 pre_sexp.cmx: pre_sexp.ml
117 $(OCAMLOPT) -pp cpp -c $<
118
119
120
121 lexer.ml: lexer.mll
122 $(OCAMLLEX) $<
123 clean::
124 rm -f lexer.ml
125 beforedepend:: lexer.ml
126
127
128 parser.ml parser.mli: parser.mly
129 $(OCAMLYACC) $<
130 clean::
131 rm -f parser.ml parser.mli parser.output
132 beforedepend:: parser.ml parser.mli
133
134
135
136 ##############################################################################
137 # Generic rules
138 ##############################################################################
139
140 .SUFFIXES: .ml .mli .cmo .cmi .cmx
141
142 .ml.cmo:
143 $(OCAMLC) -c $<
144 .mli.cmi:
145 $(OCAMLC) -c $<
146 .ml.cmx:
147 $(OCAMLOPT) -c $<
148
149 .ml.mldepend:
150 $(OCAMLC) -i $<
151
152 clean::
153 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
154 clean::
155 rm -f *~ .*~ gmon.out #*#
156
157 beforedepend::
158
159 # need also -pp cpp here
160 depend:: beforedepend
161 $(OCAMLDEP) -pp cpp *.mli *.ml > .depend
162
163 distclean: clean
164 rm -f .depend
165
166 -include .depend