# Makefile for the Caml Light linker.

CAMLCOMP=../camlrun ../camlcomp
CAMLLINK=../camlrun ../camllink
INCLUDES=-stdlib ../lib -I ../compiler
COMPFLAGS=-O fast $(INCLUDES)
LINKFLAGS=-g $(INCLUDES)

EXTERNOBJS=config.zo misc.zo opcodes.zo

OBJS=predef.zo prim_c.zo symtable.zo patch.zo tr_const.zo link.zo \
    readword.zo version.zo main.zo

all: camllink

camllink: $(OBJS)
	$(CAMLLINK) $(LINKFLAGS) -o camllink stdlib.zo -files &&!
$(EXTERNOBJS) $(OBJS)
!

clean:
	del *.zi
	del *.zo
	del camllink
	del predef.ml
	del prim_c.ml
	del makefile.bak

install:
	copy camllink $(LIBDIR)

prim_c.ml : ../runtime/prims
	perl ../tools/mkprimc ../runtime/prims > prim_c.ml

predef.ml : ../runtime/globals.h ../runtime/fail.h
	perl ../tools/mkpredef ../runtime/globals.h ../runtime/fail.h > predef.ml

.mli.zi:
	$(CAMLCOMP) $(COMPFLAGS) {$< }

.ml.zo:
	$(CAMLCOMP) $(COMPFLAGS) {$< }

depend: prim_c.ml predef.ml
	del makefile.bak
	ren makefile makefile.bak
	perl ../tools/cutdeps makefile.bak > makefile
	perl ../tools/camldep -I ../compiler >> makefile

### EVERYTHING THAT GOES BEYOND THIS COMMENT IS GENERATED
### DO NOT DELETE THIS LINE
symtable.zo: predef.zo prim_c.zo 
patch.zo: symtable.zo 
main.zo: link.zo version.zo symtable.zo readword.zo 
link.zo: tr_const.zo symtable.zo patch.zo 
tr_const.zo: symtable.zo 
