2018-08-21 13:58:28 +00:00
#
# 4cade Makefile
# assembles source code, optionally builds a disk image and mounts it
2018-11-07 23:56:39 +00:00
# note: Windows users should probably use winmake.bat instead
2018-08-21 13:58:28 +00:00
#
# 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.2mg
2019-10-15 15:26:47 +00:00
VOLUME = TOTAL.REPLAY
2018-08-21 13:58:28 +00:00
# third-party tools required to build
2019-09-19 14:47:04 +00:00
2018-08-21 13:58:28 +00:00
# https://sourceforge.net/projects/acme-crossass/
ACME = acme
2019-09-15 21:55:16 +00:00
2019-09-19 14:47:04 +00:00
# https://github.com/sicklittlemonkey/cadius
# version 1.4.0 or later
CADIUS = cadius
2019-09-15 02:57:52 +00:00
2020-03-12 02:03:28 +00:00
# https://bitbucket.org/magli143/exomizer/wiki/Home
EXOMIZER = exomizer mem -q -P23 -lnone
dsk : md asm compress
2019-08-23 17:59:22 +00:00
cp res/blank.2mg build/" $( DISK) " >>build/log
2018-09-13 13:53:04 +00:00
cp res/_FileInformation.txt build/ >>build/log
2019-07-23 23:53:57 +00:00
$( CADIUS) ADDFILE build/" $( DISK) " " / $( VOLUME) / " "build/LAUNCHER.SYSTEM" >>build/log
2020-03-12 23:22:04 +00:00
rsync -aP res/PREFS.CONF build/PREFS.CONF >> build/log
2019-10-15 14:06:22 +00:00
bin/padto.sh 512 build/PREFS.CONF >>build/log
2020-03-12 23:22:04 +00:00
for f in res/TITLE res/COVER res/HELP res/*.CONF res/CREDITS res/HELPTEXT; do $( CADIUS) ADDFILE build/" $( DISK) " " / $( VOLUME) / " " $$ f " >>build/log; done
2020-03-12 23:04:04 +00:00
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/ACTION.HGR "06" "3FF8" >>build/log
bin/buildfileinfo.sh res/ACTION.DHGR "06" "3FF8" >>build/log
bin/buildfileinfo.sh res/ACTION.GR "06" "6000" >>build/log
bin/buildfileinfo.sh res/ARTWORK.SHR "06" "1FF8" >>build/log
bin/buildfileinfo.sh res/ATTRACT "04" "8000" >>build/log
bin/buildfileinfo.sh res/SS "04" "4000" >>build/log
2020-03-12 23:22:04 +00:00
for f in res/TITLE.* res/ACTION.* res/ARTWORK.* res/ATTRACT res/SS res/DEMO res/TITLE.ANIMATED; do $( CADIUS) ADDFOLDER build/" $( DISK) " " / $( VOLUME) / $$ (basename $$ f) " " $$ f " >>build/log; done
2019-10-15 14:06:22 +00:00
for i in 1 2 3 4 5 6; do $( CADIUS) RENAMEFILE build/" $( DISK) " " / $( VOLUME) /DEMO/SPCARTOON. $$ {i} $$ {i} " " SPCARTOON. $$ {i}. " >>build/log; done
2019-07-23 23:53:57 +00:00
$( CADIUS) ADDFOLDER build/" $( DISK) " " / $( VOLUME) /FX " "build/FX" >>build/log
$( CADIUS) CREATEFOLDER build/" $( DISK) " " / $( VOLUME) /X/ " >>build/log
2019-10-15 14:06:22 +00:00
for f in res/dsk/*.po; do $( CADIUS) EXTRACTVOLUME " $$ {f} " build/X/ >> build/log; done
2019-11-12 16:38:08 +00:00
rm -f build/X/**/.DS_Store build/X/**/PRODOS* build/X/**/LOADER.SYSTEM*
2019-07-23 23:53:57 +00:00
$( CADIUS) ADDFOLDER build/" $( DISK) " " / $( VOLUME) /X " "build/X" >>build/log
2019-09-21 00:47:35 +00:00
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106" >>build/log
2019-09-15 02:57:52 +00:00
$( CADIUS) ADDFOLDER build/" $( DISK) " " / $( VOLUME) /PRELAUNCH " "build/PRELAUNCH" >>build/log
2019-09-21 00:56:24 +00:00
bin/changebootloader.sh build/" $( DISK) " res/proboothd
2018-08-21 13:58:28 +00:00
2019-09-19 14:47:04 +00:00
asm : md asmlauncher asmfx asmprelaunch
asmlauncher :
2019-10-14 01:38:54 +00:00
$( 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
2019-09-19 14:47:04 +00:00
asmfx :
2019-10-18 18:00:25 +00:00
for f in src/fx/*.a; do grep "^\!to" $$ { f} >/dev/null && $( ACME) $$ { f} >> build/log || true; done
2020-03-12 23:04:04 +00:00
bin/buildfileinfo.sh build/FX "06" "6000" >>build/log
2019-09-19 14:47:04 +00:00
asmprelaunch :
2019-10-15 14:06:22 +00:00
for f in src/prelaunch/*.a; do grep "^\!to" $$ { f} >/dev/null && $( ACME) $$ { f} >> build/log; done
2020-03-12 02:03:28 +00:00
for f in res/title.hgr/* res/title.dhgr/*; do rsync --ignore-existing build/PRELAUNCH/STANDARD build/PRELAUNCH/$$ ( basename $$ f) ; done
2019-09-19 14:47:04 +00:00
2019-08-23 17:59:22 +00:00
chd : dsk
chdman createhd -c none -isb 64 -i build/" $( DISK) " -o build/" $( DISK) " .chd >>build/log
2020-03-12 02:03:28 +00:00
compress :
2020-03-12 23:04:04 +00:00
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
2020-03-12 02:03:28 +00:00
2018-08-21 13:58:28 +00:00
mount : dsk
osascript bin/V2Make.scpt "`pwd`" bin/4cade.vii build/" $( DISK) "
md :
2018-08-23 20:02:48 +00:00
mkdir -p build/X
2018-10-29 23:23:43 +00:00
mkdir -p build/FX
2019-09-15 02:57:52 +00:00
mkdir -p build/PRELAUNCH
2018-08-21 13:58:28 +00:00
clean :
2018-11-07 02:18:13 +00:00
rm -rf build/ || rm -rf build
2018-08-21 13:58:28 +00:00
2020-03-12 02:03:28 +00:00
all : clean dsk mount