From 00450d0c85e7024cfb428636bac2d7aeac6d2591 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 15 Sep 2024 12:43:44 -0400 Subject: [PATCH] Switch to new build system. This new system works based on rules generation, rather than hand- constructed make rules. This is derived from the makefile found in the statcheck repository at chocolate-doom/statcheck@4d1182db1ba7b1b54. Part of #3. --- .gitignore | 1 + GNUmakefile | 138 +++++------------- demos.txt | 9 ++ expected/{av.txt => av/30av-25337.txt} | 0 .../{cydreams.txt => cydreams/30cyx1904.txt} | 0 expected/{d2twid.txt => d2twid/30id-4525.txt} | 0 .../{eternal.txt => eternal/30et-13854.txt} | 0 expected/{hr.txt => hr/hqr-4339.txt} | 0 expected/{hr2.txt => hr2/h2alls2-22944.txt} | 0 expected/{mm.txt => mm/30mm8356.txt} | 0 expected/{mm2.txt => mm2/mm2allnomo4938.txt} | 0 expected/{pl2.txt => pl2/pl2all1.txt} | 0 12 files changed, 49 insertions(+), 99 deletions(-) create mode 100644 .gitignore create mode 100644 demos.txt rename expected/{av.txt => av/30av-25337.txt} (100%) rename expected/{cydreams.txt => cydreams/30cyx1904.txt} (100%) rename expected/{d2twid.txt => d2twid/30id-4525.txt} (100%) rename expected/{eternal.txt => eternal/30et-13854.txt} (100%) rename expected/{hr.txt => hr/hqr-4339.txt} (100%) rename expected/{hr2.txt => hr2/h2alls2-22944.txt} (100%) rename expected/{mm.txt => mm/30mm8356.txt} (100%) rename expected/{mm2.txt => mm2/mm2allnomo4938.txt} (100%) rename expected/{pl2.txt => pl2/pl2all1.txt} (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8663ed5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.rules diff --git a/GNUmakefile b/GNUmakefile index 000a47b..2d16f5c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,120 +1,60 @@ +# +# Copyright (C) 2024 Simon Howard +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. This program is distributed in the hope that +# it will be useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# -export SOURCE_PORT=/usr/games/chocolate-doom +export SDL_VIDEODRIVER = dummy -# Quiet output, convert to lower case, don't restore timestamps, -# overwrite without prompt, extract to extract/ directory. -UNZIPOPTS = -q -LL -o -d extract +SOURCE_PORT_NAME = chocolate-doom +SOURCE_PORT := $(shell which $(SOURCE_PORT_NAME) || echo missing_source_port) +DOOMOPTS = -mb 16 -nodraw -noblit -nosound \ + -noautoload -nogui -nograbmouse -nofullscreen -OUTPUTS = -WADS = extract/miniwad.wad +ALL_DEMOS = $(patsubst %,demos/%,$(shell cat demos.txt)) +OUTPUTS = $(subst .lmp,.txt,$(subst demos/,output/,$(ALL_DEMOS))) +UNZIPOPTS = -L -o -all: check +check: expected output + diff -x .gitignore -u -r expected output + @echo all tests passed + +output: $(OUTPUTS) + +missing_source_port: + @echo "Failed to find" $(SOURCE_PORT_NAME) "in PATH." + @echo "To specify the path explicitly:" + @echo " make SOURCE_PORT=/path/to/$(SOURCE_PORT_NAME)" + @echo "Or to search for a different source port:" + @echo " make SOURCE_PORT_NAME=lemon-doom" + @false + +.rules: makerules + ./makerules $@ extract/%: - unzip $(UNZIPOPTS) $< $(subst extract/,,$@) + unzip $(UNZIPOPTS) -d extract $< $(notdir $@) @touch $@ -extract/miniwad.wad: miniwad.zip -testrunner: $(SOURCE_PORT) extract/miniwad.wad - -# Alien Vendetta, Ancalagon 4:13:37 extract/av.wad: pwads/av_new.zip -extract/30av-25337.lmp: demos/avall-41337.zip - -output/av.txt: testrunner extract/av.wad extract/30av-25337.lmp - ./testrunner -merge av.wad -timedemo extract/30av-25337.lmp >$@ - -WADS += extract/av.wad -OUTPUTS += output/av.txt - -# Cyberdreams, SuperWeaponDude 19:04 extract/cyber110.wad: pwads/cydreams.zip extract/cyber110.deh: pwads/cydreams.zip -extract/30cyx1904.lmp: demos/cyallx1904.zip - -output/cydreams.txt: testrunner extract/cyber110.wad extract/cyber110.deh extract/30cyx1904.lmp - ./testrunner -deh cyber110.deh -merge cyber110.wad -timedemo extract/30cyx1904.lmp >$@ - -WADS += extract/cyber110.wad -OUTPUTS += output/cydreams.txt - -# Doom 2 The Way Id Did, William "crate" Striegl 45:25 extract/d2twid.wad: pwads/d2twid.zip -extract/30id-4525.lmp: demos/30id-4525.zip - -output/d2twid.txt: testrunner extract/d2twid.wad extract/30id-4525.lmp - ./testrunner -nodehlump -merge d2twid.wad -timedemo extract/30id-4525.lmp >$@ - -WADS += extract/d2twid.wad -OUTPUTS += output/d2twid.txt - -# Eternal Doom, ELMLE 2:18:54 extract/eternall.wad: pwads/eternal.zip -extract/30et-13854.lmp: demos/etall-21854.zip - -output/eternal.txt: testrunner extract/eternall.wad extract/30et-13854.lmp - ./testrunner -merge eternall.wad -timedemo extract/30et-13854.lmp >$@ - -WADS += extract/eternall.wad -OUTPUTS += output/eternal.txt - -# Hell Revealed, Yonatan Donner/Haggay Niv 43:39 extract/hr.wad: pwads/hr.zip -extract/hqr-4339.lmp: demos/hrall-4339.zip - -output/hr.txt: testrunner extract/hr.wad extract/hqr-4339.lmp - ./testrunner -merge hr.wad -timedemo extract/hqr-4339.lmp >$@ - -WADS += extract/hr.wad -OUTPUTS += output/hr.txt - -# Hell Revealed 2, tchkb 2:29:44 extract/hr2final.wad: pwads/hr2final.zip -extract/h2alls2-22944.lmp: demos/h2all-22944.zip - -output/hr2.txt: testrunner extract/hr2final.wad extract/h2alls2-22944.lmp - ./testrunner -merge hr2final.wad -timedemo extract/h2alls2-22944.lmp >$@ - -WADS += extract/hr2final.wad -OUTPUTS += output/hr2.txt - -# Memento Mori, stx-Vile 83:56 extract/mm.wad: pwads/mm_allup.zip -extract/30mm8356.lmp: demos/30mm8356.zip - -output/mm.txt: testrunner extract/mm.wad extract/30mm8356.lmp - ./testrunner -merge mm.wad -timedemo extract/30mm8356.lmp >$@ - -WADS += extract/mm.wad -OUTPUTS += output/mm.txt - -# Memento Mori 2, Cyberdemon531 49:38 extract/mm2.wad: pwads/mm2.zip -extract/mm2allnomo4938.lmp: demos/m2allo4938.zip - -output/mm2.txt: testrunner extract/mm2.wad extract/mm2allnomo4938.lmp - ./testrunner -merge mm2.wad -timedemo extract/mm2allnomo4938.lmp >$@ - -WADS += extract/mm2.wad -OUTPUTS += output/mm2.txt - -# Plutonia 2, Red-XIII 1:05:04 extract/pl2.wad: pwads/pl2.zip -extract/pl2all1.lmp: demos/p2all-6504.zip - -output/pl2.txt: testrunner extract/pl2.wad extract/pl2all1.lmp - ./testrunner -gameversion final -merge pl2.wad -timedemo extract/pl2all1.lmp >$@ - -WADS += extract/pl2.wad -OUTPUTS += output/pl2.txt - - -wads: $(WADS) - -check: $(OUTPUTS) - @diff -q -x .gitignore -r expected output && echo all tests passed clean: - rm -rf output/* extract/* + rm -f extract/*.wad + rm -rf output/* + rm -f .rules -.PHONY: wads check clean all +include .rules diff --git a/demos.txt b/demos.txt new file mode 100644 index 0000000..eaf435b --- /dev/null +++ b/demos.txt @@ -0,0 +1,9 @@ +av/30av-25337.lmp +cydreams/30cyx1904.lmp +d2twid/30id-4525.lmp +eternal/30et-13854.lmp +hr/hqr-4339.lmp +hr2/h2alls2-22944.lmp +mm2/mm2allnomo4938.lmp +mm/30mm8356.lmp +pl2/pl2all1.lmp diff --git a/expected/av.txt b/expected/av/30av-25337.txt similarity index 100% rename from expected/av.txt rename to expected/av/30av-25337.txt diff --git a/expected/cydreams.txt b/expected/cydreams/30cyx1904.txt similarity index 100% rename from expected/cydreams.txt rename to expected/cydreams/30cyx1904.txt diff --git a/expected/d2twid.txt b/expected/d2twid/30id-4525.txt similarity index 100% rename from expected/d2twid.txt rename to expected/d2twid/30id-4525.txt diff --git a/expected/eternal.txt b/expected/eternal/30et-13854.txt similarity index 100% rename from expected/eternal.txt rename to expected/eternal/30et-13854.txt diff --git a/expected/hr.txt b/expected/hr/hqr-4339.txt similarity index 100% rename from expected/hr.txt rename to expected/hr/hqr-4339.txt diff --git a/expected/hr2.txt b/expected/hr2/h2alls2-22944.txt similarity index 100% rename from expected/hr2.txt rename to expected/hr2/h2alls2-22944.txt diff --git a/expected/mm.txt b/expected/mm/30mm8356.txt similarity index 100% rename from expected/mm.txt rename to expected/mm/30mm8356.txt diff --git a/expected/mm2.txt b/expected/mm2/mm2allnomo4938.txt similarity index 100% rename from expected/mm2.txt rename to expected/mm2/mm2allnomo4938.txt diff --git a/expected/pl2.txt b/expected/pl2/pl2all1.txt similarity index 100% rename from expected/pl2.txt rename to expected/pl2/pl2all1.txt