[Build] 32-bit: Fall back on a dumb full .bat rebuild if Tup can't run

And that's how we can still have a reliable 32-bit build part that runs
on XP or earlier.

Completes P0001, funded by GhostPhanom.
This commit is contained in:
nmlgc 2020-08-31 14:12:20 +02:00
parent a39a76bf99
commit b18866232b
5 changed files with 54 additions and 2 deletions

View File

@ -58,6 +58,8 @@ C++, Open Watcom, and Visual C++, which will ease future third-party ports.
* Whenever you edit the `Tupfile`: * Whenever you edit the `Tupfile`:
* Make sure that the `B32_OBJS` list in `build32b.bat` still matches the * Make sure that the `B32_OBJS` list in `build32b.bat` still matches the
list of `.obj` files generated from the `Tupfile` list of `.obj` files generated from the `Tupfile`
* Run `tup generate Tupfile.bat` to update the dumb batch fallback script,
for systems that can't run Tup.
## Code organization ## Code organization

View File

@ -62,6 +62,7 @@ And while this project has made decent progress so far, completing the decompila
Crossed-out files are identical to their version in the previous game. ONGCHK.COM is part of the PMD sound driver by KAJA, and therefore doesn't need to be disassembled either; we only need to keep the binary to allow bit-perfect rebuilds of ZUN.COM. Crossed-out files are identical to their version in the previous game. ONGCHK.COM is part of the PMD sound driver by KAJA, and therefore doesn't need to be disassembled either; we only need to keep the binary to allow bit-perfect rebuilds of ZUN.COM.
## Building ## Building
You will need: You will need:
* **Borland Turbo C++ 4.0J** * **Borland Turbo C++ 4.0J**
@ -107,10 +108,12 @@ You will need:
---- ----
* [**Tup**](http://gittup.org/tup/), for Windows * [**Tup**](http://gittup.org/tup/), for Windows (optional, but recommended)
A sane, parallel build system, used to ensure minimal rebuilds during the 32-bit build part. Provides perfect tracking of dependencies via code injection and hooking a compiler's file opening syscalls, allowing it to automatically add all `#include`d files to the build dependency graph. This makes it way superior to most `make` implementations, which lack this vital feature, and are therefore inherently unsuited for pretty much any programming language imaginable. With no abstractions for specific compilers, Tup also fits perfectly with the ancient Borland tools required for this project. A sane, parallel build system, used to ensure minimal rebuilds during the 32-bit build part. Provides perfect tracking of dependencies via code injection and hooking a compiler's file opening syscalls, allowing it to automatically add all `#include`d files to the build dependency graph. This makes it way superior to most `make` implementations, which lack this vital feature, and are therefore inherently unsuited for pretty much any programming language imaginable. With no abstractions for specific compilers, Tup also fits perfectly with the ancient Borland tools required for this project.
As of September 2020, the Windows version of Tup requires Vista or higher. In case Tup can't run or isn't installed, the build process falls back on a dumb batch file, which always fully rebuilds the entire 32-bit part.
---- ----
* **DOSBox** (if you're running a 64-bit version of Windows, or a non-Windows operating system) * **DOSBox** (if you're running a 64-bit version of Windows, or a non-Windows operating system)

View File

@ -11,7 +11,8 @@ CXX32FLAGS += -w-8012
CXX32FLAGS += -O2 -v- -x- CXX32FLAGS += -O2 -v- -x-
BMP2ARR = bin/Pipeline/bmp2arr.exe # Backslashes necessary for the .bat file generated by `tup generate`!
BMP2ARR = bin\\Pipeline\\bmp2arr.exe
: Pipeline\\bmp2arr.c Pipeline\\bmp2arrl.c \ : Pipeline\\bmp2arr.c Pipeline\\bmp2arrl.c \
|> $(CXX32) $(CXX32FLAGS) -nbin/Pipeline/ %f \ |> $(CXX32) $(CXX32FLAGS) -nbin/Pipeline/ %f \

34
Tupfile.bat Normal file
View File

@ -0,0 +1,34 @@
: Dumb, full batch build script, provided as a fallback for systems that can't
: run Tup. Auto-generated via `tup generate`; make sure to re-run that command
: if the Tupfile changes.
@echo on
bcc32 -w-8004 -w-8012 -O2 -v- -x- -nbin/Pipeline/ Pipeline/bmp2arr.c Pipeline/bmp2arrl.c
bin\\Pipeline\\bmp2arr.exe -i th01/sprites/pellet.bmp -o th01/sprites/pellet.csp -sym sPELLET -of c -sw 8 -sh 8 -pshf inner
bin\\Pipeline\\bmp2arr.exe -i th01/sprites/pellet_c.bmp -o th01/sprites/pellet_c.asp -sym _sPELLET_CLOUD -of asm -sw 16 -sh 16
bin\\Pipeline\\bmp2arr.exe -i th01/sprites/shape8x8.bmp -o th01/sprites/shape8x8.asp -sym _sSHAPE8X8 -of asm -sw 8 -sh 8
bin\\Pipeline\\bmp2arr.exe -i th02/sprites/pellet.bmp -o th02/sprites/pellet.asp -sym _sPELLET -of asm -sw 8 -sh 8 -pshf outer
bin\\Pipeline\\bmp2arr.exe -i th02/sprites/sparks.bmp -o th02/sprites/sparks.asp -sym _sSPARKS -of asm -sw 8 -sh 8 -pshf outer
bin\\Pipeline\\bmp2arr.exe -i th02/sprites/pointnum.bmp -o th02/sprites/pointnum.asp -sym _sPOINTNUMS -of asm -sw 8 -sh 8
bin\\Pipeline\\bmp2arr.exe -i th03/sprites/score.bmp -o th03/sprites/score.asp -sym _sSCORE_FONT -of asm -sw 8 -sh 8 -u
bin\\Pipeline\\bmp2arr.exe -i th04/sprites/pelletbt.bmp -o th04/sprites/pelletbt.asp -sym _sPELLET_BOTTOM -of asm -sw 8 -sh 4 -pshf outer
bin\\Pipeline\\bmp2arr.exe -i th04/sprites/pointnum.bmp -o th04/sprites/pointnum.asp -sym _sPOINTNUMS -of asm -sw 8 -sh 8 -pshf inner
bin\\Pipeline\\bmp2arr.exe -i th05/sprites/gaiji.bmp -o th05/sprites/gaiji.asp -sym _sGAIJI -of asm -sw 16 -sh 16
bin\\Pipeline\\bmp2arr.exe -i th05/sprites/piano_l.bmp -o th05/sprites/piano_l.asp -sym _sPIANO_LABEL_FONT -of asm -sw 8 -sh 8
tasm32 /m /mx /kh32768 /t th01_op.asm bin\th01\op.obj
tasm32 /m /mx /kh32768 /t th01_reiiden.asm bin\th01\reiiden.obj
tasm32 /m /mx /kh32768 /t th01_fuuin.asm bin\th01\fuuin.obj
tasm32 /m /mx /kh32768 /t th02_zuninit.asm bin\th02\zuninit.obj
tasm32 /m /mx /kh32768 /t th02_op.asm bin\th02\op.obj
tasm32 /m /mx /kh32768 /t th02_main.asm bin\th02\main.obj
tasm32 /m /mx /kh32768 /t th02_maine.asm bin\th02\maine.obj
tasm32 /m /mx /kh32768 /t /DTHIEF libs\sprite16\sprite16.asm bin\th03\zunsp.obj
tasm32 /m /mx /kh32768 /t th03_op.asm bin\th03\op.obj
tasm32 /m /mx /kh32768 /t th03_main.asm bin\th03\main.obj
tasm32 /m /mx /kh32768 /t th03_mainl.asm bin\th03\mainl.obj
tasm32 /m /mx /kh32768 /t th04_op.asm bin\th04\op.obj
tasm32 /m /mx /kh32768 /t th04_main.asm bin\th04\main.obj
tasm32 /m /mx /kh32768 /t th04_maine.asm bin\th04\maine.obj
tasm32 /m /mx /kh32768 /t th05_op.asm bin\th05\op.obj
tasm32 /m /mx /kh32768 /t th05_main.asm bin\th05\main.obj
tasm32 /m /mx /kh32768 /t th05_maine.asm bin\th05\maine.obj
@echo off

View File

@ -31,7 +31,19 @@ if errorlevel 1 goto no_bcc32
mkdir bin\Pipeline %STDERR_IGNORE% mkdir bin\Pipeline %STDERR_IGNORE%
for %%i in (1 2 3 4 5) do mkdir bin\th0%%i %STDERR_IGNORE% for %%i in (1 2 3 4 5) do mkdir bin\th0%%i %STDERR_IGNORE%
call set_errorlevel_to_1.bat
tup version >NUL
if errorlevel 1 goto fallback
: NT returns negative values for things like DLL import failures
if not errorlevel 0 goto fallback
tup tup
goto eof
:fallback
echo [:(] Failed to run Tup (gittup.org/tup), falling back on a dumb full rebuild...
if not errorlevel 0 echo (Delete `tup.exe` to avoid the error message boxes in the future)
call Tupfile.bat
goto eof goto eof