summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2007-10-30 17:53:06 +0000
committerAlain Frisch <alain@frisch.fr>2007-10-30 17:53:06 +0000
commit0097d6bd017f57c3cb3a9793e7d696cf718bd84d (patch)
tree794da870eeaabc50364d6a9cb0df936a8e11881d
parent597050a1f7b0e0ac75fd48a7078904b77507b603 (diff)
downloadocaml-0097d6bd017f57c3cb3a9793e7d696cf718bd84d.tar.gz
Merge common parts in Makefiles.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/natdynlink@8467 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Makefile.nt2
-rw-r--r--byterun/Makefile77
-rwxr-xr-xbyterun/Makefile.common90
-rw-r--r--byterun/Makefile.nt77
4 files changed, 105 insertions, 141 deletions
diff --git a/Makefile.nt b/Makefile.nt
index 49c36a2b0e..c60eee8732 100644
--- a/Makefile.nt
+++ b/Makefile.nt
@@ -217,8 +217,6 @@ installbyt:
mkdir -p $(BINDIR)
mkdir -p $(LIBDIR)
cd byterun ; $(MAKEREC) install
- echo "$(STUBLIBDIR)" > $(LIBDIR)/ld.conf
- echo "$(LIBDIR)" >> $(LIBDIR)/ld.conf
cp ocamlc $(BINDIR)/ocamlc.exe
cp ocaml $(BINDIR)/ocaml.exe
cd stdlib ; $(MAKEREC) install
diff --git a/byterun/Makefile b/byterun/Makefile
index 9196965e6d..0381aef10f 100644
--- a/byterun/Makefile
+++ b/byterun/Makefile
@@ -13,97 +13,30 @@
# $Id$
-include ../config/Makefile
+include Makefile.common
-CC=$(BYTECC)
CFLAGS=-DCAML_NAME_SPACE -O $(BYTECCCOMPOPTS) $(FLEXLINK)
DFLAGS=-DCAML_NAME_SPACE -g -DDEBUG $(BYTECCCOMPOPTS)
-OBJS=interp.o misc.o stacks.o fix_code.o startup.o main.o \
- freelist.o major_gc.o minor_gc.o memory.o alloc.o roots.o globroots.o \
- fail.o signals.o signals_byt.o printexc.o backtrace.o \
- compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
- hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
- lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
- dynlink.o unix.o
-
+OBJS=$(COMMONOBJS) unix.o main.o
DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
-PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
- intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
- signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
- dynlink.c
-
-PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
- memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
-
-all: ocamlrun$(EXE) ld.conf
-
ocamlrun$(EXE): libcamlrun.a prims.o
- $(call MKEXE,ocamlrun$(EXE),prims.o libcamlrun.a $(BYTECCLIBS), \
+ $(call MKEXE,ocamlrun$(EXE),main.o prims.o libcamlrun.a $(BYTECCLIBS), \
$(BYTECCCOMPOPTS) $(BYTECCLINKOPTS))
ocamlrund$(EXE): libcamlrund.a prims.o
$(BYTECC) -g $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o ocamlrund$(EXE) \
prims.o libcamlrund.a $(BYTECCLIBS)
-install:
- cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
- cp libcamlrun.a $(LIBDIR)/libcamlrun.a
- cd $(LIBDIR); $(RANLIB) libcamlrun.a
- if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
- for i in $(PUBLIC_INCLUDES); do \
- sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
- done
- cp ld.conf $(LIBDIR)/ld.conf
-
-ld.conf: ../config/Makefile
- echo "$(STUBLIBDIR)" >ld.conf
- echo "$(LIBDIR)" >>ld.conf
+libcamlrun.$(A): $(OBJS)
+ $(call MKLIB,libcamlrun.$(A),$(OBJS))
-libcamlrun.a: $(OBJS)
- ar rc libcamlrun.a $(OBJS)
- $(RANLIB) libcamlrun.a
libcamlrund.a: $(DOBJS)
ar rc libcamlrund.a $(DOBJS)
$(RANLIB) libcamlrund.a
-clean:
- rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.o lib*.a
- rm -f primitives prims.c opnames.h jumptbl.h ld.conf
- rm -f version.h
-
-primitives : $(PRIMS)
- sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
- $(PRIMS) > primitives
-
-prims.c : primitives
- (echo '#include "mlvalues.h"'; \
- echo '#include "prims.h"'; \
- sed -e 's/.*/extern value &();/' primitives; \
- echo 'c_primitive caml_builtin_cprim[] = {'; \
- sed -e 's/.*/ &,/' primitives; \
- echo ' 0 };'; \
- echo 'char * caml_names_of_builtin_cprim[] = {'; \
- sed -e 's/.*/ "&",/' primitives; \
- echo ' 0 };') > prims.c
-
-opnames.h : instruct.h
- sed -e '/\/\*/d' \
- -e '/^#/d' \
- -e 's/enum /char * names_of_/' \
- -e 's/{$$/[] = {/' \
- -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' instruct.h > opnames.h
-
-# jumptbl.h is required only if you have GCC 2.0 or later
-jumptbl.h : instruct.h
- sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
- -e '/^}/q' instruct.h > jumptbl.h
-
-version.h : ../VERSION
- echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" >version.h
-
.SUFFIXES: .d.o
.c.d.o:
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
new file mode 100755
index 0000000000..67d0fc162a
--- /dev/null
+++ b/byterun/Makefile.common
@@ -0,0 +1,90 @@
+#########################################################################
+# #
+# Objective Caml #
+# #
+# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
+# #
+# Copyright 1999 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$
+
+include ../config/Makefile
+
+CC=$(BYTECC)
+
+COMMONOBJS=\
+ interp.o misc.o stacks.o fix_code.o startup.o \
+ freelist.o major_gc.o minor_gc.o memory.o alloc.o roots.o globroots.o \
+ fail.o signals.o signals_byt.o printexc.o backtrace.o \
+ compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
+ hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
+ lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
+ dynlink.o
+
+PRIMS=\
+ alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
+ intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
+ signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
+ dynlink.c
+
+PUBLIC_INCLUDES=\
+ alloc.h callback.h config.h custom.h fail.h intext.h \
+ memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
+
+
+all: ocamlrun$(EXE) ld.conf libcamlrun.$(A)
+
+ld.conf: ../config/Makefile
+ echo "$(STUBLIBDIR)" >ld.conf
+ echo "$(LIBDIR)" >>ld.conf
+
+install:
+ cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
+ cp libcamlrun.$(A) $(LIBDIR)/libcamlrun.$(A)
+ cd $(LIBDIR); $(RANLIB) libcamlrun.$(A)
+ if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
+ for i in $(PUBLIC_INCLUDES); do \
+ sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
+ done
+ cp ld.conf $(LIBDIR)/ld.conf
+
+
+primitives : $(PRIMS)
+ sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
+ $(PRIMS) > primitives
+
+prims.c : primitives
+ (echo '#include "mlvalues.h"'; \
+ echo '#include "prims.h"'; \
+ sed -e 's/.*/extern value &();/' primitives; \
+ echo 'c_primitive caml_builtin_cprim[] = {'; \
+ sed -e 's/.*/ &,/' primitives; \
+ echo ' 0 };'; \
+ echo 'char * caml_names_of_builtin_cprim[] = {'; \
+ sed -e 's/.*/ "&",/' primitives; \
+ echo ' 0 };') > prims.c
+
+opnames.h : instruct.h
+ sed -e '/\/\*/d' \
+ -e '/^#/d' \
+ -e 's/enum /char * names_of_/' \
+ -e 's/{$$/[] = {/' \
+ -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' instruct.h > opnames.h
+
+# jumptbl.h is required only if you have GCC 2.0 or later
+jumptbl.h : instruct.h
+ sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
+ -e '/^}/q' instruct.h > jumptbl.h
+
+version.h : ../VERSION
+ echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" >version.h
+
+clean:
+ rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.$(O) *.$(A)
+ rm -f primitives prims.c opnames.h jumptbl.h ld.conf
+ rm -f version.h
diff --git a/byterun/Makefile.nt b/byterun/Makefile.nt
index 4016b269ac..ce1f693161 100644
--- a/byterun/Makefile.nt
+++ b/byterun/Makefile.nt
@@ -13,82 +13,25 @@
# $Id$
-include ../config/Makefile
+include Makefile.common
-CC=$(BYTECC)
CFLAGS=-DOCAML_STDLIB_DIR='"$(LIBDIR)"' $(FLEXLINK)
+DBGO=d.$(O)
+OBJS=$(COMMONOBJS:.o=.$(O)) win32.$(O)
+DOBJS=$(COMMONOBJS:.o=.$(DBGO)) win32.$(DBGO) prims.$(DBGO) instrtrace.$(DBGO)
-COMMONOBJS=interp.o misc.o stacks.o fix_code.o startup.o \
- fail.o signals.o signals_byt.o freelist.o major_gc.o minor_gc.o \
- memory.o alloc.o roots.o compare.o ints.o floats.o \
- str.o array.o io.o extern.o intern.o hash.o sys.o \
- meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o lexing.o \
- win32.o printexc.o callback.o debugger.o weak.o compact.o \
- finalise.o custom.o backtrace.o globroots.o dynlink.o
+ocamlrun$(EXE): libcamlrun.$(A) prims.$(O) main.$(O)
+ $(call MKEXE,ocamlrun$(EXE),main.$(O) prims.$(O) libcamlrun.$(A))
-OBJS=$(COMMONOBJS:.o=.$(O)) main.$(O)
-DBGOBJS=$(COMMONOBJS:.o=.$(DBGO)) prims.$(DBGO) main.$(DBGO) instrtrace.$(DBGO)
-
-PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
- intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
- signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
- dynlink.c
-
-PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
- memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
-
-all: ocamlrun.exe libcamlrun.$(A)
-
-ocamlrun.exe: libcamlrun.$(A) prims.$(O) main.$(O)
- $(call MKEXE,ocamlrun.exe,main.$(O) prims.$(O) libcamlrun.$(A))
+ocamlrund$(EXE): libcamlrund.$(A) prims.$(O) main.$(O)
+ $(call MKEXE,ocamlrun$(EXE),$(BYTECCDBGCOMPOPTS) main.$(O) prims.$(O) libcamlrund.$(A))
libcamlrun.$(A): $(OBJS)
$(call MKLIB,libcamlrun.$(A),$(OBJS))
-ocamlrund.exe: opnames.h $(DBGOBJS)
- $(call MKEXE,ocamlrund.exe,$(BYTECCDBGCOMPOPTS) $(DBGOBJS))
-
-
-install:
- cp ocamlrun.exe $(BINDIR)/ocamlrun.exe
- test -d $(LIBDIR)/caml || mkdir -p $(LIBDIR)/caml
- for i in $(PUBLIC_INCLUDES); do sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; done
- cp libcamlrun.$(A) $(LIBDIR)/libcamlrun.$(A)
-
-clean:
- rm -f *.exe *.dll *.$(O) *.$(A)
- rm -f primitives prims.c opnames.h jumptbl.h
-
-primitives : $(PRIMS)
- sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
- $(PRIMS) > primitives
-
-prims.c : primitives
- (echo '#include "mlvalues.h"'; \
- echo '#include "prims.h"'; \
- sed -e 's/.*/extern value &();/' primitives; \
- echo 'c_primitive caml_builtin_cprim[] = {'; \
- sed -e 's/.*/ &,/' primitives; \
- echo ' 0 };'; \
- echo 'char * caml_names_of_builtin_cprim[] = {'; \
- sed -e 's/.*/ "&",/' primitives; \
- echo ' 0 };') > prims.c
-
-opnames.h : instruct.h
- sed -e '/\/\*/d' \
- -e '/^#/d' \
- -e 's/enum /char * names_of_/' \
- -e 's/{$$/[] = {/' \
- -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' instruct.h > opnames.h
-
-# jumptbl.h is required only if you have GCC 2.0 or later
-jumptbl.h : instruct.h
- sed -n -e "/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp" \
- -e "/^}/q" instruct.h > jumptbl.h
-
-version.h : ../VERSION
- echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" >version.h
+libcamlrund.$(A): $(DOBJS)
+ $(call MKLIB,libcamlrund.$(A),$(DOBJS))
.SUFFIXES: .$(O) .$(DBGO)