diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e7b97c5bd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.depends diff --git a/GNUmakefile b/GNUmakefile index 22b1a65b7..0335447ed 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -12,10 +12,13 @@ check: expected output output: $(OUTPUTS) -output/%.txt: demos/%.lmp +output/%.txt: demos/%.lmp $(SOURCE_PORT) @mkdir -p $(dir $@) ./testrunner $< $@ +.depends: makedepends + ./makedepends $@ + extract/%: unzip $(UNZIPOPTS) -d extract $< $(notdir $@) @@ -29,3 +32,6 @@ extract/class_ep.wad: pwads/class_ep.zip clean: rm -f extract/*.wad rm -rf output/* + rm -f .depends + +include .depends diff --git a/makedepends b/makedepends new file mode 100755 index 000000000..03c287ef7 --- /dev/null +++ b/makedepends @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +from glob import glob +import os +import sys + +from common import * + +depends_file = sys.argv[1] +dependencies = {} + +for filename in glob("expected/**/*.txt", recursive=True): + lmp_file = filename.replace("expected/", "demos/").replace(".txt", ".lmp") + cfg = read_config(lmp_file) + + pwad = cfg.get("pwad") + if pwad is not None: + out_file = filename.replace("expected/", "output/") + dependencies[out_file] = [os.path.join("extract", pwad)] + +with open(depends_file, "w") as f: + for out_file, depends in sorted(dependencies.items()): + f.write("%s: %s\n" % ( + out_file, " ".join(depends), + ))