# Cheapo makefile for generic boot files
.SUFFIXES:
.SUFFIXES: .em .sc 

#Configuration
SOCKETS=t
STRIPMODULES=t
#where to install things
FEEL_PATH=/net/brad/denton_export/denton/You/NewYou/Feel

#Don't want to pick up _any_ default paths...
FEEL_LOAD_PATH=..:.:../Compiler
FEEL_INTF_PATH=.:../Interfaces
FEELC=../../Src/you -heap 5
#FEELC=FEEL_IMAGE=loader feel80b -heap 7

#For cross-transfers
#HACKPATH=add-load-path
#RELOAD=!>>
#for building self
HACKPATH=xx-add-load-path
RELOAD=!>
MODMAP=../you.mods

BOOTOBJS= boot.sc init.sc macros0.sc extras0.sc defs.sc \
	  numbers.sc telos1.sc standard.sc error0.sc semaphores.sc standard0.sc
BOOTSRCS= boot.em init.em macros0.em extras0.em defs.em \
  	  numbers.em telos1.em error0.sc standard.em semaphores.em standard0.em

IMAGE=image.ebc image.est

image: image.ebc
init: init.em
test: test.ebc
ncc: ncc-image.ebc

init.em: gen-init.em class-defs.em class-macs.em
	echo '(!> class-macs)(set-sockets ${SOCKETS})(!> gen-init)(write-c-code)(exit)' | ${FEELC} -heap 2


image.ebc: ${BOOTOBJS}
	(echo '(!> combine)(combine-mods-with-file (quote image) "${MODMAP}" (quote (' ; \
	(echo ${BOOTOBJS} | sed -e 's/\.sc/ /g') ; echo ')))(backtrace)(exit)') |  ${FEELC}
	test -f image.ebc

ncc-image.ebc: ${BOOTOBJS}
	(echo '(!> combine)(combine-mods-with-file (quote ncc-image) "you.mods.ncc" (quote (' ; \
	(echo ${BOOTOBJS} | sed -e 's/\.sc/ /g') ; echo ')))(backtrace)(exit)') |  ${FEELC}
	test -f ncc-image.ebc

test.ebc: ${BOOTOBJS}
	(echo '(!> combine)(combine-mods-with-file (quote test) "../you.mods" (quote (' ; \
	(echo ${BOOTOBJS} | sed -e 's/\.sc/ /g') ; echo ')))(backtrace)(exit)') |  ${FEELC}
	test -f test.ebc

.em.sc: 
	rm -f $*.sc
	echo '(!> compile)(!> compile)(!> mod-hack)(${HACKPATH} "Xfer")(${RELOAD} macros0)\
	      (${RELOAD} defs) (!> compile) ((setter optimize-code) t)\
	  ((setter strip-module) ${STRIPMODULES})(compile-module (quote $*))(backtrace) (exit)' | ${FEELC}
	test -f $*.sc

install: ${IMAGES}
	cp image.ebc image.est ${FEEL_PATH}/Images
		

# I don't put all the dependencies in -- just things that build fast

standard0.sc: standard.sc 
standard.sc: macros0.sc extras0.sc telos1.sc defs.sc error0.sc init.sc
