1 #*********************************************************************#
5 # Pierre Weis, projet Cristal, INRIA Rocquencourt #
7 # Copyright 1998 Institut National de Recherche en Informatique et #
8 # en Automatique. Distributed only by permission. #
10 #*********************************************************************#
12 # Modified by Didier Remy
15 # Generic Makefile for Objective Caml Programs
17 ############################ Documentation ######################
19 # To use this Makefile:
20 # -- You must fix the value of the variable SOURCES below.
21 # (The variable SOURCES is the list of your Caml source files.)
22 # -- You must create a file .depend, using
24 # (This file will contain the dependancies between your Caml modules,
25 # automatically computed by this Makefile.)
27 # Usage of this Makefile:
28 # To incrementally recompile the system, type
30 # To recompute dependancies between modules, type
32 # To remove the executable and all the compiled files, type
34 # To compile using the native code compiler
37 ##################################################################
40 ##################################################################
45 # If you want to fix the name of the executable, set the variable
46 # EXEC, for instance, if you want to obtain a program named my_prog:
49 # If you need special libraries provided with the Caml system,
50 # (graphics, arbitrary precision numbers, regular expression on strings, ...),
51 # you must set the variable LIBS to the proper set of libraries. For
52 # instance, to use the graphics library set LIBS to $(WITHGRAPHICS):
53 # LIBS=$(WITHGRAPHICS)
55 # You may use any of the following predefined variable
56 # WITHGRAPHICS : provides the graphics library
57 # WITHUNIX : provides the Unix interface library
58 # WITHSTR : provides the regular expression string manipulation library
59 # WITHNUMS : provides the arbitrary precision arithmetic package
60 # WITHTHREADS : provides the byte-code threads library
61 # WITHDBM : provides the Data Base Manager library
64 ########################## End of Documentation ####################
68 ########################## User's variables #####################
69 # The Caml sources (including camlyacc and camllex source files)
71 SOURCES
= types.ml parser.mly lexer.mll printer.ml environment.ml evaluator.ml main.ml
73 # The executable file to generate
77 CAMLBIN
=/usr
/local
/bin
/
78 ########################## Advanced user's variables #####################
81 # You may fix here the path to access the Caml compiler on your machine
82 # You may also have to add various -I options.
83 CAMLC
= $(CAMLBIN
)ocamlc
84 CAMLOPT
= $(CAMLBIN
)ocamlopt
85 CAMLDEP
= $(CAMLBIN
)ocamldep
86 CAMLLEX
= $(CAMLBIN
)ocamllex
87 CAMLYACC
= $(CAMLBIN
)ocamlyacc
89 # The list of Caml libraries needed by the program
91 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
94 # LIBS=$(WITHGRAPHICS)
96 # Should be set to -custom if you use any of the libraries above
97 # or if any C code have to be linked with your program
98 # (irrelevant for ocamlopt)
102 # Default setting of the WITH* variables. Should be changed if your
103 # local libraries are not found by the compiler.
104 WITHGRAPHICS
=graphics.cma
-cclib
-lgraphics
-cclib
-L
/usr
/X11R6
/lib
-cclib
-lX11
106 WITHUNIX
=unix.cma
-cclib
-lunix
108 WITHSTR
=str.cma
-cclib
-lstr
110 WITHNUMS
=nums.cma
-cclib
-lnums
112 WITHTHREADS
=threads.cma
-cclib
-lthreads
114 WITHDBM
=dbm.cma
-cclib
-lmldbm
-cclib
-lndbm
116 ################ End of user's variables #####################
119 ##############################################################
120 ################ This part should be generic
121 ################ Nothing to set up or fix here
122 ##############################################################
124 all:: .depend.input .depend
$(EXEC
)
128 #ocamlc -custom other options graphics.cma other files -cclib -lgraphics -cclib -lX11
129 #ocamlc -thread -custom other options threads.cma other files -cclib -lthreads
130 #ocamlc -custom other options str.cma other files -cclib -lstr
131 #ocamlc -custom other options nums.cma other files -cclib -lnums
132 #ocamlc -custom other options unix.cma other files -cclib -lunix
133 #ocamlc -custom other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
135 SMLIY
= $(SOURCES
:.mly
=.ml
)
136 SMLIYL
= $(SMLIY
:.mll
=.ml
)
137 SMLYL
= $(filter %.ml
,$(SMLIYL
))
138 OBJS
= $(SMLYL
:.ml
=.cmo
)
139 OPTOBJS
= $(OBJS
:.cmx
=.cmx
)
142 $(CAMLC
) $(CUSTOM
) -o
$(EXEC
) $(LIBS
) $(OBJS
)
144 # $(EXEC)-opt: $(OPTOBJS)
145 # $(CAMLOPT) -o $(EXEC) $(LIBS:.cma=.cmxa) $(OPTOBJS)
147 .SUFFIXES
: .ml .mli .cmo .cmi .cmx .mll .mly
187 rm -f
*.cm
[iox
] *~ .
*~
#*#
191 .depend.input
: Makefile
192 @echo
-n
'--Checking Ocaml input files: '
193 @
(ls
$(SMLIY
) $(SMLIY
:.ml
=.mli
) 2>/dev
/null || true
) \
195 @diff .depend.new .depend.input
2>/dev
/null
1>/dev
/null
&& \
196 (echo
'unchanged'; rm -f .depend.new
) || \
197 (echo
'changed'; mv .depend.new .depend.input
)
201 .depend
:: $(SMLIY
) .depend.input
202 @echo
'--Re-building dependencies'
203 $(CAMLDEP
) $(SMLIY
) $(SMLIY
:.ml
=.mli
) > .depend