######################################################################### # # # 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) CFLAGS=-DIN_OCAMLRUN -DOCAML_STDLIB_DIR='"$(LIBDIR)"' 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) 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: ocamlrun.dll main.$(DO) $(call MKEXE,ocamlrun.exe,main.$(DO) ocamlrun.$(A)) ocamlrun.dll: $(DOBJS) $(call MKDLL,ocamlrun.dll,ocamlrun.$(A),$(DOBJS) $(BYTECCLIBS)) libcamlrun.$(A): $(SOBJS) $(call MKLIB,libcamlrun.$(A),$(SOBJS)) ocamlrund.exe: opnames.h $(DBGOBJS) $(call MKEXE,ocamlrund.exe,$(BYTECCDBGCOMPOPTS) $(DBGOBJS)) install: 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 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 : ../stdlib/sys.ml sed -n -e 's/;;//' \ -e '/let *ocaml_version *= */s//#define OCAML_VERSION /p' \ <../stdlib/sys.ml >version.h main.$(DO): main.c $(CC) $(DLLCCCOMPOPTS) -c main.c mv main.$(O) main.$(DO) .SUFFIXES: .$(DO) .$(SO) .$(DBGO) .c.$(DO): $(CC) $(CFLAGS) $(DLLCCCOMPOPTS) -c $< mv $*.$(O) $*.$(DO) .c.$(SO): $(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $< mv $*.$(O) $*.$(SO) .c.$(DBGO): $(CC) $(CFLAGS) $(BYTECCDBGCOMPOPTS) -c $< mv $*.$(O) $*.$(DBGO) .depend.nt: .depend sed -e '/\.d\.o/q' -e 's/^\(.*\)\.o:/\1.$$(DO) \1.$$(SO) \1.$$(DBGO):/' .depend > .depend.nt include .depend.nt