1999-11-17 10:59:06 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# 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 #
|
2001-12-07 05:41:02 -08:00
|
|
|
# under the terms of the GNU Library General Public License, with #
|
|
|
|
# the special exception on linking described in file ../LICENSE. #
|
1999-11-17 10:59:06 -08:00
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
1996-02-13 08:26:14 -08:00
|
|
|
include ../config/Makefile
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-18 01:41:30 -07:00
|
|
|
CC=$(BYTECC)
|
2003-12-15 08:28:22 -08:00
|
|
|
CFLAGS=-DCAML_NAME_SPACE -O $(BYTECCCOMPOPTS)
|
|
|
|
DFLAGS=-DCAML_NAME_SPACE -g -DDEBUG $(BYTECCCOMPOPTS)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1996-07-24 05:58:12 -07:00
|
|
|
OBJS=interp.o misc.o stacks.o fix_code.o startup.o main.o \
|
2001-08-11 10:36:38 -07:00
|
|
|
freelist.o major_gc.o minor_gc.o memory.o alloc.o roots.o globroots.o \
|
2001-02-19 04:29:00 -08:00
|
|
|
fail.o signals.o printexc.o backtrace.o \
|
1995-05-04 03:15:53 -07:00
|
|
|
compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
|
1996-02-25 06:45:47 -08:00
|
|
|
hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
|
2001-08-28 07:47:48 -07:00
|
|
|
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
|
|
|
|
dynlink.o unix.o
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
|
|
|
|
|
1998-04-06 02:15:55 -07:00
|
|
|
PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
|
1996-02-25 06:45:47 -08:00
|
|
|
intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
|
2001-08-28 07:47:48 -07:00
|
|
|
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
|
|
|
|
dynlink.c
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2002-02-19 06:37:44 -08:00
|
|
|
PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
|
2004-11-24 16:06:06 -08:00
|
|
|
memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
|
1998-04-20 05:41:00 -07:00
|
|
|
|
2004-08-20 10:04:35 -07:00
|
|
|
all: ocamlrun$(EXE) ld.conf
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-08-10 02:58:08 -07:00
|
|
|
ocamlrun$(EXE): libcamlrun.a prims.o
|
2000-10-27 08:18:24 -07:00
|
|
|
$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o ocamlrun$(EXE) \
|
|
|
|
prims.o libcamlrun.a $(BYTECCLIBS)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-08-10 02:58:08 -07:00
|
|
|
ocamlrund$(EXE): libcamlrund.a prims.o
|
2000-10-27 08:18:24 -07:00
|
|
|
$(BYTECC) -g $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o ocamlrund$(EXE) \
|
|
|
|
prims.o libcamlrund.a $(BYTECCLIBS)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
install:
|
2000-08-10 02:58:08 -07:00
|
|
|
cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
|
1997-01-05 06:06:13 -08:00
|
|
|
cp libcamlrun.a $(LIBDIR)/libcamlrun.a
|
1995-05-09 02:34:59 -07:00
|
|
|
cd $(LIBDIR); $(RANLIB) libcamlrun.a
|
1995-09-11 07:58:17 -07:00
|
|
|
if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
|
2002-02-19 06:37:44 -08:00
|
|
|
for i in $(PUBLIC_INCLUDES); do \
|
|
|
|
sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
|
|
|
|
done
|
2004-08-20 10:04:35 -07:00
|
|
|
cp ld.conf $(LIBDIR)/ld.conf
|
|
|
|
|
2006-01-04 08:55:50 -08:00
|
|
|
ld.conf: ../config/Makefile
|
2004-08-20 10:04:35 -07:00
|
|
|
echo "$(STUBLIBDIR)" >ld.conf
|
|
|
|
echo "$(LIBDIR)" >>ld.conf
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-01-05 06:06:13 -08:00
|
|
|
libcamlrun.a: $(OBJS)
|
|
|
|
ar rc libcamlrun.a $(OBJS)
|
|
|
|
$(RANLIB) libcamlrun.a
|
|
|
|
|
1996-07-23 01:12:11 -07:00
|
|
|
libcamlrund.a: $(DOBJS)
|
|
|
|
ar rc libcamlrund.a $(DOBJS)
|
1997-01-05 06:06:13 -08:00
|
|
|
$(RANLIB) libcamlrund.a
|
1996-07-23 01:12:11 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
clean:
|
2000-10-10 05:31:22 -07:00
|
|
|
rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.o lib*.a
|
2004-08-20 10:04:35 -07:00
|
|
|
rm -f primitives prims.c opnames.h jumptbl.h ld.conf
|
2006-01-04 08:55:50 -08:00
|
|
|
rm -f version.h
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
primitives : $(PRIMS)
|
2001-08-28 07:47:48 -07:00
|
|
|
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
|
1995-05-04 03:15:53 -07:00
|
|
|
$(PRIMS) > primitives
|
|
|
|
|
|
|
|
prims.c : primitives
|
|
|
|
(echo '#include "mlvalues.h"'; \
|
|
|
|
echo '#include "prims.h"'; \
|
|
|
|
sed -e 's/.*/extern value &();/' primitives; \
|
2004-01-01 08:42:43 -08:00
|
|
|
echo 'c_primitive caml_builtin_cprim[] = {'; \
|
1995-05-04 03:15:53 -07:00
|
|
|
sed -e 's/.*/ &,/' primitives; \
|
|
|
|
echo ' 0 };'; \
|
2004-01-01 08:42:43 -08:00
|
|
|
echo 'char * caml_names_of_builtin_cprim[] = {'; \
|
1995-05-04 03:15:53 -07:00
|
|
|
sed -e 's/.*/ "&",/' primitives; \
|
|
|
|
echo ' 0 };') > prims.c
|
|
|
|
|
|
|
|
opnames.h : instruct.h
|
|
|
|
sed -e '/\/\*/d' \
|
1996-11-29 10:36:42 -08:00
|
|
|
-e '/^#/d' \
|
1995-05-04 03:15:53 -07:00
|
|
|
-e 's/enum /char * names_of_/' \
|
|
|
|
-e 's/{$$/[] = {/' \
|
2005-10-18 07:03:52 -07:00
|
|
|
-e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' instruct.h > opnames.h
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2004-11-26 17:04:19 -08:00
|
|
|
version.h : ../stdlib/sys.ml
|
|
|
|
sed -n -e 's/;;//' \
|
|
|
|
-e '/let *ocaml_version *= */s//#define OCAML_VERSION /p' \
|
|
|
|
<../stdlib/sys.ml >version.h
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
.SUFFIXES: .d.o
|
|
|
|
|
|
|
|
.c.d.o:
|
1995-07-18 01:41:30 -07:00
|
|
|
@ if test -f $*.o; then mv $*.o $*.f.o; else :; fi
|
|
|
|
$(CC) -c $(DFLAGS) $<
|
|
|
|
mv $*.o $*.d.o
|
|
|
|
@ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2004-11-26 17:04:19 -08:00
|
|
|
depend : prims.c opnames.h jumptbl.h version.h
|
2002-03-13 09:34:58 -08:00
|
|
|
gcc -MM $(BYTECCCOMPOPTS) *.c > .depend
|
|
|
|
gcc -MM $(BYTECCCOMPOPTS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
include .depend
|