# 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

scratch: clean
	del prim_c.ml

install:
	copy camllink $(LIBDIR)\camllink

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

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

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

### EVERYTHING THAT GOES BEYOND THIS COMMENT IS GENERATED
### DO NOT DELETE THIS LINE
link.zo: ../compiler/reloc.zo tr_const.zo ../compiler/config.zi \
    ../compiler/const.zo ../compiler/emit_phr.zo ../compiler/misc.zo \
    symtable.zo patch.zo ../compiler/instruct.zo ../compiler/opcodes.zo 
main.zo: link.zo ../compiler/config.zi ../compiler/misc.zo version.zo \
    symtable.zo readword.zo 
patch.zo: symtable.zo ../compiler/reloc.zo 
predef.zo: ../compiler/const.zo 
symtable.zo: predef.zo ../compiler/misc.zo prim_c.zo ../compiler/const.zo 
tr_const.zo: symtable.zo ../compiler/const.zo 
