1 #########################################################################
5 # Xavier Leroy, projet Cristal, INRIA Rocquencourt #
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 GNU Library General Public License, with #
10 # the special exception on linking described in file ../LICENSE. #
12 #########################################################################
16 include ../config/Makefile
19 CFLAGS=-DIN_OCAMLRUN -DOCAML_STDLIB_DIR='"$(LIBDIR)"'
21 COMMONOBJS=interp.o misc.o stacks.o fix_code.o startup.o \
22 fail.o signals.o signals_byt.o freelist.o major_gc.o minor_gc.o \
23 memory.o alloc.o roots.o compare.o ints.o floats.o \
24 str.o array.o io.o extern.o intern.o hash.o sys.o \
25 meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o lexing.o \
26 win32.o printexc.o callback.o debugger.o weak.o compact.o \
27 finalise.o custom.o backtrace.o globroots.o dynlink.o
29 DOBJS=$(COMMONOBJS:.o=.$(DO)) prims.$(DO)
30 SOBJS=$(COMMONOBJS:.o=.$(SO)) main.$(SO)
31 DBGOBJS=$(COMMONOBJS:.o=.$(DBGO)) prims.$(DBGO) main.$(DBGO) instrtrace.$(DBGO)
34 PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
35 intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
36 signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
39 PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
40 memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
42 all: ocamlrun.exe libcamlrun.$(A)
44 ocamlrun.exe: ocamlrun.dll main.$(DO)
45 $(call MKEXE,ocamlrun.exe,main.$(DO) ocamlrun.$(A))
47 ocamlrun.dll: $(DOBJS)
48 $(call MKDLL,ocamlrun.dll,ocamlrun.$(A),$(DOBJS) $(BYTECCLIBS))
50 libcamlrun.$(A): $(SOBJS)
51 $(call MKLIB,libcamlrun.$(A),$(SOBJS))
53 ocamlrund.exe: opnames.h $(DBGOBJS)
54 $(call MKEXE,ocamlrund.exe,$(BYTECCDBGCOMPOPTS) $(DBGOBJS))
57 cp ocamlrun.exe $(BINDIR)/ocamlrun.exe
58 cp ocamlrun.dll $(BINDIR)/ocamlrun.dll
59 cp ocamlrun.$(A) $(LIBDIR)/ocamlrun.$(A)
60 cp libcamlrun.$(A) $(LIBDIR)/libcamlrun.$(A)
61 test -d $(LIBDIR)/caml || mkdir -p $(LIBDIR)/caml
62 for i in $(PUBLIC_INCLUDES); do sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; done
65 rm -f *.exe *.dll *.$(O) *.$(A)
66 rm -f primitives prims.c opnames.h jumptbl.h
69 sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
73 (echo '#include "mlvalues.h"'; \
74 echo '#include "prims.h"'; \
75 sed -e 's/.*/extern value &();/' primitives; \
76 echo 'c_primitive caml_builtin_cprim[] = {'; \
77 sed -e 's/.*/ &,/' primitives; \
79 echo 'char * caml_names_of_builtin_cprim[] = {'; \
80 sed -e 's/.*/ "&",/' primitives; \
81 echo ' 0 };') > prims.c
83 opnames.h : instruct.h
86 -e 's/enum /char * names_of_/' \
88 -e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' instruct.h > opnames.h
90 # jumptbl.h is required only if you have GCC 2.0 or later
91 jumptbl.h : instruct.h
92 sed -n -e "/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp" \
93 -e "/^}/q" instruct.h > jumptbl.h
95 version.h : ../VERSION
96 echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" >version.h
99 $(CC) $(DLLCCCOMPOPTS) -c main.c
100 mv main.$(O) main.$(DO)
102 .SUFFIXES: .$(DO) .$(SO) .$(DBGO)
105 $(CC) $(CFLAGS) $(DLLCCCOMPOPTS) -c $<
108 $(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $<
111 $(CC) $(CFLAGS) $(BYTECCDBGCOMPOPTS) -c $<
112 mv $*.$(O) $*.$(DBGO)
115 sed -e '/\.d\.o/q' -e 's/^\(.*\)\.o:/\1.$$(DO) \1.$$(SO) \1.$$(DBGO):/' .depend > .depend.nt