Commit | Line | Data |
---|---|---|
34e49164 C |
1 | ############################################################################## |
2 | # Variables | |
3 | ############################################################################## | |
4 | TARGET=commons | |
5 | ||
6 | # note: if you add a file (a .mli or .ml), dont forget to redo a 'make depend' | |
7 | MYSRC=common.ml common_extra.ml \ | |
8 | interfaces.ml objet.ml \ | |
9 | ocollection.ml \ | |
10 | seti.ml \ | |
11 | oset.ml oassoc.ml osequence.ml ograph.ml \ | |
12 | oseti.ml oseth.ml osetb.ml osetpt.ml \ | |
13 | oassocb.ml oassoch.ml oassoc_buffer.ml oassocid.ml \ | |
14 | oarray.ml \ | |
15 | ograph2way.ml ograph_extended.ml \ | |
16 | ofullcommon.ml \ | |
485bce71 | 17 | glimpse.ml parser_combinators.ml |
34e49164 C |
18 | |
19 | # src from other authors, got from the web or caml hump | |
20 | SRC=ocamlextra/dumper.ml | |
21 | SRC+=ocamlextra/ANSITerminal.ml | |
22 | SRC+=ocamlextra/setb.ml ocamlextra/mapb.ml # defunctorized version of standard set/map | |
23 | SRC+=ocamlextra/setPt.ml | |
24 | SRC+=$(MYSRC) | |
25 | SRC+=ocamlextra/enum.ml ocamlextra/dynArray.ml | |
34e49164 C |
26 | SRC+=ocamlextra/suffix_tree.ml ocamlextra/suffix_tree_ext.ml |
27 | ||
28 | SYSLIBS=str.cma unix.cma | |
29 | ||
30 | INCLUDEDIRS=ocamlextra | |
31 | SUBDIR=ocamlextra | |
32 | ||
33 | #----------------------------------------------------------------------------- | |
34 | # Other common (thin wrapper) libraries | |
35 | #----------------------------------------------------------------------------- | |
36 | ||
37 | #gdbm | |
38 | MYGDBMSRC=oassocdbm.ml | |
39 | GDBMSYSLIBS=dbm.cma | |
40 | ||
41 | #berkeley db | |
42 | BDBINCLUDES=-I ../ocamlbdb | |
43 | MYBDBSRC=oassocbdb.ml | |
44 | BDBSYSLIBS=bdb.cma | |
45 | ||
46 | ||
47 | #ocamlgtk | |
48 | GUIINCLUDES=-I +lablgtk2 -I +lablgtksourceview -I ../ocamlgtk/src | |
49 | MYGUISRC=gui.ml | |
50 | GUISYSLIBS=lablgtk.cma lablgtksourceview.cma | |
51 | ||
52 | #pycaml | |
53 | PYINCLUDES=-I ../ocamlpython -I ../../ocamlpython | |
54 | MYPYSRC=python.ml | |
55 | PYSYSLIBS=python.cma | |
56 | ||
57 | #ocamlmpi | |
58 | MPIINCLUDES=-I ../ocamlmpi -I ../../ocamlmpi -I +ocamlmpi | |
59 | MYMPISRC=distribution.ml | |
60 | MPISYSLIBS=mpi.cma | |
61 | ||
34e49164 C |
62 | #----------------------------------------------------------------------------- |
63 | # Other stuff | |
64 | #----------------------------------------------------------------------------- | |
65 | ||
66 | #backtrace | |
67 | BACKTRACEINCLUDES=-I $(shell ocamlc -where) | |
68 | MYBACKTRACESRC=backtrace.ml | |
69 | ||
70 | ############################################################################## | |
71 | # Generic variables | |
72 | ############################################################################## | |
73 | ||
74 | INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA) | |
75 | ||
76 | ############################################################################## | |
77 | # Generic ocaml variables | |
78 | ############################################################################## | |
79 | ||
80 | # This flag can also be used in subdirectories so don't change its name here. | |
81 | # For profiling use: -p -inline 0 | |
82 | OPTFLAGS= | |
83 | #-thread | |
84 | ||
85 | # The OPTBIN variable is here to allow to use ocamlc.opt instead of | |
86 | # ocaml, when it is available, which speeds up compilation. So | |
87 | # if you want the fast version of the ocaml chain tools, set this var | |
88 | # or setenv it to ".opt" in your startup script. | |
89 | OPTBIN= #.opt | |
90 | ||
91 | OCAMLCFLAGS ?= -g -dtypes | |
92 | ||
93 | # The OCaml tools. | |
94 | OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
95 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
96 | OCAMLLEX = ocamllex$(OPTBIN) | |
97 | OCAMLYACC= ocamlyacc -v | |
98 | OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES) | |
99 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) | |
100 | ||
101 | # if need C code | |
102 | OCAMLMKLIB=ocamlmklib | |
103 | CC=gcc | |
104 | ||
105 | ############################################################################## | |
106 | # Top rules | |
107 | ############################################################################## | |
108 | LIB=$(TARGET).cma | |
109 | OPTLIB=$(LIB:.cma=.cmxa) | |
110 | ||
111 | OBJS = $(SRC:.ml=.cmo) | |
112 | OPTOBJS = $(SRC:.ml=.cmx) | |
113 | ||
114 | ||
115 | all: $(LIB) | |
116 | all.opt: $(OPTLIB) | |
117 | opt: all.opt | |
118 | top: $(TARGET).top | |
119 | ||
120 | $(LIB): $(OBJS) | |
121 | $(OCAMLC) -a -o $@ $^ | |
122 | ||
123 | $(OPTLIB): $(OPTOBJS) | |
124 | $(OCAMLOPT) -a -o $@ $^ | |
125 | ||
126 | $(TARGET).top: $(OBJS) | |
127 | $(OCAMLMKTOP) -o $@ $(SYSLIBS) $^ | |
128 | ||
129 | clean:: | |
130 | rm -f $(TARGET).top | |
131 | ||
132 | ############################################################################## | |
133 | # Other commons libs target | |
134 | ############################################################################## | |
135 | ||
136 | all_libs: gdbm bdb gui mpi backtrace | |
137 | ||
138 | gdbm: commons_gdbm.cma | |
139 | gdbm.opt: commons_gdbm.cmxa | |
140 | ||
141 | commons_gdbm.cma: $(MYGDBMSRC:.ml=.cmo) | |
142 | $(OCAMLC) -a -o $@ $^ | |
143 | ||
144 | commons_gdbm.cmxa: $(MYGDBMSRC:.ml=.cmx) | |
145 | $(OCAMLOPT) -a -o $@ $^ | |
146 | ||
147 | ||
148 | bdb: | |
149 | $(MAKE) INCLUDESEXTRA="$(BDBINCLUDES)" commons_bdb.cma | |
150 | bdb.opt: | |
151 | $(MAKE) INCLUDESEXTRA="$(BDBINCLUDES)" commons_bdb.cmxa | |
152 | ||
153 | commons_bdb.cma: $(MYBDBSRC:.ml=.cmo) | |
154 | $(OCAMLC) -a -o $@ $^ | |
155 | ||
156 | commons_bdb.cmxa: $(MYBDBSRC:.ml=.cmx) | |
157 | $(OCAMLOPT) -a -o $@ $^ | |
158 | ||
159 | ||
160 | ||
161 | gui: | |
162 | $(MAKE) INCLUDESEXTRA="$(GUIINCLUDES)" commons_gui.cma | |
163 | gui.opt: | |
164 | $(MAKE) INCLUDESEXTRA="$(GUIINCLUDES)" commons_gui.cmxa | |
165 | ||
166 | commons_gui.cma: $(MYGUISRC:.ml=.cmo) | |
167 | $(OCAMLC) -a -o $@ $^ | |
168 | ||
169 | commons_gui.cmxa: $(MYGUISRC:.ml=.cmx) | |
170 | $(OCAMLOPT) -a -o $@ $^ | |
171 | ||
172 | ||
173 | ||
174 | mpi: | |
175 | $(MAKE) INCLUDESEXTRA="$(MPIINCLUDES)" commons_mpi.cma | |
176 | mpi.opt: | |
177 | $(MAKE) INCLUDESEXTRA="$(MPIINCLUDES)" commons_mpi.cmxa | |
178 | ||
179 | commons_mpi.cma: $(MYMPISRC:.ml=.cmo) | |
180 | $(OCAMLC) -a -o $@ $^ | |
181 | ||
182 | commons_mpi.cmxa: $(MYMPISRC:.ml=.cmx) | |
183 | $(OCAMLOPT) -a -o $@ $^ | |
184 | ||
185 | #alias | |
186 | distribution: mpi | |
187 | distribution.opt: mpi.opt | |
188 | ||
189 | ||
190 | ||
191 | python: | |
192 | $(MAKE) INCLUDESEXTRA="$(PYINCLUDES)" commons_python.cma | |
193 | python.opt: | |
194 | $(MAKE) INCLUDESEXTRA="$(PYINCLUDES)" commons_python.cmxa | |
195 | ||
196 | ||
197 | commons_python.cma: $(MYPYSRC:.ml=.cmo) | |
198 | $(OCAMLC) -a -o $@ $^ | |
199 | ||
200 | commons_python.cmxa: $(MYPYSRC:.ml=.cmx) | |
201 | $(OCAMLOPT) -a -o $@ $^ | |
202 | ||
203 | ||
204 | backtrace: commons_backtrace.cma | |
205 | backtrace.opt: commons_backtrace.cmxa | |
206 | ||
207 | backtrace_c.o: backtrace_c.c | |
208 | $(CC) $(BACKTRACEINCLUDES) -c $^ | |
209 | ||
210 | commons_backtrace.cma: $(MYBACKTRACESRC:.ml=.cmo) backtrace_c.o | |
211 | $(OCAMLMKLIB) -o commons_backtrace $^ | |
212 | ||
213 | commons_backtrace.cmxa: $(MYBACKTRACESRC:.ml=.cmx) backtrace_c.o | |
214 | $(OCAMLMKLIB) -o commons_backtrace $^ | |
215 | ||
216 | clean:: | |
217 | rm -f dllcommons_backtrace.so | |
218 | ||
219 | ||
220 | ############################################################################## | |
221 | # Developer rules | |
222 | ############################################################################## | |
223 | ||
224 | tags: | |
225 | otags -no-mli-tags -r . | |
226 | ||
227 | clean:: | |
228 | rm -f gmon.out | |
229 | ||
230 | forprofiling: | |
231 | $(MAKE) OPTFLAGS="-p -inline 0 " opt | |
232 | ||
233 | dependencygraph: | |
234 | ocamldep *.mli *.ml > /tmp/dependfull.depend | |
235 | ocamldot -fullgraph /tmp/dependfull.depend > /tmp/dependfull.dot | |
236 | dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps | |
237 | ||
238 | dependencygraph2: | |
239 | find -name "*.ml" |grep -v "scripts" | xargs ocamldep -I commons -I globals -I ctl -I parsing_cocci -I parsing_c -I engine -I popl -I extra > /tmp/dependfull.depend | |
240 | ocamldot -fullgraph /tmp/dependfull.depend > /tmp/dependfull.dot | |
241 | dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps | |
242 | ||
243 | ||
244 | ############################################################################## | |
245 | # Generic rules | |
246 | ############################################################################## | |
247 | .SUFFIXES: | |
248 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
249 | ||
250 | .ml.cmo: | |
251 | $(OCAMLC) -c $< | |
252 | .mli.cmi: | |
253 | $(OCAMLC) -c $< | |
254 | .ml.cmx: | |
255 | $(OCAMLOPT) -c $< | |
256 | ||
257 | clean:: | |
258 | rm -f *.cm[iox] *.o *.a *.cma *.cmxa *.annot | |
259 | rm -f *~ .*~ #*# | |
260 | ||
261 | clean:: | |
262 | rm -f $(SUBDIR)/*.cm[iox] $(SUBDIR)/*.o $(SUBDIR)/*.a | |
263 | rm -f $(SUBDIR)/*.cma $(SUBDIR)/*.cmxa $(SUBDIR)/*.annot | |
264 | rm -f $(SUBDIR)/*~ $(SUBDIR)/.*~ #*# | |
265 | ||
266 | depend: | |
267 | $(OCAMLDEP) *.mli *.ml $(SUBDIR)/*.ml $(SUBDIR)/*.mli > .depend | |
268 | ||
269 | distclean:: | |
270 | rm -f .depend | |
271 | ||
272 | -include .depend |