2019-05-17 23:33:20 +10:00
|
|
|
TARGETS = shell/shell zasm/zasm runbin/runbin
|
2019-05-17 02:07:57 +10:00
|
|
|
CFSPACK = ../cfspack/cfspack
|
2019-05-20 01:19:41 +10:00
|
|
|
KERNEL = ../../kernel
|
2019-05-19 23:14:40 +10:00
|
|
|
APPS = ../../apps
|
2019-05-20 05:03:34 +10:00
|
|
|
ZASMBIN = zasm/zasm
|
2019-06-03 05:50:59 +10:00
|
|
|
INCCFS = zasm/includes.cfs
|
2019-05-10 04:09:40 +10:00
|
|
|
|
2019-05-10 02:58:41 +10:00
|
|
|
.PHONY: all
|
2019-05-10 04:09:40 +10:00
|
|
|
all: $(TARGETS)
|
2019-05-10 02:58:41 +10:00
|
|
|
|
2019-06-03 05:50:59 +10:00
|
|
|
shell/kernel.h: shell/shell_.asm $(ZASMBIN) $(INCCFS)
|
|
|
|
$(ZASMBIN) $(INCCFS) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
2019-05-20 02:57:59 +10:00
|
|
|
|
2019-05-20 05:03:34 +10:00
|
|
|
zasm/kernel.h: zasm/kernel.bin
|
|
|
|
./bin2c.sh KERNEL < $< | tee $@ > /dev/null
|
|
|
|
|
|
|
|
zasm/user.h: zasm/zasm.bin
|
|
|
|
./bin2c.sh USERSPACE < $< | tee $@ > /dev/null
|
2019-05-10 02:58:41 +10:00
|
|
|
|
2019-06-03 05:50:59 +10:00
|
|
|
$(INCCFS): $(CFSPACK)
|
2019-05-18 10:47:43 +10:00
|
|
|
rm -rf zasm/includes
|
2019-05-20 01:19:41 +10:00
|
|
|
cp -r $(KERNEL) zasm/includes
|
|
|
|
cp -r $(APPS)/zasm zasm/includes/zasm
|
2019-05-20 05:03:34 +10:00
|
|
|
find zasm/includes -name *.md -o -name *.example -o -name glue.asm -delete
|
2019-05-18 09:54:35 +10:00
|
|
|
find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \;
|
2019-05-20 02:57:59 +10:00
|
|
|
cp user.h zasm/includes
|
2019-05-17 21:23:59 +10:00
|
|
|
$(CFSPACK) zasm/includes > $@
|
|
|
|
rm -rf zasm/includes
|
2019-05-17 02:07:57 +10:00
|
|
|
|
2019-05-17 21:23:59 +10:00
|
|
|
shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h $(CFSPACK)
|
2019-06-03 05:50:59 +10:00
|
|
|
$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h
|
2019-05-17 23:33:20 +10:00
|
|
|
runbin/runbin: runbin/runbin.c libz80/libz80.o
|
2019-05-10 04:09:40 +10:00
|
|
|
$(TARGETS):
|
2019-05-20 22:20:00 +10:00
|
|
|
$(CC) $< libz80/libz80.o -o $@
|
2019-05-10 02:58:41 +10:00
|
|
|
|
|
|
|
libz80/libz80.o: libz80/z80.c
|
|
|
|
make -C libz80/codegen opcodes
|
2019-05-20 22:20:00 +10:00
|
|
|
$(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c
|
2019-05-10 02:58:41 +10:00
|
|
|
|
2019-05-17 02:07:57 +10:00
|
|
|
$(CFSPACK):
|
2019-05-13 01:20:31 +10:00
|
|
|
make -C ../cfspack
|
|
|
|
|
2019-05-20 05:03:34 +10:00
|
|
|
.PHONY: updatebootstrap
|
2019-06-03 05:50:59 +10:00
|
|
|
updatebootstrap: $(ZASMBIN) $(INCCFS)
|
|
|
|
$(ZASMBIN) $(INCCFS) < zasm/glue.asm > zasm/kernel.bin
|
|
|
|
$(ZASMBIN) $(INCCFS) < $(APPS)/zasm/glue.asm > zasm/zasm.bin
|
2019-05-20 05:03:34 +10:00
|
|
|
|
2019-05-20 22:58:53 +10:00
|
|
|
# Sometimes, when developing zasm, stuff get messed up and it's hard to unmess
|
|
|
|
# because zasm's brake-up ends up in its bootstrap bins. Sure, we can revert
|
|
|
|
# from git, but if we're in the middle of some work, it's inconvenient. As long
|
|
|
|
# as we don't diverge from scas's syntax, it can come to the recue!
|
|
|
|
.PHONY: rescue
|
|
|
|
rescue:
|
|
|
|
scas -o zasm/kernel.bin -I $(KERNEL) zasm/glue.asm
|
2019-06-03 04:05:20 +10:00
|
|
|
scas -o zasm/zasm.bin -I $(APPS) -I $(KERNEL) $(APPS)/zasm/glue.asm
|
2019-05-20 22:58:53 +10:00
|
|
|
|
2019-05-10 02:58:41 +10:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2019-05-20 05:03:34 +10:00
|
|
|
rm -f $(TARGETS) zasm/{kernel,user}.h shell/kernel.h zasm/includes.*
|