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$
|
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
include ../config/Makefile
|
1996-02-21 02:49:46 -08:00
|
|
|
|
1997-10-16 09:10:53 -07:00
|
|
|
CC=$(BYTECC)
|
2002-06-07 02:49:45 -07:00
|
|
|
CFLAGS=-DIN_OCAMLRUN -DOCAML_STDLIB_DIR='"$(LIBDIR)"'
|
1996-02-21 02:49:46 -08:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
COMMONOBJS=interp.o misc.o stacks.o fix_code.o startup.o \
|
|
|
|
fail.o signals.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
|
|
|
|
|
|
|
|
DOBJS=$(COMMONOBJS:.o=.$(DO)) prims.$(DO)
|
|
|
|
SOBJS=$(COMMONOBJS:.o=.$(SO)) main.$(SO)
|
1996-02-21 02:49:46 -08:00
|
|
|
|
1998-05-11 11:42:59 -07:00
|
|
|
PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
|
1996-02-26 05:52:15 -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
|
1996-02-21 02:49:46 -08:00
|
|
|
|
2002-06-17 05:24:42 -07:00
|
|
|
PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
|
|
|
|
memory.h misc.h mlvalues.h
|
1998-04-20 05:41:00 -07:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
all: ocamlrun.exe libcamlrun.$(A)
|
|
|
|
|
|
|
|
ocamlrun.exe: ocamlrun.dll main.$(DO)
|
|
|
|
$(CC) -o ocamlrun.exe main.$(DO) ocamlrun.$(A)
|
1996-02-21 02:49:46 -08:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
ocamlrun.dll: $(DOBJS)
|
|
|
|
$(call MKDLL,ocamlrun.dll,ocamlrun.$(A),$(DOBJS) $(BYTECCLIBS))
|
2001-08-28 07:47:48 -07:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
libcamlrun.$(A): $(SOBJS)
|
|
|
|
$(call MKLIB,libcamlrun.$(A),$(SOBJS))
|
1996-02-21 02:49:46 -08:00
|
|
|
|
|
|
|
install:
|
2002-06-07 02:49:45 -07:00
|
|
|
cp ocamlrun.exe $(BINDIR)/ocamlrun.exe
|
|
|
|
cp ocamlrun.dll $(BINDIR)/ocamlrun.dll
|
|
|
|
cp ocamlrun.$(A) $(LIBDIR)/ocamlrun.$(A)
|
|
|
|
cp libcamlrun.$(A) $(LIBDIR)/libcamlrun.$(A)
|
|
|
|
test -d $(LIBDIR)/caml || mkdir -p $(LIBDIR)/caml
|
|
|
|
for i in $(PUBLIC_INCLUDES); do sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; done
|
1996-02-21 02:49:46 -08:00
|
|
|
|
|
|
|
clean:
|
2002-06-07 02:49:45 -07:00
|
|
|
rm -f *.exe *.dll *.$(O) *.$(A)
|
1996-02-21 02:49:46 -08:00
|
|
|
rm -f primitives prims.c opnames.h jumptbl.h
|
|
|
|
|
|
|
|
primitives : $(PRIMS)
|
2001-08-28 07:47:48 -07:00
|
|
|
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
|
1996-02-21 02:49:46 -08:00
|
|
|
$(PRIMS) > primitives
|
|
|
|
|
|
|
|
prims.c : primitives
|
2002-06-07 02:49:45 -07:00
|
|
|
(echo '#include "mlvalues.h"'; \
|
|
|
|
echo '#include "prims.h"'; \
|
|
|
|
sed -e 's/.*/extern value &();/' primitives; \
|
|
|
|
echo 'c_primitive builtin_cprim[] = {'; \
|
|
|
|
sed -e 's/.*/ &,/' primitives; \
|
|
|
|
echo ' 0 };'; \
|
|
|
|
echo 'char * names_of_builtin_cprim[] = {'; \
|
|
|
|
sed -e 's/.*/ "&",/' primitives; \
|
|
|
|
echo ' 0 };') > prims.c
|
1996-02-21 02:49:46 -08:00
|
|
|
|
|
|
|
opnames.h : instruct.h
|
|
|
|
sed -e "/\/\*/d" \
|
|
|
|
-e "s\enum /char * names_of_/" \
|
|
|
|
-e "s/{$$/[] = {/" \
|
|
|
|
-e "s/\([A-Z][A-Z_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
|
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
main.$(DO): main.c
|
|
|
|
$(CC) $(DLLCCCOMPOPTS) -c main.c
|
|
|
|
mv main.$(O) main.$(DO)
|
|
|
|
|
|
|
|
.SUFFIXES: .$(DO) .$(SO)
|
2001-08-28 07:47:48 -07:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
.c.$(DO):
|
2001-08-28 07:47:48 -07:00
|
|
|
$(CC) $(CFLAGS) $(DLLCCCOMPOPTS) -c $<
|
2002-06-07 02:49:45 -07:00
|
|
|
mv $*.$(O) $*.$(DO)
|
|
|
|
.c.$(SO):
|
2001-08-28 07:47:48 -07:00
|
|
|
$(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $<
|
2002-06-07 02:49:45 -07:00
|
|
|
mv $*.$(O) $*.$(SO)
|
2001-08-28 07:47:48 -07:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
.depend.nt:
|
|
|
|
sed -e '/\.d\.o/q' -e 's/^\(.*\)\.o:/\1.$$(DO) \1.$$(SO):/' .depend > .depend.nt
|
1996-02-21 02:49:46 -08:00
|
|
|
|
2002-06-07 02:49:45 -07:00
|
|
|
include .depend.nt
|