Created makefile

This commit is contained in:
Devine Lu Linvega 2024-06-22 10:39:54 -08:00
parent 285a08904f
commit 76579751cb
2 changed files with 38 additions and 54 deletions

View File

@ -18,10 +18,11 @@ Oquonie is larger than a standard 64kb rom, it makes use of the [memory manager]
## Build
You must have an [Uxn](https://git.sr.ht/~rabbits/uxn/) assembler and emulator. Oquonie is pretty intricate to assemble, it needs to pack the spritesheets into the rom, have a look at the build script to better understand how this is handled. For the first run, you need to pack the assets with the `--assets` flag, afterward, unless assets have changed, simply use `.build.sh`.
You must have an [Uxn](https://git.sr.ht/~rabbits/uxn/) assembler and emulator. Oquonie is pretty intricate to assemble, it needs to pack the spritesheets into the rom, have a look at the build script to better understand how this is handled. For the first run, you need to pack the assets with the `assets` argument, afterward, unless assets have changed, simply use `make run`.
```sh
.build.sh --assets
make assets
make run
```
### Packer

87
build.sh → makefile Executable file → Normal file
View File

@ -1,25 +1,30 @@
#!/bin/sh -e
ID=oquonie
DIR=~/roms
ASM=uxncli ${DIR}/drifblim.rom
LIN=uxncli ${DIR}/uxnlin.rom
EMU=uxn11
ROM=bin/${ID}.rom
ASM="uxncli $HOME/roms/drifblim.rom"
ASM="uxnasm"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
APP="$HOME/bin/butler push"
all: ${ROM} bin/padder.rom bin/packer.rom
SRC="src/oquonie.tal"
DST="bin/oquonie.rom"
CPY="$HOME/roms"
ARG=""
APPID="hundredrabbits/oquonie:uxn"
mkdir -p bin
if [[ "$*" == *"--assets"* ]]
then
run: all
@ ${EMU} ${ROM}
@ cat bin/oquonie.romx bin/wm.romx bin/c.romx bin/c2.romx bin/b.romx bin/e.romx bin/pc.romx > bin/result.rom
@ mv bin/result.rom ${ROM}
lint:
@ ${LIN} src/${ID}.tal
clean:
@ rm -f ${ROM} ${ROM}.sym
install: all
@ cp ${ROM} ${DIR}
uninstall:
@ rm -f ${DIR}/${ID}.rom
push: ${ROM}
@ ~/bin/butler push ${ROM} hundredrabbits/${ID}:uxn
assets: all
echo "Build tools"
uxnasm tools/packer.tal bin/packer.rom
uxnasm tools/padder.tal bin/padder.rom
echo "Create characters"
cat etc/c.txt | uxncli bin/packer.rom bin/c.rom
echo "Create characters(2)"
@ -27,27 +32,24 @@ then
echo "Create floors"
cat etc/f.txt | uxncli bin/packer.rom bin/f.rom
# Merge floors with c2
cat bin/c2.rom bin/f.rom > bin/c3.rom && mv bin/c3.rom bin/c2.rom
cat bin/c2.rom bin/f.rom > bin/c3.rom
mv bin/c3.rom bin/c2.rom
echo "Create walls"
cat etc/w.txt | uxncli bin/packer.rom bin/w.rom
echo "Create maps"
cat etc/m.txt | uxncli bin/packer.rom bin/m.rom
# Merge walls and maps
cat bin/w.rom bin/m.rom > bin/wm.rom
echo "Create blockers"
cat etc/b.txt | uxncli bin/packer.rom bin/b.rom
echo "Create events"
cat etc/e.txt | uxncli bin/packer.rom bin/e.rom
echo "Create portraits"
cat etc/p.txt | uxncli bin/packer.rom bin/p.rom
echo "Create camilare"
cat etc/a.txt | uxncli bin/packer.rom bin/a.rom
# Merge portraits and camilare
cat bin/p.rom bin/a.rom > bin/pc.rom
echo "Padding assets"
uxncli bin/padder.rom 10000 bin/wm.rom
uxncli bin/padder.rom 10000 bin/c.rom
@ -55,37 +57,18 @@ then
uxncli bin/padder.rom 10000 bin/b.rom
uxncli bin/padder.rom 10000 bin/e.rom
uxncli bin/padder.rom 10000 bin/pc.rom
echo "Completed assets"
fi
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
$LIN tools/packer.tal
$LIN tools/padder.tal
fi
.PHONY: all clean lint run install uninstall push assets all
bin/padder.rom: tools/padder.tal
@ mkdir -p bin
@ ${ASM} tools/padder.tal bin/padder.rom
bin/packer.rom: tools/packer.tal
@ mkdir -p bin
@ ${ASM} tools/packer.tal bin/packer.rom
$ASM $SRC $DST
uxncli bin/padder.rom ff00 $DST
cat bin/oquonie.romx bin/wm.romx bin/c.romx bin/c2.romx bin/b.romx bin/e.romx bin/pc.romx > bin/result.rom
# wc -c bin/result.rom
rm $DST
mv bin/result.rom $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
if [[ "$*" == *"--push"* ]]
then
$APP $DST $APPID
fi
$EMU -2x $DST $ARG
${ROM}: src/*
@ mkdir -p bin
@ ${ASM} src/${ID}.tal ${ROM}