Seems to work
[rops.git] / Makefile
blob9443fa333d0882b862263db018f218e80e64db91
1 #*********************************************************************#
2 # #
3 # Objective Caml #
4 # #
5 # Pierre Weis, projet Cristal, INRIA Rocquencourt #
6 # #
7 # Copyright 1998 Institut National de Recherche en Informatique et #
8 # en Automatique. Distributed only by permission. #
9 # #
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
23 # $touch .depend
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
29 # make
30 # To recompute dependancies between modules, type
31 # make depend
32 # To remove the executable and all the compiled files, type
33 # make clean
34 # To compile using the native code compiler
35 # make opt
37 ##################################################################
40 ##################################################################
42 # Advanced usage:
43 # ---------------
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:
47 # EXEC = 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
75 EXEC = irops
77 CAMLBIN=/usr/local/bin/
78 ########################## Advanced user's variables #####################
80 # The Caml compilers.
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
90 # For instance:
91 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
92 # $(WITHDBM)
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)
100 # CUSTOM=-custom
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)
126 opt : $(EXEC).opt
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)
141 $(EXEC): $(OBJS)
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
149 .ml.cmo:
150 $(CAMLC) -c $<
152 .mli.cmi:
153 $(CAMLC) -c $<
155 .ml.cmx:
156 $(CAMLOPT) -c $<
158 .mll.cmo:
159 $(CAMLLEX) $<
160 $(CAMLC) -c $*.ml
162 .mll.cmx:
163 $(CAMLLEX) $<
164 $(CAMLOPT) -c $*.ml
166 .mly.cmo:
167 $(CAMLYACC) $<
168 $(CAMLC) -c $*.mli
169 $(CAMLC) -c $*.ml
171 .mly.cmx:
172 $(CAMLYACC) $<
173 $(CAMLOPT) -c $*.mli
174 $(CAMLOPT) -c $*.ml
176 .mly.cmi:
177 $(CAMLYACC) $<
178 $(CAMLC) -c $*.mli
180 .mll.ml:
181 $(CAMLLEX) $<
183 .mly.ml:
184 $(CAMLYACC) $<
186 clean::
187 rm -f *.cm[iox] *~ .*~ #*#
188 rm -f $(EXEC)
189 rm -f $(EXEC).opt
191 .depend.input: Makefile
192 @echo -n '--Checking Ocaml input files: '
193 @(ls $(SMLIY) $(SMLIY:.ml=.mli) 2>/dev/null || true) \
194 > .depend.new
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)
199 depend: .depend
201 .depend:: $(SMLIY) .depend.input
202 @echo '--Re-building dependencies'
203 $(CAMLDEP) $(SMLIY) $(SMLIY:.ml=.mli) > .depend
205 include .depend