freedoom/Makefile

243 lines
8.6 KiB
Makefile
Raw Normal View History

# SPDX-License-Identifier: BSD-3-Clause
2006-05-09 09:20:42 -07:00
VERSION=$(shell git describe --abbrev=8 --dirty 2>/dev/null || cat VERSION)
WADS=wads
CPP=scripts/simplecpp
DEUTEX=deutex
DEUTEX_BASIC_ARGS=-v0 -rate accept
2006-05-09 09:20:42 -07:00
DEUTEX_ARGS=$(DEUTEX_BASIC_ARGS) -doom2 bootstrap/
FREEDOOM1=$(WADS)/freedoom1.wad
FREEDOOM2=$(WADS)/freedoom2.wad
FREEDM=$(WADS)/freedm.wad
OBJS=$(FREEDM) $(FREEDOOM1) $(FREEDOOM2)
2006-05-09 09:20:42 -07:00
all: $(OBJS)
2006-05-09 09:20:42 -07:00
subdirs:
$(MAKE) VERSION=$(VERSION) -C graphics/text
$(MAKE) -C lumps/playpal
$(MAKE) -C lumps/colormap
$(MAKE) -C lumps/genmidi
$(MAKE) -C lumps/dmxgus
$(MAKE) -C lumps/textures
$(MAKE) -C bootstrap
2006-05-09 09:20:42 -07:00
# this is a useless dependency to force builds
force:
lumps/freedoom.lmp lumps/freedm.lmp: force
echo $(VERSION) > $@
2006-05-09 09:20:42 -07:00
# update wadinfo.txt
wadinfo.txt: buildcfg.txt subdirs lumps/freedoom.lmp
$(CPP) -P -DDOOM2 < $< | scripts/wadinfo-builder.py > $@
wadinfo_phase1.txt: buildcfg.txt subdirs lumps/freedoom.lmp
$(CPP) -P -DDOOM1 -DULTDOOM < $< | scripts/wadinfo-builder.py -dummy > $@
wadinfo_phase2.txt: buildcfg.txt subdirs lumps/freedoom.lmp
$(CPP) -P -DDOOM2 < $< | scripts/wadinfo-builder.py -dummy > $@
wadinfo_freedm.txt : buildcfg.txt subdirs lumps/freedoom.lmp lumps/freedm.lmp
$(CPP) -P -DFREEDM < $< | scripts/wadinfo-builder.py -dummy > $@
2006-05-09 09:20:42 -07:00
# deutex doesnt allow redirects for the filenames in the texture
# entries, so we have to change the texture1 symlink to point
# to whichever wad we are working on
#---------------------------------------------------------
# freedm iwad
$(FREEDM): wadinfo_freedm.txt subdirs
@mkdir -p $(WADS)
rm -f $@
$(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_freedm.txt $@
2006-05-09 09:20:42 -07:00
#---------------------------------------------------------
# phase 1 (udoom) iwad
2006-05-09 09:20:42 -07:00
$(FREEDOOM1): wadinfo_phase1.txt subdirs
@mkdir -p $(WADS)
2006-05-09 09:20:42 -07:00
rm -f $@
$(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_phase1.txt $@
2006-05-09 09:20:42 -07:00
#---------------------------------------------------------
# phase 2 (doom2) iwad
$(FREEDOOM2): wadinfo_phase2.txt subdirs
@mkdir -p $(WADS)
rm -f $@
$(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_phase2.txt $@
%.html: %.adoc
TZ=UTC asciidoc $<
doc: $(patsubst %.adoc,%.html,$(wildcard *.adoc))
COPYING.txt: COPYING.adoc
unix2dos --add-bom --newfile $< $@
CREDITS.txt: CREDITS
unix2dos --add-bom --newfile $< $@
DISTDOCS=COPYING.txt CREDITS.txt README.html
.PHONY: dist
# Due to convoluted reasons, the WADs must directly proceed the game name.
dist: $(OBJS) COPYING.txt CREDITS.txt README.html
LC_ALL=C VERSION=$(VERSION) scripts/makepkgs freedm $(FREEDM) $(DISTDOCS)
LC_ALL=C VERSION=$(VERSION) scripts/makepkgs freedoom $(FREEDOOM1) $(FREEDOOM2) $(DISTDOCS)
json: $(OBJS)
ifndef JSON
@echo "Define JSON as the file to output." >&2
@exit 1
else
JSON=$(JSON) VERSION=$(VERSION) scripts/makejson
endif
clean: wad-image-clean
rm -f *.html deutex.log $(OBJS) \
./COPYING.txt ./CREDITS.txt \
./wadinfo.txt ./wadinfo_phase1.txt \
./wadinfo_phase2.txt ./wadinfo_freedm.txt \
./lumps/freedoom.lmp \
./lumps/freedm.lmp
-rmdir $(WADS)
2014-11-02 17:24:05 -08:00
$(MAKE) -C dist clean
$(MAKE) -C graphics/text clean
$(MAKE) -C lumps/playpal clean
$(MAKE) -C lumps/colormap clean
$(MAKE) -C lumps/genmidi clean
$(MAKE) -C lumps/dmxgus clean
$(MAKE) -C lumps/textures clean
$(MAKE) -C bootstrap clean
prefix?=/usr/local
bindir?=/bin
mandir?=/share/man
waddir?=/share/games/doom
target=$(DESTDIR)$(prefix)
# Set variables that are common to wad-image* targets.
WI_LEVELS := levels
WI_SCRIPTS := scripts
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
wad-image-common:
# Generating images for WADs in "levels" directory and show the result.
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)
wad-image-clean: wad-image-common
rm -rf $(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)
wad-image-help:
@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."
@echo "Images are created in \"$(WI_IMAGES)\". wad2image can be downloaded"
@echo "from http://selliott.org/utilities/wad2image."
@echo ""
@echo " Targets:"
@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-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"
@echo " WI_COMMIT variable can be used to generate other diffs."
@echo " wad-image-help This help message."
@echo ""
@echo " Variables:"
@echo ""
@echo " WI_BW Make diff images black or white (high contrast) instead of"
@echo " full color. This applies to wad-image-diff-only."
@echo " WI_CMD Command used to display images. \"display\" is used by"
@echo " default. \"animate\" works well for animated GIFs."
@echo " WI_COMMIT When the wad-image-diff target is invoked this variable"
@echo " specifies which revisions are compared. It's similar to"
@echo " git's \"commit\" argument."
@echo " WI_GIF Create animated GIFs instead of color coded files for the"
@echo " diff."
@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_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 ""
@echo " Examples:"
@echo ""
@echo " Verbosely create and display an image for the most recently modified WAD"
@echo " file in \"levels\":"
@echo " make wad-image WI_VERBOSE=t"
@echo ""
@echo " Create and display the image for MAP05:"
@echo " make wad-image WI_PATT=map05"
@echo ""
@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 " 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 ""
@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\""
%.6:
$(MAKE) -C dist man-$*
%.png:
$(MAKE) -C dist icon-$*
install-%: $(WADS)/%.wad %.6 %.png
install -Dm 755 dist/freedoom "$(target)$(bindir)/$*"
install -Dm 644 dist/$*.6 -t "$(target)$(mandir)/man6"
install -Dm 644 $(WADS)/$*.wad -t "$(target)$(waddir)"
install -Dm 644 dist/$*.desktop -t "$(target)/share/applications"
install -Dm 644 dist/$*.appdata.xml -t "$(target)/share/appdata"
install -Dm 644 dist/$*.png -t "$(target)/share/icons"
2014-09-29 18:54:22 -07:00
uninstall-%:
rm "$(target)$(bindir)/$*"
rm "$(target)$(mandir)/man6/$*.6"
rm "$(target)$(waddir)/$*.wad"
rm "$(target)/share/applications/$*.desktop"
rm "$(target)/share/appdata/$*.appdata.xml"
rm "$(target)/share/icons/$*.png"
-rmdir -p "$(target)$(bindir)"
-rmdir -p "$(target)$(mandir)/man6"
-rmdir -p "$(target)$(waddir)"
-rmdir -p "$(target)/share/applications"
-rmdir -p "$(target)/share/appdata"
-rmdir -p "$(target)/share/icons"
install: install-freedm install-freedoom1 install-freedoom2
2014-09-29 18:54:22 -07:00
uninstall: uninstall-freedm uninstall-freedoom1 uninstall-freedoom2