Mercurial > hg > batmud > maputils
view world/Makefile @ 2492:972cd6162ea9
Redirect error outputs to /dev/null when detecting PHP etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 16 May 2023 11:14:20 +0300 |
parents | 7a33f1beaf71 |
children | a01c82b8b7d2 |
line wrap: on
line source
include ../config.mak include config.mak ### ### Detect if we have some things ### HAVE_CURL ?= $(shell curl --version > /dev/null 2>&1 && echo "yes") HAVE_WGET ?= $(shell wget --version > /dev/null 2>&1 && echo "yes") HAVE_PHP ?= $(shell php --version > /dev/null 2>&1 && echo "yes") ifeq ($(HAVE_CURL),yes) HTTPGET ?= curl -o else ifeq ($(HAVE_WGET),yes) HTTPGET ?= wget -O else ifeq ($(HTTPGET),) $(error Required utility 'curl' or 'wget' not found in PATH. You can configure HTTPGET variable in config.mak.) endif endif endif ### ### Main targets ### TARGETS = \ $(addsuffix .html,$(WORLD_MAPS)) \ $(addsuffix .ansi,$(WORLD_MAPS)) \ $(addsuffix .png,$(WORLD_MAPS)) \ $(addsuffix .htm,$(WORLD_MAPS)) \ util.js changelog.txt LOCFILES = $(addsuffix .loc,$(WORLD_MAPS)) special.loc limbo.loc ifeq ($(HAVE_PHP),yes) TARGETS += markers.xml EXTRA_UPLOAD += markers.xml endif ### ### If no target specified, show some help ### all: @echo "Usage: make <target>" @echo "Available targets are as follows:" @echo @echo "maps : Build HTML, HTML+JS, PNG image and ANSI format maps." @echo "fetch : Fetch latest raw ASCII map data from bat.org." @echo @echo "diff : Do special diff operation between new data (gotten via 'fetch')" @echo " and update .loc files for each continent with new locations." @echo " A diff -u of new and old location files is outputted." @echo @echo "upload : Uploads map and loc-files via SCP to server specified in" @echo " ../config.mak" @echo @echo "gimp : Execute Gimp with all PNG targets for post-processing." @echo "clean : Delete all the generated files." @echo ### ### Maps ### maps: $(addsuffix .ppm,$(WORLD_MAPS)) $(TARGETS) include Makefile.inc ### ### Special targets ### changelog.txt: $(addsuffix .map,$(WORLD_MAPS)) \ $(addsuffix .loc,$(WORLD_MAPS)) \ $(addprefix ../$(MISC_MAPS_PATH),$(addsuffix .map,$(MISC_MAPS))) \ $(addprefix ../$(MISC_MAPS_PATH),$(addsuffix .loc,$(MISC_MAPS))) @hg up && ( echo '<?xml version="1.0"?>' && echo '<log>' && \ hg log $+ -M -v -f --template \ '<logentry revision="{rev}"><author>{author|escape}</author><date>{date|isodate}</date><paths><path>{files}</path></paths><msg>{desc|escape}</msg></logentry>\n' && \ echo '</log>' ) | \ iconv -f "iso-8859-1" -t "utf-8" | \ xsltproc --stringparam strip-prefix "" \ --stringparam linelen 80 \ --stringparam groupbyday yes \ --stringparam include-rev no \ "svn2cl.xsl" - | \ sed 's/world\///g;s/maps\///g;s/Matti .*/Ggr/g;s/Jarkko .*/Jeskko/g' \ > $@ # Build Batclient markers.xml markers.xml: $(addsuffix .loc,$(WORLD_MAPS)) $(MKLOC_BIN) ../www/world.inc.php php ../src/genbcxml.php $(MKLOC_BIN) ./ ../www/world.inc.php $@ # Upload changed files to site upload: $(TARGETS) $(LOCFILES) $(EXTRA_UPLOAD) $(RSCP) $? $(UPLOAD_URL) @touch $@ # Open PNG files in Gimp gimp: $(addsuffix .png,$(WORLD_MAPS)) -@ls -lt $+ gimp @gimp $+ && touch $@ -@ls -lt $+ gimp # Upload only *.loc files uploc: $(LOCFILES) $(EXTRA_UPLOAD) $(RSCP) $+ $(UPLOAD_URL) # Fetch raw ASCII maps from bat.org to *.new fetch: @for AMAP in $(CONT_MAPS); do echo "Fetching $${AMAP}.new"; $(HTTPGET) "$${AMAP}.new" "$(BATMAPURL)$${AMAP}.txt"; done # Remove all temporary .diff files cleardiff: $(RM) *.diff # Diff target - run diff for each .map and .new (fetched via 'fetch' target). # Finally do 'hg diff' to show changes. diff: cleardiff $(addsuffix .diff,$(CONT_MAPS)) @hg diff . %.js:: ../src/%.js @ln -s $< $@ # Clean temporary and generated targets clean: $(RM) $(TARGETS) *.diff *.ppm *.o *.script srcclean: clean $(RM) *~