-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
386 lines (285 loc) · 9.42 KB
/
Makefile.in
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
##########################################################################
# #
# Ocamlgraph: a generic graph library for OCaml #
# Copyright (C) 2004-2007 #
# Sylvain Conchon, Jean-Christophe Filliatre and Julien Signoles #
# #
# This software is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Library General Public #
# License version 2, with the special exception on linking #
# described in file LICENSE. #
# #
# This software is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# #
##########################################################################
# Where to install the binaries
prefix=@prefix@
exec_prefix=@exec_prefix@
BINDIR=@bindir@
# Where to install the man page
MANDIR=@mandir@
# Other variables set by ./configure
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLDEP = @OCAMLDEP@
OCAMLDOC = @OCAMLDOC@
OCAMLLEX = @OCAMLLEX@
OCAMLYACC= @OCAMLYACC@
OCAMLLIB = @OCAMLLIB@
OCAMLBEST= @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
OCAMLWEB = @OCAMLWEB@
OCAMLWIN32 = @OCAMLWIN32@
OCAMLFIND = @OCAMLFIND@
EXE = @EXE@
LIBEXT = @LIBEXT@
OBJEXT = @OBJEXT@
# Others global variables
SRCDIR = src
LIBDIR = lib
INCLUDES= -I $(SRCDIR) -I $(LIBDIR)
BFLAGS = $(INCLUDES)
OFLAGS = $(INCLUDES) @FORPACK@
# main target
#############
NAME=ocamlgraph
all: byte $(OCAMLBEST)
#all: byte $(OCAMLBEST) editor-@LABLGTK2@
# bytecode and native-code compilation
######################################
LIB= unionfind heap bitv
LIB:=$(patsubst %, $(LIBDIR)/%.cmo, $(LIB))
CMO = util blocks persistent imperative \
delaunay builder classic rand oper \
gpath traverse gcoloring topological components kruskal flow \
graphviz gml dot_parser dot_lexer dot pack \
gmap minsep cliquetree mcs_m md strat
CMO := $(LIB) $(patsubst %, $(SRCDIR)/%.cmo, $(CMO))
CMX = $(CMO:.cmo=.cmx)
CMA = graph.cma
CMXA = graph.cmxa
CMI = sig dot_ast sig_pack
CMI := $(patsubst %, src/%.cmi, $(CMI))
GENERATED = META \
src/gml.ml src/version.ml \
src/dot_parser.ml src/dot_parser.mli src/dot_lexer.ml
byte: $(CMA)
opt: $(CMXA)
graph.cma: graph.cmo
$(OCAMLC) $(INCLUDES) -a -o $@ $^
graph.cmxa: graph.cmx
$(OCAMLOPT) $(INCLUDES) -a -o $@ $^
graph.cmo: $(CMI) $(CMO)
$(OCAMLC) $(INCLUDES) -pack -o $@ $^
graph.cmx: $(CMI) $(CMX)
$(OCAMLOPT) $(INCLUDES) -pack -o $@ $^
EXAMPLESBIN=bin/demo.$(OCAMLBEST) bin/demo_planar.$(OCAMLBEST) \
bin/bench.$(OCAMLBEST) bin/color.$(OCAMLBEST) bin/sudoku.$(OCAMLBEST) \
bin/test.$(OCAMLBEST)
.PHONY: examples
examples: $(EXAMPLESBIN)
.PHONY: demo
demo: bin/demo.$(OCAMLBEST)
bin/demo.byte: $(CMA) examples/demo.cmo
$(OCAMLC) -o $@ $^
bin/demo.opt: $(CMXA) examples/demo.cmx
$(OCAMLOPT) -o $@ $^
bin/demo_planar.byte: $(CMA) examples/demo_planar.cmo
$(OCAMLC) -o $@ graphics.cma unix.cma $^
bin/demo_planar.opt: $(CMXA) examples/demo_planar.cmx
$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^
bin/color.byte: $(CMA) examples/color.cmo
$(OCAMLC) -o $@ graphics.cma unix.cma $^
bin/color.opt: $(CMXA) examples/color.cmx
$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^
bin/sudoku.byte: $(CMA) examples/sudoku.cmo
$(OCAMLC) -o $@ graphics.cma unix.cma $^
bin/sudoku.opt: $(CMXA) examples/sudoku.cmx
$(OCAMLOPT) -o $@ graphics.cmxa unix.cmxa $^
test: $(CMA) tests/test.ml
ocaml unix.cma graphics.cma $^
bin/test.byte: $(CMA) tests/test.cmo
$(OCAMLC) -g -unsafe -o $@ unix.cma graphics.cma $^
bin/test.opt: $(CMXA) tests/test.cmx
$(OCAMLOPT) -unsafe -inline 100 -o $@ unix.cmxa graphics.cmxa $^
bench: bin/bench.$(OCAMLBEST)
bin/bench.opt
bin/bench.opt: $(CMXA) tests/bench.ml
$(OCAMLOPT) -unsafe -inline 100 -o $@ unix.cmxa $^
check: $(CMA) tests/check.ml
ocaml $^
# gtk2 graph editor
ED_DIR=editor
editor-no:
editor-yes: $(ED_DIR)/editor.$(OCAMLBEST)
editor: $(ED_DIR)/editor.byte editor-yes
ED_CMO = ed_hyper ed_graph ed_draw ed_display ed_main
ED_CMO:= $(patsubst %, $(ED_DIR)/%.cmo, $(ED_CMO))
ED_CMX = $(ED_CMO:.cmo=.cmx)
ED_INCLUDES = @INCLUDEGTK2@ -I +threads -I $(ED_DIR)
$(ED_CMO): BFLAGS+= $(ED_INCLUDES)
$(ED_CMX): OFLAGS+= $(ED_INCLUDES)
$(ED_DIR)/editor.byte: $(CMA) $(ED_CMO)
$(OCAMLC) -g -o $@ @INCLUDEGTK2@ \
lablgtk.cma lablgnomecanvas.cma unix.cma $^
$(ED_DIR)/editor.opt: $(CMXA) $(ED_CMX)
$(OCAMLOPT) -o $@ @INCLUDEGTK2@ \
lablgtk.cmxa lablgnomecanvas.cmxa unix.cmxa $^
VERSION=0.99b
src/version.ml: Makefile
echo "let version = \""$(VERSION)"\"" > $@
echo "let date = \""`date`"\"" >> $@
META: META.in Makefile
sed -e s/VERSION/$(VERSION)/ -e s/CMA/$(CMA)/ -e s/CMXA/$(CMXA)/ \
[email protected] > $@
# Additional rules
##################
EXAMPLES = demo color demo_planar sudoku
EXAMPLES:= $(patsubst %, examples/%.ml, $(EXAMPLES))
TESTS = test check
TESTS := $(patsubst %, tests/%.ml, $(TESTS))
DPD_GRAPH_ML= $(TESTS) $(EXAMPLES)
$(DPD_GRAPH_ML:.ml=.cmo): $(CMA)
$(DPD_GRAPH_ML:.ml=.cmx): $(CMXA)
# installation
##############
install: install-$(OCAMLBEST) install-byte
install-byte:
cp -f graph.cmo graph.cmi $(CMA) "$(OCAMLLIB)"
install-opt: install-byte
cp -f graph$(LIBEXT) graph.cmx $(CMXA) "$(OCAMLLIB)"
install-findlib: META
ifdef OCAMLFIND
$(OCAMLFIND) install ocamlgraph META *.mli \
graph$(LIBEXT) graph.cmx graph.cmo graph.cmi $(CMA) $(CMXA)
endif
# documentation
###############
DOCFILES=$(NAME).ps $(NAME).html
NODOC = util blocks dot_parser dot_lexer
NODOC := $(patsubst %, $(SRCDIR)/%.cmo, $(NODOC))
DOC_CMO = $(filter-out $(NODOC) $(LIB), $(CMO))
DOC_SRC = $(CMI:.cmi=.mli) $(DOC_CMO:.cmo=.mli) $(DOC_CMO:.cmo=.ml)
.PHONY: doc
doc: $(DOC_CMO)
mkdir -p doc
rm -f doc/*
$(OCAMLDOC) -d doc -html $(INCLUDES) $(DOC_SRC)
# literate programming
$(NAME).tex: $(DOC_SRC)
$(OCAMLWEB) -o $@ $^
wc:
ocamlwc -p $(SRCDIRC)/*.mli $(SRCDIRC)/*.ml
# file headers
##############
headers:
headache -c misc/headache_config.txt -h misc/header.txt \
Makefile.in configure.in README \
$(LIBDIR)*.ml $(LIBDIR)*.ml[ily] \
$(SRCDIR)*.ml $(SRCDIR)*.ml[ily] \
$(ED_DIR)/*.ml $(ED_DIR)/*.mli \
# export
########
EXPORTDIR=$(NAME)-$(VERSION)
TAR=$(EXPORTDIR).tar
FTP = $$HOME/ftp/$(NAME)
WWW = $$HOME/WWW/$(NAME)
FILES = src/*.ml* lib/*.ml* Makefile.in configure configure.in META.in \
.depend editor/ed_*.ml* editor/Makefile \
editor/tests/*.dot editor/tests/*.gml \
examples/*.ml tests/*.ml \
.depend README FAQ CREDITS INSTALL COPYING LICENSE CHANGES
export: source export-doc export-web export-delaunay
source:
mkdir -p export
cd export; rm -rf $(EXPORTDIR)
mkdir -p export/$(EXPORTDIR)/bin
cp --parents $(FILES) export/$(EXPORTDIR)
cd export ; tar cf $(TAR) $(EXPORTDIR) ; gzip -f --best $(TAR)
cp export/$(TAR).gz $(FTP)
cp README FAQ CREDITS COPYING LICENSE CHANGES $(EXAMPLES) $(FTP)
www/version.prehtml: Makefile.in
echo "<#def version>$(VERSION)</#def>" > www/version.prehtml
export-web: www/version.prehtml
make -C www install
export-doc: $(DOC_CMO)
rm -f $(WWW)/doc/*
-$(OCAMLDOC) -d $(WWW)/doc -html $(INCLUDES) $(DOC_SRC)
MISCFTP = $(HOME)/WWW/ftp/ocaml/misc
DELAUNAY=delaunay.ml delaunay.mli
export-delaunay:
cd src; cp -f $(DELAUNAY) $(MISCFTP)
cd src; caml2html -d $(MISCFTP) $(DELAUNAY)
# generic rules
###############
.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html
.mli.cmi:
$(OCAMLC) -c $(BFLAGS) $<
.ml.cmo:
$(OCAMLC) -c $(BFLAGS) $<
.ml.o:
$(OCAMLOPT) -c $(OFLAGS) $<
.ml.cmx:
$(OCAMLOPT) -c $(OFLAGS) $<
.mll.ml:
$(OCAMLLEX) $<
.mly.ml:
$(OCAMLYACC) -v $<
.mly.mli:
$(OCAMLYACC) -v $<
.tex.dvi:
latex $< && latex $<
.dvi.ps:
dvips $< -o $@
.tex.html:
hevea $<
# Emacs tags
############
otags:
otags -r src editor
tags:
find . -name "*.ml*" | sort -r | xargs \
etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
"--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
"--regex=/and[ \t]+\([^ \t]+\)/\1/" \
"--regex=/type[ \t]+\([^ \t]+\)/\1/" \
"--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
"--regex=/val[ \t]+\([^ \t]+\)/\1/" \
"--regex=/module[ \t]+\([^ \t]+\)/\1/"
# Makefile is rebuilt whenever Makefile.in or configure.in is modified
######################################################################
Makefile: Makefile.in config.status
if test -e $@; then chmod a+w $@; fi
./config.status
chmod a-w $@
config.status: configure
./config.status --recheck
configure: configure.in
autoconf
# clean
#######
clean:
rm -f *~
for d in $(SRCDIR) $(LIBDIR) $(ED_DIR) tests examples; do \
rm -f $$d/*.cm[iox] $$d/*$(OBJEXT) $$d/*~; \
done
rm -f $(GENERATED) $(SRCDIR)/dot_parser.output
rm -f graph.*a graph$(LIBEXT) bin/$(NAME).byte bin/$(NAME).opt
rm -f *.haux *.aux *.log $(NAME).tex $(NAME).dvi $(DOCFILES)
rm -f $(EXAMPLESBIN)
dist-clean distclean:: clean
rm -f Makefile config.cache config.log config.status *.byte *.opt
svnclean svn-clean:: dist-clean
rm -f config.* configure configure.lineno
# depend
########
.PHONY: depend
.depend depend: $(GENERATED)
rm -f .depend
$(OCAMLDEP) $(INCLUDES) \
$(LIBDIR)/*.ml $(LIBDIR)/*.mli \
$(SRCDIR)/*.ml $(SRCDIR)/*.mli \
$(ED_DIR)/*.mli $(ED_DIR)/*.ml > .depend
include .depend