OUTPUT_FILES =  demo.h fs.h test.h echo.h \
								recv.h iic.h \
								init.h firstrun.h sh.h halt.h sleep.h reboot.h \
								cp.h rm.h mkdir.h cd.h ls.h fsmap.h \
								edit.h ps.h \
								inittab.h

#DEBUG_OPTS = -w

all: userspc.h

userspc.h:	userspc.in ../tools/genusph $(OUTPUT_FILES)
	@echo "GENUSPH  userspc.h"
	@../tools/genusph userspc.in userspc.h

fakeheader:	userspc.in ../tools/genusph
	@echo "GENUSPH  userspc.h"
	@../tools/genusph userspc.in userspc.h --noincludes

.asm.h:
	../tools/bin2h $*.bin $*.h

$(OUTPUT_FILES): %.h: %.bin ../tools/bin2h
	@echo "BIN2H    $@"
	@../tools/bin2h $< $@

%.bin: %.asm ../tools/z80asm
	@echo "Z80ASM   $@"
	@../tools/z80asm $(DEBUG_OPTS) $< -o $@ -L$@.inc

../tools/bin2h:
	@cd ../tools && make

../tools/genusph:
	@cd ../tools && make

 ../tools/z80asm:
	@cd ../tools && make

clean:
	@rm -f $(OUTPUT_FILES) || echo -n ""
	@rm -f *.bin.inc	|| echo -n ""
	@rm -f *.bin	|| echo -n ""
	@rm -f userspc.h || echo -n ""
	@rm -f *~	|| echo -n ""
