File: ocamlbuild.Makefile

package info (click to toggle)
mlpost 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,776 kB
  • sloc: ml: 17,440; makefile: 469
file content (217 lines) | stat: -rw-r--r-- 5,500 bytes parent folder | download | duplicates (4)
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
##########################################################################
#                                                                        #
#  Copyright (C) Johannes Kanig, Stephane Lescuyer                       #
#  Jean-Christophe Filliatre, Romain Bardou and Francois Bobot           #
#                                                                        #
#  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.1, 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.                  #
#                                                                        #
##########################################################################

TESTS = handbookgraphs.cmx othergraphs.cmx tests.cmx

ifeq "$(OCAMLBEST)" "opt"
TOOL= tool.native
else
TOOL= tool.byte
OBOPTS += -byte-plugin
endif

ifeq "$(TERM)" "dumb"
OCAMLBUILD_DISPLAY= -classic-display
else
OCAMLBUILD_DISPLAY=
endif

DTYPES = -tag dtypes

OCAMLBUILD := $(OCAMLBUILDBIN) $(OBOPTS) -no-links $(DTYPES) $(TAGS) $(OCAMLBUILD_DISPLAY) -classic-display -log "build.log"

BUILD := _build/

CMA := mlpost.cma mlpost_desc_options.cma mlpost_options.cma
CMXA := mlpost.cmxa mlpost_desc_options.cmxa mlpost_options.cmxa
OBJ := mlpost_desc_options$(LIBEXT) mlpost_options$(LIBEXT)

ifeq "$(OCAMLBEST)" "opt"
all:
	$(OCAMLBUILD) $(CMA) $(CMXA) $(TOOL)

lib:
	$(OCAMLBUILD) $(CMA) $(CMXA)

LIB_EXT=.cma .cmxa .cmi
else
all:
	$(OCAMLBUILD) $(CMA) $(TOOL)

lib:
	$(OCAMLBUILD) $(CMA)

LIB_EXT=.cma .cmi
endif

byte :
	$(OCAMLBUILD) $(CMA) tool.byte

opt :
	$(OCAMLBUILD) $(CMXA) tool.native

check: all $(TESTS) check-examples

tool.byte:
	$(OCAMLBUILD) tool.byte

tool.opt:
	$(OCAMLBUILD) tool.native

tests: tests.ml
	$(OCAMLBUILD) tests.native
	$(BUILD)/tests.native
	make -C test tests
	$(PSVIEWER) test/tests.ps

testbox: testbox.ml
	$(OCAMLBUILD) testbox.native
	$(BUILD)/testbox.native
	make -C test testbox
	$(PSVIEWER) test/testbox.ps

tests.pdf: tests.ml
	$(OCAMLBUILD) tests.native
	$(BUILD)/tests.native
	make -C test tests.pdf
	$(PDFVIEWER) test/tests.pdf


tests.byte: tests.ml
	$(OCAMLBUILD) tests.byte
	$(BUILD)/tests.byte
	make -C test tests
	$(PSVIEWER) test/tests.ps

handbook.pdf : handbookgraphs.ml
	$(OCAMLBUILD) handbookgraphs.native
	$(BUILD)/handbookgraphs.native
	make -C test manual
	make -C test/manual mpost

handbook: handbook.pdf
	$(PDFVIEWER) test/testmanual.pdf

handbook.byte: handbookgraphs.ml
	$(OCAMLBUILD) handbookgraphs.byte
	$(BUILD)/handbookgraphs.byte
	make -C test manual
	make -C test/manual mpost
	$(PSVIEWER) test/testmanual.ps

other.pdf: othergraphs.ml
	$(OCAMLBUILD) othergraphs.native
	$(BUILD)/othergraphs.native
	make -C test other
	make -C test/othergraphs mpost

other: other.pdf
	$(PDFVIEWER) test/othergraphs.pdf

other.byte: othergraphs.ml
	$(OCAMLBUILD) othergraphs.byte
	$(BUILD)/othergraphs.byte
	make -C test other
	make -C test/othergraphs mpost
	$(PSVIEWER) test/othergraphs.ps

.PHONY: check-examples examples
SUBDIRMLPOST:=../$(BUILD)tool.native -libdir ../$(BUILD) -v -ps -native
MAKEEXAMPLES=$(MAKE) -C examples MLPOST='$(SUBDIRMLPOST)'

check-examples: mlpost.cma tool.opt
	$(MAKEEXAMPLES) boxes.dummy
	$(MAKEEXAMPLES) paths.dummy
	$(MAKEEXAMPLES) tree.dummy
	$(MAKEEXAMPLES) label.dummy
	make -C multi-examples

examples: tool.opt
	$(MAKEEXAMPLES)

examples-contrib: tool.opt
	$(MAKEEXAMPLES) contrib

examples-html: tool.opt
	$(MAKEEXAMPLES) html

# Contrib
contrib: dot-contrib lablgtk-contrib

dot-contrib : lib
	@echo "make: Entering directory \`$(shell pwd)/contrib/dot'"
	cd contrib/dot && $(OCAMLBUILDBIN) -tag dtypes -cflags -I,$(shell pwd)/_build $(addprefix mlpost_dot,$(LIB_EXT)) && cd ../..
	ln -sf contrib/dot/_build _build_dot

ifeq "$(LABLGTK2)$(CAIROLABLGTK2)$(USEOCAMLFIND)" "yesyesyes"
lablgtk-contrib : lib
	@echo "make: Entering directory \`$(shell pwd)/contrib/lablgtk'"
	cd contrib/lablgtk && $(OCAMLBUILDBIN) -tag dtypes -cflags -I,$(shell pwd)/_build \
		-cflags -I,$(LABLGTK2LIB) \
		-cflags -I,$(CAIROLABLGTK2LIB) \
		$(addprefix mlpost_lablgtk,$(LIB_EXT)) && cd ../..
	ln -sf contrib/lablgtk/_build _build_lablgtk

else

lablgtk-contrib :
	@echo "lablgtk2 or cairo.lablgtk2 hasn't been found I can't make mlpost_lablgtk"
endif

clean-contrib:
	cd contrib/dot && $(OCAMLBUILDBIN) -clean && cd ../..
	cd contrib/lablgtk && $(OCAMLBUILDBIN) -clean && cd ../..

# GUI

.PHONY: gui gui/gmlpost.native gui/glexer.cmo gui/glexer.cmi

gui: gui/gmlpost.native gui/glexer.cmo

gui/gmlpost.native:
	$(OCAMLBUILD) gui/gmlpost.native

gui/gmlpost.byte:
	$(OCAMLBUILD) gui/gmlpost.byte

gui/glexer.cmo:
	$(OCAMLBUILD) gui/glexer.cmo

# building the doc
##################

.PHONY: doc
doc:
	rm -f doc
	$(OCAMLBUILD) doc/index.html
	ln -s _build/doc doc

# clean
#######

clean::
	rm -rf doc
	rm -f test.dvi test.ps *.exe
	$(OCAMLBUILD) -clean

cleaner:: clean
	make -C test clean
	make -C multi-examples clean
	make -C www clean
	make -C examples clean

dist-clean distclean:: clean
	rm -f Makefile config.cache config.log config.status META version.ml myocamlbuild.ml simple.Makefile