2
# sample Makefile for Objective Caml
3
# Copyright (C) 2001 Jean-Christophe FILLIATRE
5
# modified 10/26/2003 by Paul Pelzl, for the purpose of building Orpie
7
# This library is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Library General Public
9
# License version 2, as published by the Free Software Foundation.
11
# This library is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
# See the GNU Library General Public License version 2 for more details
16
# (enclosed in the file LGPL).
18
# where to install the binaries
20
exec_prefix=@exec_prefix@
21
BINDIR=$(DESTDIR)/@bindir@
23
# where to install the man page
24
MANDIR=$(DESTDIR)/@mandir@
26
# other variables set by ./configure
31
OCAMLBEST = @OCAMLBEST@
33
OCAMLYACC = @OCAMLYACC@
34
OCAMLVERSION = @OCAMLVERSION@
35
OCAMLWIN32 = @OCAMLWIN32@
38
CURSES_LIB = @CURSES_LIB@
41
INCLUDES = -I ./curses -I ./gsl -I ./units
42
BFLAGS = -pp camlp4o -g $(INCLUDES) -thread
43
OFLAGS = -pp camlp4o $(INCLUDES) -thread
44
BLFLAGS = -custom -cclib '$(CURSES_LIB) $(GSL_LIB) -lm'
45
OLFLAGS = -cclib '$(CURSES_LIB) $(GSL_LIB) -lm'
46
DEPFLAGS = -pp camlp4o
52
NAME2 = orpie-curses-keys
58
# bytecode and native-code compilation
59
######################################
61
CMO = big_int_str.cmo gsl_assist.cmo install.cmo operations.cmo utility.cmo rcfile.cmo \
62
version.cmo rpc_stack.cmo add.cmo sub.cmo mult.cmo div.cmo inv.cmo pow.cmo \
63
solvelin.cmo rpc_calc.cmo txtin_parser.cmo txtin_lexer.cmo interface.cmo interface_draw.cmo \
64
interface_main.cmo main.cmo
65
CMX = $(CMO:.cmo=.cmx)
66
CMA = nums.cma bigarray.cma str.cma unix.cma threads.cma
67
CMXA = $(CMA:.cma=.cmxa)
69
CURSES_CMO = curses/curses.cmo
70
CURSES_CMX = curses/curses.cmx
71
CURSES_COBJS = curses/ml_curses.o
72
CURSES_BOBJS = $(CURSES_CMO) $(CURSES_COBJS)
73
CURSES_OOBJS = $(CURSES_CMX) $(CURSES_COBJS)
75
GSL_CMO = gsl/gsl_error.cmo gsl/gsl_blas.cmo gsl/gsl_complex.cmo gsl/gsl_matrix.cmo gsl/gsl_matrix_complex.cmo \
76
gsl/gsl_vector.cmo gsl/gsl_vector_complex.cmo gsl/gsl_vector_flat.cmo gsl/gsl_matrix_flat.cmo \
77
gsl/gsl_vector_complex_flat.cmo gsl/gsl_matrix_complex_flat.cmo gsl/gsl_vectmat.cmo \
78
gsl/gsl_permut.cmo gsl/gsl_linalg.cmo gsl/gsl_fun.cmo
79
GSL_CMX = $(GSL_CMO:.cmo=.cmx)
80
GSL_COBJS = gsl/mlgsl_error.o gsl/mlgsl_blas.o gsl/mlgsl_blas_complex.o gsl/mlgsl_complex.o \
81
gsl/mlgsl_matrix_complex.o gsl/mlgsl_matrix_double.o gsl/mlgsl_vector_double.o gsl/mlgsl_permut.o \
82
gsl/mlgsl_linalg.o gsl/mlgsl_linalg_complex.o gsl/mlgsl_fun.o gsl/mlgsl_math.o gsl/mlgsl_sf.o
83
GSL_BOBJS = $(GSL_COBJS) $(GSL_CMO)
84
GSL_OOBJS = $(GSL_COBJS) $(GSL_CMX)
86
UNITS_CMO = units/units.cmo units/constants.cmo
87
UNITS_CMX = $(UNITS_CMO:.cmo=.cmx)
89
TEST_CMO = big_int_str.cmo gsl_assist.cmo install.cmo operations.cmo utility.cmo rcfile.cmo \
90
version.cmo rpc_stack.cmo add.cmo sub.cmo mult.cmo div.cmo inv.cmo pow.cmo \
91
solvelin.cmo rpc_calc.cmo txtin_parser.cmo txtin_lexer.cmo calc_test.cmo
92
TEST_CMX = $(TEST_CMO:.cmo=.cmx)
94
GENERATED = version.ml
96
# special case: generated parser depends on the .cmi file
97
txtin_parser.cmo: txtin_parser.ml txtin_parser.cmi
98
$(OCAMLC) -c $(BFLAGS) $<
100
txtin_parser.cmx: txtin_parser.ml txtin_parser.cmi
101
$(OCAMLOPT) -c $(OFLAGS) $<
103
byte: $(NAME).byte $(NAME2).byte
104
opt: $(NAME).opt $(NAME2).opt
105
static: $(NAME).static-opt $(NAME2).static-opt
107
$(NAME).byte: $(CURSES_BOBJS) $(GSL_BOBJS) $(UNITS_CMO) $(CMO)
108
$(OCAMLC) $(BFLAGS) $(BLFLAGS) -o $@ $(CURSES_BOBJS) $(CMA) $(GSL_BOBJS) $(UNITS_CMO) $(CMO)
110
$(NAME2).byte: $(CURSES_BOBJS) utility.cmo curses-keys.cmo
111
$(OCAMLC) $(BFLAGS) $(BLFLAGS) -o $@ $(CURSES_BOBJS) $(CMA) utility.cmo curses-keys.cmo
113
$(NAME).opt: $(CURSES_OOBJS) $(GSL_OOBJS) $(UNITS_CMX) $(CMX)
114
$(OCAMLOPT) $(OFLAGS) -o $@ $(CURSES_OOBJS) $(CMXA) $(GSL_OOBJS) $(UNITS_CMX) $(CMX) $(OLFLAGS)
116
$(NAME2).opt: $(CURSES_OOBJS) utility.cmx curses-keys.cmx
117
$(OCAMLOPT) $(OFLAGS) -o $@ $(CURSES_OOBJS) $(CMXA) utility.cmx curses-keys.cmx $(OLFLAGS)
119
# static build seems to require mashing all the C objects into a library
120
$(NAME).static-opt: $(UNITS_CMX) $(CMX) $(CURSES_OOBJS) $(GSL_OOBJS) my-static-libs
121
$(OCAMLOPT) $(OFLAGS) -I . -ccopt -static -cclib '-lmycurses -lmygsl $(CURSES_LIB) $(GSL_LIB) -lm' -o $@ $(CMXA) \
122
curses.cmx $(GSL_CMX) $(UNITS_CMX) $(CMX)
123
strip $(NAME).static-opt
125
$(NAME2).static-opt: $(CURSES_OOBJS) utility.cmx curses-keys.cmx my-static-libs
126
$(OCAMLOPT) $(OFLAGS) -I . -ccopt -static -cclib '-lmycurses $(CURSES_LIB) -lm' -o $@ $(CMXA) curses.cmx \
127
utility.cmx curses-keys.cmx
128
strip $(NAME2).static-opt
131
ar cr libmycurses.a curses/*.o
132
ar cr libmygsl.a gsl/*.o
134
# calculator testing program
135
test.opt: $(CURSES_OOBJS) $(GSL_OOBJS) $(UNITS_CMX) $(TEST_CMX)
136
$(OCAMLOPT) $(OFLAGS) -o $@ $(CURSES_OOBJS) $(CMXA) $(GSL_OOBJS) $(UNITS_CMX) $(TEST_CMX) $(OLFLAGS)
142
echo "let version = \""$(VERSION)"\"" > version.ml
143
echo "let date = \""`date`"\"" >> version.ml
151
if test "$(prefix)" = "/usr"; then \
152
mkdir -p $(DESTDIR)/etc; \
153
install -m 644 orpierc $(DESTDIR)/etc; \
155
mkdir -p $(DESTDIR)/$(prefix)/etc; \
156
install -m 644 orpierc $(DESTDIR)/$(prefix)/etc; \
158
install -m 644 -D doc/orpie.1 $(MANDIR)/man1/orpie.1
159
install -m 644 -D doc/orpie-curses-keys.1 $(MANDIR)/man1/orpie-curses-keys.1
160
install -m 644 -D doc/orpierc.5 $(MANDIR)/man5/orpierc.5
162
install: install-indep
163
install -m 755 -D $(NAME).$(OCAMLBEST) $(BINDIR)/$(NAME)$(EXE)
164
install -m 755 -D $(NAME2).$(OCAMLBEST) $(BINDIR)/$(NAME2)$(EXE)
166
install-byte: install-indep
167
install -m 755 -D $(NAME).byte $(BINDIR)/$(NAME)$(EXE)
168
install -m 755 -D $(NAME2).byte $(BINDIR)/$(NAME2)$(EXE)
170
install-opt: install-indep
171
install -m 755 -D $(NAME).opt $(BINDIR)/$(NAME)$(EXE)
172
install -m 755 -D $(NAME2).opt $(BINDIR)/$(NAME2)$(EXE)
174
install-static: install-indep
175
install -m 755 -D $(NAME).static-opt $(BINDIR)/$(NAME)$(EXE)
176
install -m 755 -D $(NAME2).static-opt $(BINDIR)/$(NAME2)$(EXE)
179
rm -f $(BINDIR)/$(NAME)$(EXE)
180
rm -f $(BINDIR)/$(NAME2)$(EXE)
181
if test "$(prefix)" = "/usr"; then\
182
rm -f /etc/orpierc; \
183
else rm -f $(DESTDIR)/$(prefix)/etc/orpierc; \
185
rm -f $(MANDIR)/man1/orpie.1
186
rm -f $(MANDIR)/man1/orpie-curses-keys.1
187
rm -f $(MANDIR)/man5/orpierc.5
197
gsl-opt: $(GSL_OOBJS)
198
gsl-byte: $(GSL_BOBJS)
200
GSL_INCLUDES = -I ./gsl
201
GSL_BFLAGS = -g $(GSL_INCLUDES) -thread
202
GSL_OFLAGS = $(GSL_INCLUDES) -thread
203
GSL_CFLAGS = -Wall -fPIC -DPIC
205
gsl/%.cmi : gsl/%.mli
206
$(OCAMLC) -c $(GSL_BFLAGS) $<
209
$(OCAMLC) -c $(GSL_BFLAGS) $<
212
$(OCAMLOPT) -c $(GSL_OFLAGS) $<
215
$(OCAMLOPT) -c $(GSL_OFLAGS) $<
218
cd gsl && $(OCAMLC) -ccopt "$(GSL_CFLAGS)" -c $*.c
222
curses-opt: $(CURSES_OOBJS)
223
curses-byte: $(CURSES_BOBJS)
225
CURSES_INCLUDES = -I ./curses
226
CURSES_BFLAGS = -g $(CURSES_INCLUDES) -thread
227
CURSES_OFLAGS = $(CURSES_INCLUDES) -thread
228
CURSES_CFLAGS = -Wall -fPIC -DPIC
230
curses/%.cmi : curses/%.mli
231
$(OCAMLC) -pp cpp -c $(CURSES_BFLAGS) $<
233
curses/%.cmo : curses/%.ml
234
$(OCAMLC) -pp cpp -c $(CURSES_BFLAGS) $<
236
curses/%.o : curses/%.ml
237
$(OCAMLOPT) -pp cpp -c $(CURSES_OFLAGS) $<
239
curses/%.cmx : curses/%.ml
240
$(OCAMLOPT) -pp cpp -c $(CURSES_OFLAGS) $<
242
curses/%.o : curses/%.c
243
cd curses && $(OCAMLC) -ccopt "$(CURSES_CFLAGS)" -c $*.c
247
gsl-opt: $(UNITS_CMX)
248
gsl-byte: $(UNITS_CMO)
250
UNITS_INCLUDES = -I ./units
251
UNITS_BFLAGS = -g $(UNITS_INCLUDES) -thread
252
UNITS_OFLAGS = $(UNITS_INCLUDES) -thread
254
units/%.cmi : units/%.mli
255
$(OCAMLC) -c $(UNITS_BFLAGS) $<
257
units/%.cmo : units/%.ml
258
$(OCAMLC) -c $(UNITS_BFLAGS) $<
260
units/%.o : units/%.ml
261
$(OCAMLOPT) -c $(UNITS_OFLAGS) $<
263
units/%.cmx : units/%.ml
264
$(OCAMLOPT) -c $(UNITS_OFLAGS) $<
267
# generic build rules for toplevel directory
269
$(OCAMLC) -c $(BFLAGS) $<
272
$(OCAMLC) -c $(BFLAGS) $<
275
$(OCAMLOPT) -c $(OFLAGS) $<
278
$(OCAMLOPT) -c $(OFLAGS) $<
295
find . -name "*.ml*" | sort -r | xargs \
296
etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
297
"--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
298
"--regex=/and[ \t]+\([^ \t]+\)/\1/" \
299
"--regex=/type[ \t]+\([^ \t]+\)/\1/" \
300
"--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
301
"--regex=/val[ \t]+\([^ \t]+\)/\1/" \
302
"--regex=/module[ \t]+\([^ \t]+\)/\1/"
308
otags -vi -o tags *.ml
311
# Makefile is rebuilt whenever Makefile.in or configure.in is modified
312
######################################################################
314
Makefile: Makefile.in config.status
317
config.status: configure
318
./config.status --recheck
320
configure: configure.in
327
rm -f *.cm[iox] *.o *.a *~ txtin*.ml txtin*.mli *.output
328
rm -f $(GENERATED) parser.output
329
rm -f $(NAME).byte $(NAME).opt $(NAME2).byte $(NAME2).opt $(NAME).static-opt $(NAME2).static-opt
330
rm -f *.aux *.log $(NAME).tex $(NAME).dvi $(NAME).ps
333
rm -f gsl/*.cm[iox] gsl/*.o *~
336
rm -f curses/*.cm[iox] curses/*.o *~
339
rm -f units/*.cm[iox] units/*.o *~
341
clean:: partly-clean gsl-clean curses-clean units-clean
343
dist-clean distclean:: clean
344
rm -f Makefile config.cache config.log config.status install.ml
351
$(MAKE) txtin_lexer.ml
352
$(MAKE) txtin_parser.ml
353
$(OCAMLDEP) -pp camlp4o $(INCLUDES) *.ml *.mli > depend
354
$(OCAMLDEP) -pp camlp4o $(INCLUDES) units/*.ml units/*.mli >> depend
355
$(OCAMLDEP) -pp cpp -I ./curses curses/*.ml curses/*.mli >> depend
356
$(OCAMLDEP) -I ./gsl gsl/*.ml gsl/*.mli >> depend
362
# arch-tag: DO_NOT_CHANGE_bdb62873-ffd0-4d79-819e-880467e18f28