4cade/Makefile

253 lines
12 KiB
Makefile
Raw Normal View History

2021-10-23 04:53:23 +00:00
#
# 4cade Makefile
# assembles source code, optionally builds a disk image and mounts it
# note: Windows users should probably use winmake.bat instead
#
# original by Quinn Dunki on 2014-08-15
# One Girl, One Laptop Productions
# http://www.quinndunki.com/blondihacks
#
# adapted by 4am on 2018-08-19
#
DISK=4cade.hdv
VOLUME=TOTAL.REPLAY
# third-party tools required to build
# https://sourceforge.net/projects/acme-crossass/
# version 0.96.3 or later
ACME=acme
# https://github.com/mach-kernel/cadius
# version 1.4.0 or later
CADIUS=cadius
# https://bitbucket.org/magli143/exomizer/wiki/Home
# version 3.1.0 or later
EXOMIZER=exomizer mem -q -P23 -lnone
2021-11-13 01:46:05 +00:00
dsk: index asmproboot asmlauncher
2021-10-23 05:20:34 +00:00
cp res/blank.hdv build/"$(DISK)"
cp res/_FileInformation.txt build/
2021-10-23 04:53:23 +00:00
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" build/LAUNCHER.SYSTEM >>build/log
2021-10-23 05:20:34 +00:00
cp res/PREFS.CONF build/PREFS.CONF
2021-10-27 04:46:25 +00:00
bin/padto.sh build/PREFS.CONF
2021-10-23 04:53:23 +00:00
#
# create _FileInformation.txt files for subdirectories
#
2021-10-23 05:20:34 +00:00
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000"
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000"
bin/buildfileinfo.sh res/ICONS "CA" "0000"
bin/buildfileinfo.sh build/FX "06" "6000"
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106"
2021-10-23 04:53:23 +00:00
#
# add everything to the disk
#
for f in \
build/TOTAL.DATA \
2021-11-13 01:46:05 +00:00
build/TOTAL.IDX \
2021-10-23 04:53:23 +00:00
res/TITLE \
res/COVER \
res/HELP \
build/PREFS.CONF \
build/CREDITS \
build/HELPTEXT \
res/DECRUNCH \
res/JOYSTICK \
res/Finder.Data \
res/Finder.Root; do \
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" >>build/log; \
done
for f in \
res/TITLE.HGR \
res/TITLE.DHGR \
res/DEMO \
res/TITLE.ANIMATED \
res/ICONS \
build/FX \
build/PRELAUNCH; do \
rm -f "$$f"/.DS_Store; \
$(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/$$(basename $$f)" "$$f" >>build/log; \
done
for i in 1 2 3 4 5 6; do \
$(CADIUS) RENAMEFILE build/"$(DISK)" "/$(VOLUME)/DEMO/SPCARTOON.$${i}$${i}" "SPCARTOON.$${i}." >>build/log; \
done
for f in res/dsk/*.po; do \
$(CADIUS) EXTRACTVOLUME "$${f}" build/X/ >>build/log; \
done
rm -f build/X/**/.DS_Store build/X/**/PRODOS* build/X/**/LOADER.SYSTEM*
$(CADIUS) CREATEFOLDER build/"$(DISK)" "/$(VOLUME)/X/" >>build/log
for f in build/X/*; do \
$(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/X/$$(basename $$f)" "$$f" >>build/log; \
done
bin/changebootloader.sh build/"$(DISK)" build/proboothd
2021-11-12 23:19:43 +00:00
index: md asmfx asmprelaunch compress
# note: even though individual lines check individual files, you really want
# to re-run this with a clean build/ directory if anything changes, because
# everything is interconnected within TOTAL.DATA
#
# precompute binary data structure for mega-attract mode configuration file
#
[ -f build/ATTRACT.IDX ] || (bin/buildokvs.sh < res/ATTRACT.CONF > build/ATTRACT.IDX)
#
# precompute binary data structure and substitute special characters
# in game help and other all-text pages
#
[ -f build/HELPTEXT ] || (bin/converthelp.sh res/HELPTEXT build/HELPTEXT)
[ -f build/CREDITS ] || (bin/converthelp.sh res/CREDITS build/CREDITS)
for f in res/GAMEHELP/*; do \
[ -f build/GAMEHELP/"$$(basename $$f)" ] || (bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)"); \
done
#
# create search indexes for each variation of (game-requires-joystick) X (game-requires-128K)
# in the form of OKVS data structures, plus game counts in the form of source files
#
[ -f build/GAMES.CONF ] || (awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF)
[ -f build/SEARCH00.IDX ] || (grep "^00" < build/GAMES.CONF | bin/buildsearch.sh src/index/count00.a > build/SEARCH00.IDX)
[ -f build/SEARCH01.IDX ] || (grep "^0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count01.a > build/SEARCH01.IDX)
[ -f build/SEARCH10.IDX ] || (grep "^.0" < build/GAMES.CONF | bin/buildsearch.sh src/index/count10.a > build/SEARCH10.IDX)
[ -f build/SEARCH11.IDX ] || (bin/buildsearch.sh src/index/count11.a < build/GAMES.CONF > build/SEARCH11.IDX)
#
# create a sorted list of game filenames, without metadata or display names
#
[ -f build/GAMES.SORTED ] || (awk -F, '/,/ { print $$2 }' < build/GAMES.CONF | awk -F= '{ print $$1 }' | sort > build/GAMES.SORTED)
#
# precompute indexed files for prelaunch
# note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch
# note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack
#
[ -f build/PRELAUNCH.IDX ] || (bin/buildindexedfile.sh build/TOTAL.DATA build/PRELAUNCH.INDEXED < build/GAMES.SORTED > build/PRELAUNCH.IDX)
#
# precompute indexed files for game help
#
[ -f build/GAMEHELP.IDX ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/GAMEHELP < build/GAMES.SORTED > build/GAMEHELP.IDX)
#
# precompute indexed files for slideshows
#
[ -f build/SLIDESHOW.IDX ] || ((for f in res/SS/*; do \
2021-10-27 17:06:04 +00:00
[ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \
2021-11-03 05:14:04 +00:00
bin/buildaction.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)" || \
bin/buildtitle.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)"; \
echo "$$(basename $$f)"; \
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX)
[ -f build/MINIATTRACT.IDX ] || ((for f in res/ATTRACT/*; do \
bin/buildokvs.sh < "$$f" > "build/ATTRACT/$$(basename $$f)"; \
echo "$$(basename $$f)"; \
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/ATTRACT > build/MINIATTRACT.IDX)
#
# precompute indexed files for graphic effects
#
[ -f build/FX.IDX ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF > build/FX.IDX)
[ -f build/DFX.IDX ] || (bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF > build/DFX.IDX)
#
# precompute indexed files for HGR & DHGR action screenshots
# note: these can not be padded because they are compressed and the decompressor needs the exact size
#
[ -f build/HGR0.IDX ] || ((for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR0.IDX)
[ -f build/HGR1.IDX ] || ((for f in res/ACTION.HGR/[EFGH]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR1.IDX)
[ -f build/HGR2.IDX ] || ((for f in res/ACTION.HGR/[IJKL]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR2.IDX)
[ -f build/HGR3.IDX ] || ((for f in res/ACTION.HGR/[MNOP]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR3.IDX)
[ -f build/HGR4.IDX ] || ((for f in res/ACTION.HGR/[QRST]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR4.IDX)
[ -f build/HGR5.IDX ] || ((for f in res/ACTION.HGR/[UVWX]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR5.IDX)
[ -f build/HGR6.IDX ] || ((for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR6.IDX)
[ -f build/DHGR.IDX ] || ((for f in res/ACTION.DHGR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.DHGR > build/DHGR.IDX)
#
# precompute indexed files for GR action screenshots
# note: these can be padded because they are not compressed
#
[ -f build/GR.IDX ] || ((for f in res/ACTION.GR/*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a -p build/TOTAL.DATA res/ACTION.GR > build/GR.IDX)
#
# precompute indexed files for SHR artwork
# note: these can not be padded because they are compressed and the decompressor needs the exact size
#
[ -f build/ARTWORK.IDX ] || ((for f in res/ARTWORK.SHR/*; do \
echo "$$(basename $$f)"; \
done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ARTWORK.SHR > build/ARTWORK.IDX)
2021-11-13 01:46:05 +00:00
#
# add IDX files to the combined index file and generate
# the index records that callers use to reference them
#
bin/addfile.sh build/SEARCH00.IDX build/TOTAL.IDX > src/index/search00.idx.a
bin/addfile.sh res/CACHE00.IDX build/TOTAL.IDX > src/index/cache00.idx.a
bin/addfile.sh build/SEARCH01.IDX build/TOTAL.IDX > src/index/search01.idx.a
bin/addfile.sh res/CACHE01.IDX build/TOTAL.IDX > src/index/cache01.idx.a
bin/addfile.sh build/SEARCH10.IDX build/TOTAL.IDX > src/index/search10.idx.a
bin/addfile.sh res/CACHE10.IDX build/TOTAL.IDX > src/index/cache10.idx.a
bin/addfile.sh build/SEARCH11.IDX build/TOTAL.IDX > src/index/search11.idx.a
bin/addfile.sh res/CACHE11.IDX build/TOTAL.IDX > src/index/cache11.idx.a
2021-11-13 01:46:05 +00:00
bin/addfile.sh build/PRELAUNCH.IDX build/TOTAL.IDX > src/index/prelaunch.idx.a
bin/addfile.sh build/ATTRACT.IDX build/TOTAL.IDX > src/index/attract.idx.a
bin/addfile.sh build/FX.IDX build/TOTAL.IDX > src/index/fx.idx.a
bin/addfile.sh build/DFX.IDX build/TOTAL.IDX > src/index/dfx.idx.a
bin/addfile.sh build/GAMEHELP.IDX build/TOTAL.IDX > src/index/gamehelp.idx.a
bin/addfile.sh build/SLIDESHOW.IDX build/TOTAL.IDX > src/index/slideshow.idx.a
bin/addfile.sh build/MINIATTRACT.IDX build/TOTAL.IDX > src/index/miniattract.idx.a
2021-11-13 22:11:26 +00:00
bin/addfile.sh build/HGR0.IDX build/TOTAL.IDX > src/index/hgr0.idx.a
bin/addfile.sh build/HGR1.IDX build/TOTAL.IDX > src/index/hgr1.idx.a
bin/addfile.sh build/HGR2.IDX build/TOTAL.IDX > src/index/hgr2.idx.a
bin/addfile.sh build/HGR3.IDX build/TOTAL.IDX > src/index/hgr3.idx.a
bin/addfile.sh build/HGR4.IDX build/TOTAL.IDX > src/index/hgr4.idx.a
bin/addfile.sh build/HGR5.IDX build/TOTAL.IDX > src/index/hgr5.idx.a
bin/addfile.sh build/HGR6.IDX build/TOTAL.IDX > src/index/hgr6.idx.a
2021-11-13 01:46:05 +00:00
bin/addfile.sh build/DHGR.IDX build/TOTAL.IDX > src/index/dhgr.idx.a
bin/addfile.sh build/GR.IDX build/TOTAL.IDX > src/index/gr.idx.a
bin/addfile.sh build/ARTWORK.IDX build/TOTAL.IDX > src/index/artwork.idx.a
2021-10-23 04:53:23 +00:00
asmlauncher: md
$(ACME) -DBUILDNUMBER=`git rev-list --count HEAD` src/4cade.a 2>build/relbase.log
$(ACME) -r build/4cade.lst -DBUILDNUMBER=`git rev-list --count HEAD` -DRELBASE=`cat build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` src/4cade.a
asmfx: md
for f in src/fx/*.a; do \
2021-10-23 05:20:34 +00:00
grep "^\!to" $${f} >/dev/null && $(ACME) $${f} || true; \
2021-10-23 04:53:23 +00:00
done
asmprelaunch: md
for f in src/prelaunch/*.a; do \
2021-10-23 05:20:34 +00:00
grep "^\!to" $${f} >/dev/null && $(ACME) $${f}; \
2021-10-23 04:53:23 +00:00
done
asmproboot: md
2021-10-23 05:20:34 +00:00
$(ACME) -r build/proboothd.lst src/proboothd/proboothd.a
2021-10-23 04:53:23 +00:00
compress: md
for f in res/ACTION.HGR.UNCOMPRESSED/*; do o=res/ACTION.HGR/$$(basename $$f); [ -f "$$o" ] || ${EXOMIZER} "$$f"@0x4000 -o "$$o" >>build/log; done
for f in res/ACTION.DHGR.UNCOMPRESSED/*; do o=res/ACTION.DHGR/$$(basename $$f); [ -f "$$o" ] || ${EXOMIZER} "$$f"@0x4000 -o "$$o" >>build/log; done
for f in res/ARTWORK.SHR.UNCOMPRESSED/*; do o=res/ARTWORK.SHR/$$(basename $$f); [ -f "$$o" ] || ${EXOMIZER} "$$f"@0x2000 -o "$$o" >>build/log; done
for f in res/TITLE.HGR.UNPACKED/*; do o=res/TITLE.HGR/$$(basename $$f); [ -f "$$o" ] || bin/packhgrfile.py $$f $$o >>build/log; done
2021-11-12 23:19:43 +00:00
#
# |attract| must be called separately because it is slow and
# only needs to be run when a new game or demo is added.
# It create files in the repository which can then be checked in.
#
2021-10-23 04:53:23 +00:00
attract: compress
bin/check-attract-mode.sh
bin/generate-mini-attract-mode.sh
2021-11-05 22:39:20 +00:00
cache: md
awk -F= '/^00/ { print $$2 }' < res/GAMES.CONF | bin/buildcache.py > build/cache00.a
awk -F= '/^0/ { print $$2 }' < res/GAMES.CONF | bin/buildcache.py > build/cache01.a
awk -F= '/^.0/ { print $$2 }' < res/GAMES.CONF | bin/buildcache.py > build/cache10.a
awk -F= '!/^$$|^#|^\[/ { print $$2 }' < res/GAMES.CONF | bin/buildcache.py > build/cache11.a
$(ACME) -o res/CACHE00.IDX build/cache00.a
$(ACME) -o res/CACHE01.IDX build/cache01.a
$(ACME) -o res/CACHE10.IDX build/cache10.a
$(ACME) -o res/CACHE11.IDX build/cache11.a
2021-10-23 04:53:23 +00:00
mount: dsk
osascript bin/V2Make.scpt "`pwd`" bin/4cade.vii build/"$(DISK)"
md:
mkdir -p build/X build/FX.INDEXED build/FX build/PRELAUNCH.INDEXED build/PRELAUNCH build/ATTRACT build/SS build/GAMEHELP
touch build/log
clean:
rm -rf build/ || rm -rf build
all: clean dsk mount
al: all