update mkfile to be more in line with build.sh

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-05-18 12:40:12 +00:00
parent e31612f0af
commit 5bcbb07262
1 changed files with 25 additions and 20 deletions

45
mkfile
View File

@ -1,10 +1,9 @@
</$objtype/mkfile
TARG=assembler debugger emulator
USM=`{walk -f projects/ | grep '\.usm$' | grep -v blank.usm | grep -v asma.usm}
TARG=bin/debugger bin/uxnasm bin/uxnemu
USM=`{walk -f projects/ | grep '\.usm$' | grep -v blank.usm}
ROM=${USM:%.usm=%.rom}
CFLAGS=$CFLAGS -I/sys/include/npe
BIN=/$objtype/bin/uxn
HFILES=\
/sys/include/npe/stdio.h\
src/devices/apu.h\
@ -12,13 +11,14 @@ HFILES=\
src/devices/ppu.h\
src/uxn.h\
CLEANFILES=${TARG:%=bin/%} `{echo $ROM | sed 's,([^ /]+/)+,bin/,g'}
CLEANFILES=$TARG $ROM
default:V: all
all:V: ${TARG:%=bin/%} $ROM
all:V: bin $TARG $ROM
</sys/src/cmd/mkmany
bin:
mkdir -p bin
/sys/include/npe/stdio.h:
hget https://git.sr.ht/~ft/npe/archive/master.tar.gz | tar xz &&
@ -26,26 +26,31 @@ all:V: ${TARG:%=bin/%} $ROM
mk install &&
rm -r npe-master
%.rom: %.usm bin/assembler
bin/assembler $stem.usm $target && cp $target bin/
%.rom:Q: %.usm bin/uxnasm
bin/uxnasm $stem.usm $target >/dev/null
bin/assembler:Q: $O.assembler
mkdir -p bin && cp $prereq $target
bin/debugger: debugger.$O uxn.$O
$LD -o $target $prereq
bin/debugger:Q: $O.debugger
mkdir -p bin && cp $prereq $target
bin/uxnasm: assembler.$O
$LD -o $target $prereq
bin/emulator:Q: $O.emulator
mkdir -p bin && cp $prereq $target
$O.assembler: assembler.$O
$O.debugger: debugger.$O uxn.$O
$O.emulator: emulator.$O apu.$O mpu.$O ppu.$O uxn.$O
bin/uxnemu: emulator.$O apu.$O mpu.$O ppu.$O uxn.$O
$LD -o $target $prereq
(assembler|debugger|emulator|uxn)\.$O:R: src/\1.c
$CC $CFLAGS -Isrc -o $target src/$stem1.c
(apu|mpu|ppu)\.$O:R: src/devices/\1.c
$CC $CFLAGS -Isrc -o $target src/devices/$stem1.c
nuke:V: clean
clean:V:
rm -f *.[$OS] [$OS].??* $TARG $CLEANFILES
%.clean:V:
rm -f $stem.[$OS] [$OS].$stem $stem
install:QV: all
exit 'Sorry, there is no install rule yet'