diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-13 12:47:32 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-13 12:47:32 +0000 |
commit | fc5f00835c5cdd8f453ada784f63ab8d99d55014 (patch) | |
tree | 987baf4aeddd85266bab0ca9a370c0f068575752 /stdlib | |
parent | 3dce37c1963ca174eab9f03b9636170e1ecded6e (diff) |
Nettoyage des Makefiles, notamment la gestion des options de compilation specifiques a chaque fichier
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6396 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rwxr-xr-x | stdlib/Compflags | 26 | ||||
-rw-r--r-- | stdlib/Makefile | 98 | ||||
-rw-r--r-- | stdlib/Makefile.nt | 68 |
3 files changed, 78 insertions, 114 deletions
diff --git a/stdlib/Compflags b/stdlib/Compflags new file mode 100755 index 000000000..e263fbcf2 --- /dev/null +++ b/stdlib/Compflags @@ -0,0 +1,26 @@ +#!/bin/sh +######################################################################### +# # +# Objective Caml # +# # +# Xavier Leroy, projet Cristal, INRIA Rocquencourt # +# # +# Copyright 2004 Institut National de Recherche en Informatique et # +# en Automatique. All rights reserved. This file is distributed # +# under the terms of the GNU Library General Public License, with # +# the special exception on linking described in file ../LICENSE. # +# # +######################################################################### + +# $Id$ + +case $1 in + pervasives.cm[iox]|pervasives.p.cmx) echo '-nopervasives';; + camlinternalOO.cmi) echo '-nopervasives';; + camlinternalOO.cmx|camlinternalOO.p.cmx) echo '-inline 0';; + arrayLabels.cm[ox]|arrayLabels.p.cmx) echo '-nolabels';; + listLabels.cm[ox]|listLabels.p.cmx) echo '-nolabels';; + stringLabels.cm[ox]|stringLabels.p.cmx) echo '-nolabels';; + moreLabels.cm[ox]|moreLabels.p.cmx) echo '-nolabels';; + *) echo '';; +esac diff --git a/stdlib/Makefile b/stdlib/Makefile index 978102dd5..b9a7809a2 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -21,10 +21,12 @@ CAMLC=$(RUNTIME) $(COMPILER) COMPFLAGS=-warn-error A -nostdlib OPTCOMPILER=../ocamlopt CAMLOPT=$(RUNTIME) $(OPTCOMPILER) +CAMLOPTABOVE=../$(RUNTIME) ../$(OPTCOMPILER) OPTCOMPFLAGS=-warn-error A -nostdlib CAMLDEP=../boot/ocamlrun ../tools/ocamldep -BASIC=pervasives.cmo array.cmo list.cmo char.cmo string.cmo sys.cmo \ +OBJS=pervasives.cmo $(OTHERS) +OTHERS=array.cmo list.cmo char.cmo string.cmo sys.cmo \ hashtbl.cmo sort.cmo marshal.cmo obj.cmo \ int32.cmo int64.cmo nativeint.cmo \ lexing.cmo parsing.cmo \ @@ -33,11 +35,8 @@ BASIC=pervasives.cmo array.cmo list.cmo char.cmo string.cmo sys.cmo \ arg.cmo printexc.cmo gc.cmo \ digest.cmo random.cmo callback.cmo camlinternalOO.cmo oo.cmo \ genlex.cmo weak.cmo \ - lazy.cmo filename.cmo complex.cmo -LABELLED=arrayLabels.ml listLabels.ml stringLabels.ml moreLabels.ml - -OBJS=$(BASIC) labelled.cmo stdLabels.cmo -ALLOBJS=$(BASIC) $(LABELLED:.ml=.cmo) stdLabels.cmo + lazy.cmo filename.cmo complex.cmo \ + arrayLabels.cmo listLabels.cmo stringLabels.cmo moreLabels.cmo stdLabels.cmo all: stdlib.cma std_exit.cmo camlheader camlheader_ur @@ -46,6 +45,7 @@ allopt: stdlib.cmxa std_exit.cmx allopt-$(PROFILING) allopt-noprof: allopt-prof: stdlib.p.cmxa std_exit.p.cmx + rm -f std_exit.p.cmi install: cp stdlib.cma std_exit.cmo *.cmi *.mli *.ml camlheader camlheader_ur \ @@ -69,13 +69,13 @@ installopt-prof: cd $(LIBDIR); $(RANLIB) stdlib.p.a stdlib.cma: $(OBJS) - $(CAMLC) -a -o stdlib.cma $(ALLOBJS) + $(CAMLC) -a -o stdlib.cma $(OBJS) stdlib.cmxa: $(OBJS:.cmo=.cmx) - $(CAMLOPT) -a -o stdlib.cmxa $(ALLOBJS:.cmo=.cmx) + $(CAMLOPT) -a -o stdlib.cmxa $(OBJS:.cmo=.cmx) stdlib.p.cmxa: $(OBJS:.cmo=.p.cmx) - $(CAMLOPT) -a -o stdlib.p.cmxa $(ALLOBJS:.cmo=.p.cmx) + $(CAMLOPT) -a -o stdlib.p.cmxa $(OBJS:.cmo=.p.cmx) camlheader camlheader_ur: header.c ../config/Makefile if $(SHARPBANGSCRIPTS); then \ @@ -93,77 +93,33 @@ camlheader camlheader_ur: header.c ../config/Makefile clean:: rm -f camlheader camlheader_ur -pervasives.cmi: pervasives.mli - $(CAMLC) $(COMPFLAGS) -nopervasives -c pervasives.mli - -pervasives.cmo: pervasives.ml - $(CAMLC) $(COMPFLAGS) -nopervasives -c pervasives.ml - -pervasives.cmx: pervasives.ml - $(CAMLOPT) $(OPTCOMPFLAGS) -nopervasives -c pervasives.ml - -pervasives.p.cmx: pervasives.ml - @if test -f pervasives.cmx; \ - then mv pervasives.cmx pervasives.n.cmx; else :; fi - @if test -f pervasives.o; \ - then mv pervasives.o pervasives.n.o; else :; fi - $(CAMLOPT) $(OPTCOMPFLAGS) -p -nopervasives -c pervasives.ml - mv pervasives.cmx pervasives.p.cmx - mv pervasives.o pervasives.p.o - @if test -f pervasives.n.cmx; \ - then mv pervasives.n.cmx pervasives.cmx; else :; fi - @if test -f pervasives.n.o; \ - then mv pervasives.n.o pervasives.o; else :; fi - -# camlinternalOO.cmi must be compiled with -nopervasives for applets -camlinternalOO.cmi: camlinternalOO.mli - $(CAMLC) $(COMPFLAGS) -nopervasives -c camlinternalOO.mli - -# camlinternalOO.cmx should not be inlined -CIOO=camlinternalOO -$(CIOO).cmx $(CIOO).p.cmx: $(CIOO).ml - $(MAKE) CAMLOPT="$(CAMLOPT)" OPTCOMPFLAGS="$(OPTCOMPFLAGS)" \ - EXTRAFLAGS="-inline 0" CIOO=dummy $@ - -# labelled modules require the -nolabels flag -labelled.cmo: - $(MAKE) CAMLC="$(CAMLC)" COMPFLAGS="$(COMPFLAGS)" \ - EXTRAFLAGS=-nolabels $(LABELLED:.ml=.cmo) - touch $@ -labelled.cmx: - $(MAKE) CAMLOPT="$(CAMLOPT)" OPTCOMPFLAGS="$(OPTCOMPFLAGS)" \ - EXTRAFLAGS=-nolabels $(LABELLED:.ml=.cmx) - touch $@ -labelled.p.cmx: - $(MAKE) CAMLOPT="$(CAMLOPT)" OPTCOMPFLAGS="$(OPTCOMPFLAGS)" \ - EXTRAFLAGS=-nolabels $(LABELLED:.ml=.p.cmx) - touch $@ - .SUFFIXES: .mli .ml .cmi .cmo .cmx .p.cmx .mli.cmi: - $(CAMLC) $(COMPFLAGS) $(EXTRAFLAGS) -c $< + $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $< .ml.cmo: - $(CAMLC) $(COMPFLAGS) $(EXTRAFLAGS) -c $< + $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $< .ml.cmx: - $(CAMLOPT) $(OPTCOMPFLAGS) $(EXTRAFLAGS) -c $< + $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -c $< .ml.p.cmx: - @if test -f $*.cmx; then mv $*.cmx $*.n.cmx; else :; fi - @if test -f $*.o; then mv $*.o $*.n.o; else :; fi - $(CAMLOPT) $(OPTCOMPFLAGS) $(EXTRAFLAGS) -p -c $< - mv $*.cmx $*.p.cmx - mv $*.o $*.p.o - @if test -f $*.n.cmx; then mv $*.n.cmx $*.cmx; else :; fi - @if test -f $*.n.o; then mv $*.n.o $*.o; else :; fi - -$(ALLOBJS) labelled.cmo std_exit.cmo: pervasives.cmi $(COMPILER) -$(ALLOBJS:.cmo=.cmx) labelled.cmx std_exit.cmx: pervasives.cmi $(OPTCOMPILER) -$(ALLOBJS:.cmo=.p.cmx) labelled.p.cmx std_exit.p.cmx: pervasives.cmi $(OPTCOMPILER) -$(ALLOBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) -labelled.cmo labelled.cmx labelled.p.cmx: $(LABELLED) $(LABELLED:.ml=.mli) + $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -p -c -o $*.p.cmx $< + +# Dependencies on the compiler +$(OBJS) std_exit.cmo: $(COMPILER) +$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) +$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER) +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER) + +# Dependencies on Pervasives (not tracked by ocamldep) +$(OBJS) std_exit.cmo: pervasives.cmi +$(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi +$(OBJS:.cmo=.cmx) std_exit.cmx: pervasives.cmi +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmi +$(OTHERS:.cmo=.cmx) std_exit.cmx: pervasives.cmx +$(OTHERS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmx clean:: rm -f *.cm* *.o *.a diff --git a/stdlib/Makefile.nt b/stdlib/Makefile.nt index 140ae4b2d..f5304fc53 100644 --- a/stdlib/Makefile.nt +++ b/stdlib/Makefile.nt @@ -22,20 +22,18 @@ OPTCOMPILER=../ocamlopt CAMLOPT=$(RUNTIME) $(OPTCOMPILER) CAMLDEP=../boot/ocamlrun ../tools/ocamldep -BASIC=pervasives.cmo array.cmo list.cmo char.cmo string.cmo sys.cmo \ +OBJS=pervasives.cmo $(OTHERS) +OTHERS=array.cmo list.cmo char.cmo string.cmo sys.cmo \ hashtbl.cmo sort.cmo marshal.cmo obj.cmo \ int32.cmo int64.cmo nativeint.cmo \ lexing.cmo parsing.cmo \ set.cmo map.cmo stack.cmo queue.cmo stream.cmo buffer.cmo \ printf.cmo format.cmo scanf.cmo \ arg.cmo printexc.cmo gc.cmo \ - digest.cmo random.cmo camlinternalOO.cmo oo.cmo \ - genlex.cmo callback.cmo weak.cmo \ - lazy.cmo filename.cmo complex.cmo -LABELLED=arrayLabels.ml listLabels.ml stringLabels.ml moreLabels.ml - -OBJS=$(BASIC) labelled.cmo stdLabels.cmo -ALLOBJS=$(BASIC) $(LABELLED:.ml=.cmo) stdLabels.cmo + digest.cmo random.cmo callback.cmo camlinternalOO.cmo oo.cmo \ + genlex.cmo weak.cmo \ + lazy.cmo filename.cmo complex.cmo \ + arrayLabels.cmo listLabels.cmo stringLabels.cmo moreLabels.cmo stdLabels.cmo all: stdlib.cma std_exit.cmo camlheader camlheader_ur @@ -48,10 +46,10 @@ installopt: cp stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx $(LIBDIR) stdlib.cma: $(OBJS) - $(CAMLC) -a -o stdlib.cma $(ALLOBJS) + $(CAMLC) -a -o stdlib.cma $(OBJS) stdlib.cmxa: $(OBJS:.cmo=.cmx) - $(CAMLOPT) -a -o stdlib.cmxa $(ALLOBJS:.cmo=.cmx) + $(CAMLOPT) -a -o stdlib.cmxa $(OBJS:.cmo=.cmx) camlheader camlheader_ur: headernt.c ../config/Makefile $(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o camlheader.exe headernt.c @@ -61,46 +59,30 @@ camlheader camlheader_ur: headernt.c ../config/Makefile clean:: rm -f camlheader camlheader_ur -pervasives.cmi: pervasives.mli - $(CAMLC) $(COMPFLAGS) -nopervasives -c pervasives.mli - -pervasives.cmo: pervasives.ml - $(CAMLC) $(COMPFLAGS) -nopervasives -c pervasives.ml - -pervasives.cmx: pervasives.ml - $(CAMLOPT) $(COMPFLAGS) -nopervasives -c pervasives.ml - -# camlinternalOO.cmi must be compiled with -nopervasives for applets -camlinternalOO.cmi: camlinternalOO.mli - $(CAMLC) $(COMPFLAGS) -nopervasives -c camlinternalOO.mli - -# labelled modules require the -nolabels flag -labelled.cmo: - $(MAKEREC) EXTRAFLAGS=-nolabels RUNTIME=$(RUNTIME) COMPILER=$(COMPILER) $(LABELLED:.ml=.cmo) - touch $@ -labelled.cmx: - $(MAKEREC) EXTRAFLAGS=-nolabels $(LABELLED:.ml=.cmx) - touch $@ -labelled.p.cmx: - $(MAKEREC) EXTRAFLAGS=-nolabels $(LABELLED:.ml=.p.cmx) - touch $@ - -# generic rules .SUFFIXES: .mli .ml .cmi .cmo .cmx .mli.cmi: - $(CAMLC) $(COMPFLAGS) $(EXTRAFLAGS) -c $< + $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $< .ml.cmo: - $(CAMLC) $(COMPFLAGS) $(EXTRAFLAGS) -c $< + $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $< .ml.cmx: - $(CAMLOPT) $(COMPFLAGS) $(EXTRAFLAGS) -c $< - -$(ALLOBJS) labelled.cmo std_exit.cmo: pervasives.cmi $(COMPILER) -$(ALLOBJS:.cmo=.cmx) labelled.cmx std_exit.cmx: pervasives.cmi $(OPTCOMPILER) -$(ALLOBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) -labelled.cmo labelled.cmx: $(LABELLED) $(LABELLED:.ml=.mli) + $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -c $< + +# Dependencies on the compiler +$(OBJS) std_exit.cmo: $(COMPILER) +$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER) +$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER) +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER) + +# Dependencies on Pervasives (not tracked by ocamldep) +$(OBJS) std_exit.cmo: pervasives.cmi +$(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi +$(OBJS:.cmo=.cmx) std_exit.cmx: pervasives.cmi +$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmi +$(OTHERS:.cmo=.cmx) std_exit.cmx: pervasives.cmx +$(OTHERS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmx clean:: rm -f *.cm* *.$(O) *.$(A) |