Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / Makefile
blob395e50cadd6f3c281270953328cc7349c47c23c6
1 #########################################################################
2 # #
3 # Objective Caml #
4 # #
5 # Xavier Leroy, projet Cristal, INRIA Rocquencourt #
6 # #
7 # Copyright 1999 Institut National de Recherche en Informatique et #
8 # en Automatique. All rights reserved. This file is distributed #
9 # under the terms of the Q Public License version 1.0. #
10 # #
11 #########################################################################
13 # $Id$
15 # The main Makefile
17 include config/Makefile
18 include stdlib/StdlibModules
20 CAMLC=boot/ocamlrun boot/ocamlc -g -nostdlib -I boot
21 CAMLOPT=boot/ocamlrun ./ocamlopt -nostdlib -I stdlib
22 COMPFLAGS=-warn-error A $(INCLUDES)
23 LINKFLAGS=
25 CAMLYACC=boot/ocamlyacc
26 YACCFLAGS=-v
27 CAMLLEX=boot/ocamlrun boot/ocamllex
28 CAMLDEP=boot/ocamlrun tools/ocamldep
29 DEPFLAGS=$(INCLUDES)
30 CAMLRUN=byterun/ocamlrun
31 SHELL=/bin/sh
32 MKDIR=mkdir -p
34 INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver \
35 -I toplevel
37 UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
38 utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
39 utils/consistbl.cmo
41 OPTUTILS=$(UTILS)
43 PARSING=parsing/linenum.cmo parsing/location.cmo parsing/longident.cmo \
44 parsing/syntaxerr.cmo parsing/parser.cmo \
45 parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo
47 TYPING=typing/unused_var.cmo typing/ident.cmo typing/path.cmo \
48 typing/primitive.cmo typing/types.cmo \
49 typing/btype.cmo typing/oprint.cmo \
50 typing/subst.cmo typing/predef.cmo \
51 typing/datarepr.cmo typing/env.cmo \
52 typing/typedtree.cmo typing/ctype.cmo \
53 typing/printtyp.cmo typing/includeclass.cmo \
54 typing/mtype.cmo typing/includecore.cmo \
55 typing/includemod.cmo typing/parmatch.cmo \
56 typing/typetexp.cmo typing/stypes.cmo typing/typecore.cmo \
57 typing/typedecl.cmo typing/typeclass.cmo \
58 typing/typemod.cmo
60 COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
61 bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
62 bytecomp/translobj.cmo bytecomp/translcore.cmo \
63 bytecomp/translclass.cmo bytecomp/translmod.cmo \
64 bytecomp/simplif.cmo bytecomp/runtimedef.cmo
66 BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
67 bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
68 bytecomp/bytesections.cmo bytecomp/dll.cmo bytecomp/symtable.cmo \
69 bytecomp/bytelink.cmo bytecomp/bytelibrarian.cmo bytecomp/bytepackager.cmo
71 ASMCOMP=asmcomp/arch.cmo asmcomp/debuginfo.cmo \
72 asmcomp/cmm.cmo asmcomp/printcmm.cmo \
73 asmcomp/reg.cmo asmcomp/mach.cmo asmcomp/proc.cmo \
74 asmcomp/clambda.cmo asmcomp/compilenv.cmo \
75 asmcomp/closure.cmo asmcomp/cmmgen.cmo \
76 asmcomp/printmach.cmo asmcomp/selectgen.cmo asmcomp/selection.cmo \
77 asmcomp/comballoc.cmo asmcomp/liveness.cmo \
78 asmcomp/spill.cmo asmcomp/split.cmo \
79 asmcomp/interf.cmo asmcomp/coloring.cmo \
80 asmcomp/reloadgen.cmo asmcomp/reload.cmo \
81 asmcomp/printlinear.cmo asmcomp/linearize.cmo \
82 asmcomp/schedgen.cmo asmcomp/scheduling.cmo \
83 asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
84 asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo
86 DRIVER=driver/pparse.cmo driver/errors.cmo driver/compile.cmo \
87 driver/main_args.cmo driver/main.cmo
89 OPTDRIVER= driver/pparse.cmo driver/opterrors.cmo driver/optcompile.cmo \
90 driver/optmain.cmo
92 TOPLEVEL=driver/pparse.cmo driver/errors.cmo driver/compile.cmo \
93 toplevel/genprintval.cmo toplevel/toploop.cmo \
94 toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo
96 TOPLEVELLIB=toplevel/toplevellib.cma
97 TOPLEVELSTART=toplevel/topstart.cmo
99 COMPOBJS=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(DRIVER)
101 TOPLIB=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(TOPLEVEL)
103 TOPOBJS=$(TOPLEVELLIB) $(TOPLEVELSTART)
105 OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
107 EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
108 utils/config.cmo utils/clflags.cmo \
109 typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
110 typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
111 bytecomp/dll.cmo bytecomp/meta.cmo bytecomp/symtable.cmo toplevel/expunge.cmo
113 PERVASIVES=$(STDLIB_MODULES) outcometree topdirs toploop
115 # For users who don't read the INSTALL file
116 defaultentry:
117 @echo "Please refer to the installation instructions in file INSTALL."
118 @echo "If you've just unpacked the distribution, something like"
119 @echo " ./configure"
120 @echo " make world"
121 @echo " make opt"
122 @echo " make install"
123 @echo "should work. But see the file INSTALL for more details."
125 # Recompile the system using the bootstrap compiler
126 all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
127 otherlibraries ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc
129 # The compilation of ocaml will fail if the runtime has changed.
130 # Never mind, just do make bootstrap to reach fixpoint again.
132 # Compile everything the first time
133 world: coldstart all
135 # Compile also native code compiler and libraries, fast
136 world.opt: coldstart opt.opt
138 # Core bootstrapping cycle
139 coreboot:
140 # Save the original bootstrap compiler
141 $(MAKE) backup
142 # Promote the new compiler but keep the old runtime
143 # This compiler runs on boot/ocamlrun and produces bytecode for
144 # byterun/ocamlrun
145 $(MAKE) promote-cross
146 # Rebuild ocamlc and ocamllex (run on byterun/ocamlrun)
147 $(MAKE) partialclean
148 $(MAKE) ocamlc ocamllex ocamltools
149 # Rebuild the library (using byterun/ocamlrun ./ocamlc)
150 $(MAKE) library-cross
151 # Promote the new compiler and the new runtime
152 $(MAKE) promote
153 # Rebuild the core system
154 $(MAKE) partialclean
155 $(MAKE) core
156 # Check if fixpoint reached
157 $(MAKE) compare
159 # Bootstrap and rebuild the whole system.
160 bootstrap:
161 $(MAKE) coreboot
162 $(MAKE) all
163 $(MAKE) compare
165 LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
167 # Start up the system from the distribution compiler
168 coldstart:
169 cd byterun; $(MAKE) all
170 cp byterun/ocamlrun$(EXE) boot/ocamlrun$(EXE)
171 cd yacc; $(MAKE) all
172 cp yacc/ocamlyacc$(EXE) boot/ocamlyacc$(EXE)
173 cd stdlib; $(MAKE) COMPILER=../boot/ocamlc all
174 cd stdlib; cp $(LIBFILES) ../boot
175 if test -f boot/libcamlrun.a; then :; else \
176 ln -s ../byterun/libcamlrun.a boot/libcamlrun.a; fi
177 if test -d stdlib/caml; then :; else \
178 ln -s ../byterun stdlib/caml; fi
180 # Build the core system: the minimum needed to make depend and bootstrap
181 core : coldstart ocamlc ocamllex ocamlyacc ocamltools library
183 # Save the current bootstrap compiler
184 MAXSAVED=boot/Saved/Saved.prev/Saved.prev/Saved.prev/Saved.prev/Saved.prev
185 backup:
186 if test -d boot/Saved; then : ; else mkdir boot/Saved; fi
187 if test -d $(MAXSAVED); then rm -r $(MAXSAVED); else : ; fi
188 mv boot/Saved boot/Saved.prev
189 mkdir boot/Saved
190 mv boot/Saved.prev boot/Saved/Saved.prev
191 cp boot/ocamlrun$(EXE) boot/Saved
192 mv boot/ocamlc boot/ocamllex boot/ocamlyacc$(EXE) boot/ocamldep boot/Saved
193 cd boot; cp $(LIBFILES) Saved
195 # Promote the newly compiled system to the rank of cross compiler
196 # (Runs on the old runtime, produces code for the new runtime)
197 promote-cross:
198 cp ocamlc boot/ocamlc
199 cp lex/ocamllex boot/ocamllex
200 cp yacc/ocamlyacc$(EXE) boot/ocamlyacc$(EXE)
201 cp tools/ocamldep boot/ocamldep
202 cd stdlib; cp $(LIBFILES) ../boot
204 # Promote the newly compiled system to the rank of bootstrap compiler
205 # (Runs on the new runtime, produces code for the new runtime)
206 promote: promote-cross
207 cp byterun/ocamlrun$(EXE) boot/ocamlrun$(EXE)
209 # Restore the saved bootstrap compiler if a problem arises
210 restore:
211 mv boot/Saved/* boot
212 rmdir boot/Saved
213 mv boot/Saved.prev boot/Saved
215 # Check if fixpoint reached
216 compare:
217 @if cmp boot/ocamlc ocamlc && cmp boot/ocamllex lex/ocamllex && cmp boot/ocamldep tools/ocamldep; \
218 then echo "Fixpoint reached, bootstrap succeeded."; \
219 else echo "Fixpoint not reached, try one more bootstrapping cycle."; \
222 # Remove old bootstrap compilers
223 cleanboot:
224 rm -rf boot/Saved/Saved.prev/*
226 # Compile the native-code compiler
227 opt-core:runtimeopt ocamlopt libraryopt
228 opt: runtimeopt ocamlopt libraryopt otherlibrariesopt ocamlbuildlib.native
230 # Native-code versions of the tools
231 opt.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \
232 ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
233 ocamllex.opt ocamltoolsopt.opt ocamlbuild.native camlp4opt ocamldoc.opt
235 # Installation
236 install: FORCE
237 if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
238 if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
239 if test -d $(STUBLIBDIR); then : ; else $(MKDIR) $(STUBLIBDIR); fi
240 if test -d $(MANDIR)/man$(MANEXT); then : ; else $(MKDIR) $(MANDIR)/man$(MANEXT); fi
241 cd $(LIBDIR); rm -f dllbigarray.so dlllabltk.so dllnums.so \
242 dllthreads.so dllunix.so dllgraphics.so dllmldbm.so dllstr.so \
243 dlltkanim.so
244 cd byterun; $(MAKE) install
245 cp ocamlc $(BINDIR)/ocamlc$(EXE)
246 cp ocaml $(BINDIR)/ocaml$(EXE)
247 cd stdlib; $(MAKE) install
248 cp lex/ocamllex $(BINDIR)/ocamllex$(EXE)
249 cp yacc/ocamlyacc$(EXE) $(BINDIR)/ocamlyacc$(EXE)
250 cp toplevel/toplevellib.cma $(LIBDIR)/toplevellib.cma
251 cp expunge $(LIBDIR)/expunge$(EXE)
252 cp typing/outcometree.cmi typing/outcometree.mli $(LIBDIR)
253 cp toplevel/topstart.cmo $(LIBDIR)
254 cp toplevel/toploop.cmi toplevel/topdirs.cmi toplevel/topmain.cmi $(LIBDIR)
255 cd tools; $(MAKE) install
256 -cd man; $(MAKE) install
257 for i in $(OTHERLIBRARIES); do \
258 (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \
259 done
260 cd ocamldoc; $(MAKE) install
261 if test -f ocamlopt; then $(MAKE) installopt; else :; fi
262 if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \
263 else :; fi
264 cp config/Makefile $(LIBDIR)/Makefile.config
265 BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) PREFIX=$(PREFIX) ./build/partial-install.sh
267 # Installation of the native-code compiler
268 installopt:
269 cd asmrun; $(MAKE) install
270 cp ocamlopt $(BINDIR)/ocamlopt$(EXE)
271 cd stdlib; $(MAKE) installopt
272 cd ocamldoc; $(MAKE) installopt
273 for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) installopt) || exit $$?; done
274 if test -f ocamlc.opt; \
275 then cp ocamlc.opt $(BINDIR)/ocamlc.opt$(EXE); else :; fi
276 if test -f ocamlopt.opt; \
277 then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt$(EXE); else :; fi
278 if test -f lex/ocamllex.opt; \
279 then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt$(EXE); else :; fi
281 clean:: partialclean
283 # The compiler
285 ocamlc: $(COMPOBJS)
286 $(CAMLC) $(LINKFLAGS) -o ocamlc $(COMPOBJS)
287 @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlc|' \
288 driver/ocamlcomp.sh.in > ocamlcomp.sh
289 @chmod +x ocamlcomp.sh
291 partialclean::
292 rm -f ocamlc ocamlcomp.sh
294 # The native-code compiler
296 ocamlopt: $(OPTOBJS)
297 $(CAMLC) $(LINKFLAGS) -o ocamlopt $(OPTOBJS)
298 @sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlopt|' \
299 driver/ocamlcomp.sh.in > ocamlcompopt.sh
300 @chmod +x ocamlcompopt.sh
302 partialclean::
303 rm -f ocamlopt ocamlcompopt.sh
305 # The toplevel
307 ocaml: $(TOPOBJS) expunge
308 $(CAMLC) $(LINKFLAGS) -linkall -o ocaml.tmp $(TOPOBJS)
309 - $(CAMLRUN) ./expunge ocaml.tmp ocaml $(PERVASIVES)
310 rm -f ocaml.tmp
312 toplevel/toplevellib.cma: $(TOPLIB)
313 $(CAMLC) -a -o $@ $(TOPLIB)
315 partialclean::
316 rm -f ocaml toplevel/toplevellib.cma
318 # The configuration file
320 utils/config.ml: utils/config.mlp config/Makefile
321 @rm -f utils/config.ml
322 sed -e 's|%%LIBDIR%%|$(LIBDIR)|' \
323 -e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \
324 -e 's|%%CCOMPTYPE%%|cc|' \
325 -e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)|' \
326 -e 's|%%BYTELINK%%|$(BYTECC) $(BYTECCLINKOPTS)|' \
327 -e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
328 -e 's|%%NATIVELINK%%|$(NATIVECC) $(NATIVECCLINKOPTS)|' \
329 -e 's|%%PARTIALLD%%|$(PARTIALLD) $(NATIVECCLINKOPTS)|' \
330 -e 's|%%PACKLD%%|$(PARTIALLD) $(NATIVECCLINKOPTS) -o |' \
331 -e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
332 -e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \
333 -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
334 -e 's|%%CC_PROFILE%%|$(CC_PROFILE)|' \
335 -e 's|%%ARCH%%|$(ARCH)|' \
336 -e 's|%%MODEL%%|$(MODEL)|' \
337 -e 's|%%SYSTEM%%|$(SYSTEM)|' \
338 -e 's|%%EXT_OBJ%%|.o|' \
339 -e 's|%%EXT_ASM%%|.s|' \
340 -e 's|%%EXT_LIB%%|.a|' \
341 -e 's|%%EXT_DLL%%|.so|' \
342 -e 's|%%SYSTHREAD_SUPPORT%%|$(SYSTHREAD_SUPPORT)|' \
343 utils/config.mlp > utils/config.ml
344 @chmod -w utils/config.ml
346 partialclean::
347 rm -f utils/config.ml
349 beforedepend:: utils/config.ml
351 # The parser
353 parsing/parser.mli parsing/parser.ml: parsing/parser.mly
354 $(CAMLYACC) $(YACCFLAGS) parsing/parser.mly
356 partialclean::
357 rm -f parsing/parser.mli parsing/parser.ml parsing/parser.output
359 beforedepend:: parsing/parser.mli parsing/parser.ml
361 # The lexer
363 parsing/lexer.ml: parsing/lexer.mll
364 $(CAMLLEX) parsing/lexer.mll
366 partialclean::
367 rm -f parsing/lexer.ml
369 beforedepend:: parsing/lexer.ml
371 # The auxiliary lexer for counting line numbers
373 parsing/linenum.ml: parsing/linenum.mll
374 $(CAMLLEX) parsing/linenum.mll
376 partialclean::
377 rm -f parsing/linenum.ml
379 beforedepend:: parsing/linenum.ml
381 # The bytecode compiler compiled with the native-code compiler
383 ocamlc.opt: $(COMPOBJS:.cmo=.cmx)
384 cd asmrun; $(MAKE) meta.o dynlink.o
385 $(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \
386 $(COMPOBJS:.cmo=.cmx) \
387 asmrun/meta.o asmrun/dynlink.o -cclib "$(BYTECCLIBS)"
388 @sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \
389 driver/ocamlcomp.sh.in > ocamlcomp.sh
390 @chmod +x ocamlcomp.sh
392 partialclean::
393 rm -f ocamlc.opt
395 # The native-code compiler compiled with itself
397 ocamlopt.opt: $(OPTOBJS:.cmo=.cmx)
398 $(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt $(OPTOBJS:.cmo=.cmx)
399 @sed -e 's|@compiler@|$$topdir/ocamlopt.opt|' \
400 driver/ocamlcomp.sh.in > ocamlcompopt.sh
401 @chmod +x ocamlcompopt.sh
403 partialclean::
404 rm -f ocamlopt.opt
406 $(OPTOBJS:.cmo=.cmx): ocamlopt
408 # The numeric opcodes
410 bytecomp/opcodes.ml: byterun/instruct.h
411 sed -n -e '/^enum/p' -e 's/,//g' -e '/^ /p' byterun/instruct.h | \
412 awk -f tools/make-opcodes > bytecomp/opcodes.ml
414 partialclean::
415 rm -f bytecomp/opcodes.ml
417 beforedepend:: bytecomp/opcodes.ml
419 # The predefined exceptions and primitives
421 byterun/primitives:
422 cd byterun; $(MAKE) primitives
424 bytecomp/runtimedef.ml: byterun/primitives byterun/fail.h
425 (echo 'let builtin_exceptions = [|'; \
426 sed -n -e 's|.*/\* \("[A-Za-z_]*"\) \*/$$| \1;|p' byterun/fail.h | \
427 sed -e '$$s/;$$//'; \
428 echo '|]'; \
429 echo 'let builtin_primitives = [|'; \
430 sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \
431 echo '|]') > bytecomp/runtimedef.ml
433 partialclean::
434 rm -f bytecomp/runtimedef.ml
436 beforedepend:: bytecomp/runtimedef.ml
438 # Choose the right machine-dependent files
440 asmcomp/arch.ml: asmcomp/$(ARCH)/arch.ml
441 ln -s $(ARCH)/arch.ml asmcomp/arch.ml
443 partialclean::
444 rm -f asmcomp/arch.ml
446 beforedepend:: asmcomp/arch.ml
448 asmcomp/proc.ml: asmcomp/$(ARCH)/proc.ml
449 ln -s $(ARCH)/proc.ml asmcomp/proc.ml
451 partialclean::
452 rm -f asmcomp/proc.ml
454 beforedepend:: asmcomp/proc.ml
456 asmcomp/selection.ml: asmcomp/$(ARCH)/selection.ml
457 ln -s $(ARCH)/selection.ml asmcomp/selection.ml
459 partialclean::
460 rm -f asmcomp/selection.ml
462 beforedepend:: asmcomp/selection.ml
464 asmcomp/reload.ml: asmcomp/$(ARCH)/reload.ml
465 ln -s $(ARCH)/reload.ml asmcomp/reload.ml
467 partialclean::
468 rm -f asmcomp/reload.ml
470 beforedepend:: asmcomp/reload.ml
472 asmcomp/scheduling.ml: asmcomp/$(ARCH)/scheduling.ml
473 ln -s $(ARCH)/scheduling.ml asmcomp/scheduling.ml
475 partialclean::
476 rm -f asmcomp/scheduling.ml
478 beforedepend:: asmcomp/scheduling.ml
480 # Preprocess the code emitters
482 asmcomp/emit.ml: asmcomp/$(ARCH)/emit.mlp tools/cvt_emit
483 $(CAMLRUN) tools/cvt_emit < asmcomp/$(ARCH)/emit.mlp > asmcomp/emit.ml \
484 || { rm -f asmcomp/emit.ml; exit 2; }
486 partialclean::
487 rm -f asmcomp/emit.ml
489 beforedepend:: asmcomp/emit.ml
491 tools/cvt_emit: tools/cvt_emit.mll
492 cd tools; \
493 $(MAKE) CAMLC="../$(CAMLRUN) ../boot/ocamlc -I ../stdlib" cvt_emit
495 # The "expunge" utility
497 expunge: $(EXPUNGEOBJS)
498 $(CAMLC) $(LINKFLAGS) -o expunge $(EXPUNGEOBJS)
500 partialclean::
501 rm -f expunge
503 # The runtime system for the bytecode compiler
505 runtime:
506 cd byterun; $(MAKE) all
507 if test -f stdlib/libcamlrun.a; then :; else \
508 ln -s ../byterun/libcamlrun.a stdlib/libcamlrun.a; fi
509 clean::
510 cd byterun; $(MAKE) clean
511 rm -f stdlib/libcamlrun.a
512 rm -f stdlib/caml
513 alldepend::
514 cd byterun; $(MAKE) depend
516 # The runtime system for the native-code compiler
518 runtimeopt:
519 cd asmrun; $(MAKE) all
520 if test -f stdlib/libasmrun.a; then :; else \
521 ln -s ../asmrun/libasmrun.a stdlib/libasmrun.a; fi
522 clean::
523 cd asmrun; $(MAKE) clean
524 rm -f stdlib/libasmrun.a
525 alldepend::
526 cd asmrun; $(MAKE) depend
528 # The library
530 library: ocamlc
531 cd stdlib; $(MAKE) all
532 library-cross:
533 cd stdlib; $(MAKE) RUNTIME=../byterun/ocamlrun all
534 libraryopt:
535 cd stdlib; $(MAKE) allopt
536 partialclean::
537 cd stdlib; $(MAKE) clean
538 alldepend::
539 cd stdlib; $(MAKE) depend
541 # The lexer and parser generators
543 ocamllex: ocamlyacc ocamlc
544 cd lex; $(MAKE) all
545 ocamllex.opt: ocamlopt
546 cd lex; $(MAKE) allopt
547 partialclean::
548 cd lex; $(MAKE) clean
549 alldepend::
550 cd lex; $(MAKE) depend
552 ocamlyacc:
553 cd yacc; $(MAKE) all
554 clean::
555 cd yacc; $(MAKE) clean
557 # Tools
559 ocamltools: ocamlc ocamlyacc ocamllex
560 cd tools; $(MAKE) all
561 ocamltoolsopt.opt: ocamlc.opt ocamlyacc ocamllex
562 cd tools; $(MAKE) opt.opt
563 partialclean::
564 cd tools; $(MAKE) clean
565 alldepend::
566 cd tools; $(MAKE) depend
568 # OCamldoc
570 ocamldoc: ocamlc ocamlyacc ocamllex
571 cd ocamldoc && $(MAKE) all
572 ocamldoc.opt: ocamlc.opt ocamlyacc ocamllex
573 cd ocamldoc && $(MAKE) opt.opt
574 partialclean::
575 cd ocamldoc && $(MAKE) clean
576 alldepend::
577 cd ocamldoc && $(MAKE) depend
579 # The extra libraries
581 otherlibraries:
582 for i in $(OTHERLIBRARIES); do \
583 (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $$?; \
584 done
585 otherlibrariesopt:
586 for i in $(OTHERLIBRARIES); do \
587 (cd otherlibs/$$i; $(MAKE) allopt) || exit $$?; \
588 done
589 partialclean::
590 for i in $(OTHERLIBRARIES); do \
591 (cd otherlibs/$$i; $(MAKE) partialclean); \
592 done
593 clean::
594 for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) clean); done
595 alldepend::
596 for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) depend); done
598 # The replay debugger
600 ocamldebugger: ocamlc ocamlyacc ocamllex
601 cd debugger; $(MAKE) all
602 partialclean::
603 cd debugger; $(MAKE) clean
604 alldepend::
605 cd debugger; $(MAKE) depend
607 # Camlp4
609 camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
610 ./build/camlp4-byte-only.sh
611 camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
612 ./build/camlp4-native-only.sh
614 # Ocamlbuild
616 ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
617 ./build/ocamlbuild-byte-only.sh
618 ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
619 ./build/ocamlbuild-native-only.sh
620 ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
621 ./build/ocamlbuildlib-native-only.sh
623 .PHONY: ocamlbuild-partial-boot
624 ocamlbuild-partial-boot:
625 ./build/partial-boot.sh
626 partialclean::
627 rm -rf _build
629 # Check that the stack limit is reasonable.
631 checkstack:
632 @if $(BYTECC) -o tools/checkstack tools/checkstack.c; \
633 then tools/checkstack; \
634 else :; \
636 @rm -f tools/checkstack
638 # Make MacOS X package
640 .PHONY: package-macosx
642 package-macosx:
643 sudo rm -rf package-macosx/root
644 make BINDIR="`pwd`"/package-macosx/root/bin \
645 LIBDIR="`pwd`"/package-macosx/root/lib/ocaml \
646 MANDIR="`pwd`"/package-macosx/root/man \
647 install
648 tools/make-package-macosx
649 sudo rm -rf package-macosx/root
651 clean::
652 rm -rf package-macosx/*.pkg package-macosx/*.dmg
654 # Default rules
656 .SUFFIXES: .ml .mli .cmo .cmi .cmx
658 .ml.cmo:
659 $(CAMLC) $(COMPFLAGS) -c $<
661 .mli.cmi:
662 $(CAMLC) $(COMPFLAGS) -c $<
664 .ml.cmx:
665 $(CAMLOPT) $(COMPFLAGS) -c $<
667 partialclean::
668 rm -f utils/*.cm[iox] utils/*.[so] utils/*~
669 rm -f parsing/*.cm[iox] parsing/*.[so] parsing/*~
670 rm -f typing/*.cm[iox] typing/*.[so] typing/*~
671 rm -f bytecomp/*.cm[iox] bytecomp/*.[so] bytecomp/*~
672 rm -f asmcomp/*.cm[iox] asmcomp/*.[so] asmcomp/*~
673 rm -f driver/*.cm[iox] driver/*.[so] driver/*~
674 rm -f toplevel/*.cm[iox] toplevel/*.[so] toplevel/*~
675 rm -f tools/*.cm[iox] tools/*.[so] tools/*~
676 rm -f *~
678 depend: beforedepend
679 (for d in utils parsing typing bytecomp asmcomp driver toplevel; \
680 do $(CAMLDEP) $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
681 done) > .depend
683 alldepend:: depend
685 FORCE:
687 include .depend