#  Le Makefile de l'image initiale de CAML [Mips]
###################################################################
SYSTEM= mips
COMMON=commonmips
##################################
# Les noms des syste`mes standard
##################################
BIG=
# With make -f Makefile camlispbig BIG=big CODE=2560 -f Makefile,
# you build a big caml
# initial core image. See ../../Makefile to complete building a Caml core
#image with a big code zone.
CODE=2048
CAMLISP=camlisp$(BIG)

################################################
# Les tailles par de'faut des zones de donne'es
################################################

SIZEZ= -stack 32 -code $(CODE) -heap 1024 -number 0 \
      -vector 30 -string 40 -symbol 8 -cons 15 $(SIZEF)

# tailles des flottants pour les xxxxbin
#SIZEF=   -float 16
SIZEF=  -float 0

##########################################################
# Les entre'es classiques
##########################################################
# Standard

all:	camlisp

tout:	camlisp

clean:
	rm -f *bin 
	rm -f camlisp 
	rm -f llcore/*.core
	rm -f o/*.o
	rm -f s/*.s

##########################################################
# Les points d'entre'e permettant de faire les syste`mes
##########################################################

$(CAMLISP):  conf/camlispconf.ll camlispbin
	./config $(CAMLISP) camlispbin camlispconf.ll $(SIZEZ) $(SIZEF)

############################################################################
# Les options de'pendant du syste`me
############################################################################
PAGESIZE=-DPAGESIZE=4096
CLOAD=-DNOCLOAD

#CFLAGS for PMAX (alias DS 3100) or M500/M800/M1000 (Umips/BSD)
CFLAGS= -DNBSYST=39 -DBSD4x -DBSD42 -DMIPS -DINRIA \
	-DTIMEUNIT=60. $(PAGESIZE) $(CLOAD) \
	-DFOREIGN -DMAXCHAR=1024 \
        -DFILEINI=\"../llib/startup.ll\" \
        -G 0

LDFLAGS= -lm
#LDFLAGS= -x -lmld -lm

fobj=	o/llmain.o o/camlstdio.o o/llfloat.o o/caml.o o/icacheflush.o

################################################################
# camlispbin

camlispbin: camlisp31bin
	rm -f camlispbin
	ln camlisp31bin camlispbin

camlisp31bin: $(fobj) lelisp31bin.o
	cc -G 4 $(fobj) lelisp31bin.o -o camlisp31bin $(LDFLAGS)

o/caml.o: ../$(COMMON)/caml.c
	cc $(CFLAGS) -c ../$(COMMON)/caml.c
	mv caml.o o/caml.o

o/camlstdio.o: ../$(COMMON)/camlstdio.c
	cc $(CFLAGS) -signed -c ../$(COMMON)/camlstdio.c
	mv camlstdio.o o/camlstdio.o

o/llfloat.o: ../$(COMMON)/llfloat.c
	cc -g $(CFLAGS) -c ../$(COMMON)/llfloat.c
	mv llfloat.o o/llfloat.o

o/llmain.o: ../$(COMMON)/llmain.c
	cc $(CFLAGS) -c ../$(COMMON)/llmain.c
	mv llmain.o o/llmain.o

o/icacheflush.o: ../$(COMMON)/icacheflush.c
	cc $(CFLAGS) -c ../$(COMMON)/icacheflush.c
	mv icacheflush.o o/icacheflush.o

