From 2cb5f8fdbb7fc73ffd189472d0aa1add1e7e0f64 Mon Sep 17 00:00:00 2001 From: Steven Elliott Date: Sat, 26 Aug 2017 20:44:34 -0500 Subject: [PATCH] Feedback on wad2image integration from PR #480. --- .gitignore | 1 + Makefile | 50 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 74c35151..817581ae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ lumps/freedoom.lmp lumps/freedm.lmp /scripts/wad2image +/wad-images/ /wads/ wad*.txt *.bak diff --git a/Makefile b/Makefile index d6db0d72..8dbecc47 100644 --- a/Makefile +++ b/Makefile @@ -123,13 +123,17 @@ mandir?=/share/man waddir?=/share/games/doom target=$(DESTDIR)$(prefix) -# Set variables that are common to wad-image* targets. +# Variables that are common to wad-image* targets. WI_LEVELS := levels WI_SCRIPTS := scripts +WI_PATH := $(shell command -v wad2image.py) +WI_HOME := $(if $(WI_PATH),$(dir $(WI_PATH))..,$(WI_SCRIPTS)/wad2image) +WI_IMAGES := wad-images +WI_WAD_SPATH := wads,{top-dir}/wads,.,/usr/share/doom,/usr/local/doom WI_ALL_OPTIONS := $(WI_OPTIONS) $(if $(WI_BW), --colors-images bw,) \ $(if $(WI_CMD), --show-cmd $(WI_CMD),) $(if $(WI_GIF), -d gif,) \ - $(if $(WI_NO_SHOW),, -s) $(if $(WI_VERBOSE), -v,) -WI_IMAGES := $(WI_SCRIPTS)/wad2image/images + $(if $(WI_IMAGES), --out-dir $(WI_IMAGES),) $(if $(WI_SHOW), -s,) \ + $(if $(WI_VERBOSE), -v,) $(if $(WI_WAD_SPATH), --wad-spath $(WI_WAD_SPATH),) wad-image-common: # Generating images for WADs in "levels" directory and show the result. @@ -137,17 +141,20 @@ WI_LATEST := $(shell ls -1t $(WI_LEVELS)/*.wad | head -n 1) WI_FILES := $(if $(WI_PATT), $(WI_LEVELS)/$(WI_PATT).wad, $(WI_LATEST)) wad-image: wad-image-common @echo "Generating images for WADs in \"$(WI_LEVELS)\"." - scripts/wad2image/bin/wad2image.py $(WI_ALL_OPTIONS) $(WI_FILES) + $(WI_HOME)/bin/wad2image.py $(WI_ALL_OPTIONS) $(WI_FILES) +# Cleanup generated images. Structured this way for safety. wad-image-clean: wad-image-common - rm -rf $(WI_IMAGES) + rm -f $(WI_IMAGES)/*.* + -rmdir $(WI_IMAGES) # Diffing WADs in "levels" using git and show the diff." wad-image-diff: wad-image-common @echo "Diffing WADs in \"$(WI_LEVELS)\" using git." - scripts/wad2image/integration/git-wad-diff.sh "$(WI_COMMIT)" "$(WI_LEVELS)" $(WI_ALL_OPTIONS) + $(WI_HOME)/integration/git-wad-diff.sh "$(WI_COMMIT)" "$(WI_LEVELS)" $(WI_ALL_OPTIONS) -wad-image-help: +# Help for wad2image. +wad-image-help: wad-image-common @echo "Help for wad-image* targets and WI_* variable which can be used to see" @echo "differences between WAD revisions, or to simply view WADs. The following targets" @echo "depend on wad2image being copied or symlinked to the \"scripts\" directory." @@ -158,8 +165,7 @@ wad-image-help: @echo "" @echo " wad-image Generate generate images for WAD files that are in the" @echo " workspace." - @echo " wad-image-clean Remove \"$(WI_IMAGES)\" as well as all files in" - @echo " it." + @echo " wad-image-clean Remove \"$(WI_IMAGES)\" as well as all files in it." @echo " wad-image-diff Use git to generate diff image showing the differences" @echo " between two revisions of WAD files. By default the" @echo " difference is between latest HEAD and the workspace, but the" @@ -177,14 +183,24 @@ wad-image-help: @echo " git's \"commit\" argument." @echo " WI_GIF Create animated GIFs instead of color coded files for the" @echo " diff." + @echo " WI_HOME The location where wad2image is installed. By default PATH" + @echo " is searched for \"wad2image.py\". If it's found the" + @echo " enclosing installation directory is used. If it's not found" + @echo " $(WI_SCRIPTS)/wad2image is used." + @echo " WI_IMAGES The output directory that will contain the images created." + @echo " By default images are created in \"wad-images\"." @echo " WI_LEVELS Subdirectory with the level WADs." @echo " WI_OPTIONS Additional command line options for wad2image." - @echo " WI_NO_SHOW If set then don't show the images after creating them." + @echo " WI_SHOW If set then show the images after creating them." @echo " WI_PATT Files patterns that are applied to files in the \"levels\"" @echo " directory without the \".wad\" suffix. For example," @echo " \"map0*\" to get MAP01 - MAP09. This applies to wad-image" @echo " only." @echo " WI_VERBOSE If set then make wad2image more verbose." + @echo " WI_WAD_SPATH The search path for WADs where a fully qualified path was" + @echo " not given. This is typically used for the IWAD. By default" + @echo " \"wads\" is searched first, so it helps to complete a build" + @echo " before generating images." @echo "" @echo " Examples:" @echo "" @@ -198,16 +214,22 @@ wad-image-help: @echo " Verbosely create color coded diffs for changed files in the workspace:" @echo " make wad-image-diff WI_VERBOSE=t" @echo "" - @echo " Same as the above, but with high contrast black or white images:" + @echo " Same as above but Yadex style (example of WI_OPTIONS):" + @echo " make wad-image-diff WI_VERBOSE=t WI_OPTIONS=\"-c yadex\"" + @echo "" + @echo " Same as the above, but with high contrast black or white images, but" + @echo " without Yadex style:" @echo " make wad-image-diff WI_VERBOSE=t WI_BW=t" @echo "" @echo " Same as above, but use animated GIFs to illustrate the diff instead of" - @echo " colors:" - @echo " make wad-image-diff WI_VERBOSE=t WI_GIF=t WI_CMD=animate" + @echo " colors. Also, once the animated GIFs are created they'll be shown with" + @echo " the \"animate\" command:" + @echo " make wad-image-diff WI_VERBOSE=t WI_GIF=t WI_SHOW=t WI_CMD=animate" @echo "" @echo " Same as above, but illustrate the diff between two git revisions instead of" @echo " the workspace:" - @echo " make wad-image-diff WI_VERBOSE=t WI_GIF=t WI_CMD=animate WI_COMMIT=\"0c004ce~..0c004ce\"" + @echo " make wad-image-diff WI_VERBOSE=t WI_GIF=t WI_SHOW=t WI_CMD=animate \ +WI_COMMIT=\"0c004ce~..0c004ce\"" %.6: $(MAKE) -C dist man-$*