changeset 1708:9a124fdb6dab

Rename various Makefile variables and improve + modularize hcbat-related things better.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 12 Oct 2017 11:43:43 +0300
parents f3f7fd0d4a20
children 5adf497ffcbf
files old/Makefile world/Makefile world/Makefile.inc world/config.mak
diffstat 4 files changed, 24 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/old/Makefile	Thu Oct 12 11:29:21 2017 +0300
+++ b/old/Makefile	Thu Oct 12 11:43:43 2017 +0300
@@ -1,9 +1,8 @@
 #
 # Settings
 #
-MAP_PATH=../world/
-MAPSCALE=7
-FONT:=..\/maps\/$(FONT)
+MAP_PATH  = ../world/
+MAP_SCALE = 10
 COLORMAP_EXTRA=-O
 
 include ../config.mak
@@ -34,6 +33,9 @@
 title.png: $(MAP_PATH)title.png
 	@ln -s $< $@
 
+MonospaceBold.ttf: $(MAP_PATH)MonospaceBold.ttf
+	@ln -s $< $@
+
 batcity.html: batcity.map batcity.loc tooltip.js
 	$(MKCITYMAP_BIN) $(MKCITYMAP_OPTS) -T -t "Old BatCity map" $< batcity.loc -o "$@"
 
@@ -47,14 +49,6 @@
 	perl -w ./mapref.pl $+ > hcbat.loc
 
 
-# Diff target between .map file and .new file. Makes necessary changes in .map and .loc
-%.diff: %.map %.new
-	@echo DIFFING $< ...
-	@echo UPDATING LOCATIONS ...
-	@$(MKLOC_BIN) -v -m $(patsubst %.map,%.new,$<) -l $(patsubst %.map,%.loc,$<) -L -g -o $(patsubst %.map,%.nloc,$<)
-	@diff -ubB $(patsubst %.map,%.loc,$<) $(patsubst %.map,%.nloc,$<) | patch
-
-
 #
 # Special targets
 #
--- a/world/Makefile	Thu Oct 12 11:29:21 2017 +0300
+++ b/world/Makefile	Thu Oct 12 11:43:43 2017 +0300
@@ -4,10 +4,10 @@
 ###
 ### Main targets
 ###
-TARGETS=$(addsuffix .html,$(MAPLIST)) \
-	$(addsuffix .ansi,$(MAPLIST)) \
-	$(addsuffix .png,$(MAPLIST)) \
-	$(addsuffix .htm,$(MAPLIST)) \
+TARGETS=$(addsuffix .html,$(WORLD_MAPS)) \
+	$(addsuffix .ansi,$(WORLD_MAPS)) \
+	$(addsuffix .png,$(WORLD_MAPS)) \
+	$(addsuffix .htm,$(WORLD_MAPS)) \
 	util.js
 
 
@@ -32,11 +32,11 @@
 ###
 ### Maps
 ###
-maps: $(addsuffix .ppm,$(MAPLIST)) $(TARGETS)
+maps: $(addsuffix .ppm,$(WORLD_MAPS)) $(TARGETS)
 
 include Makefile.inc
 
-LOCLIST=$(addsuffix .loc,$(MAPLIST)) special.loc limbo.loc
+LOCLIST=$(addsuffix .loc,$(WORLD_MAPS)) special.loc limbo.loc
 
 ###
 ### Special targets
@@ -48,7 +48,7 @@
 	@touch $@
 
 # Open PNG files in Gimp
-gimp: $(addsuffix .png,$(MAPLIST))
+gimp: $(addsuffix .png,$(WORLD_MAPS))
 	-@ls -lt $+ gimp
 	@gimp $+ && touch $@
 	-@ls -lt $+ gimp
@@ -59,7 +59,7 @@
 
 # Fetch raw ASCII maps from bat.org to *.new
 fetch:
-	for i in $(MAPMAP); do wget -O "$$i.new" "$(BATMAPURL)$$i.txt"; done
+	for i in $(CONT_MAPS); do wget -O "$$i.new" "$(BATMAPURL)$$i.txt"; done
 
 
 # Remove all temporary .diff files
@@ -68,7 +68,7 @@
 
 # Diff target - run diff for each .map and .new (fetched via 'fetch' target).
 # Finally do 'hg diff' to show changes.
-diff: cleardiff $(addsuffix .diff,$(MAPMAP))
+diff: cleardiff $(addsuffix .diff,$(CONT_MAPS))
 	@hg diff .
 
 %.js: ../%.js
--- a/world/Makefile.inc	Thu Oct 12 11:29:21 2017 +0300
+++ b/world/Makefile.inc	Thu Oct 12 11:43:43 2017 +0300
@@ -45,14 +45,14 @@
 ###
 ### PNG images
 ###
-%.script: %.map %.loc title.png
-	$(MKLOC_BIN) -S -m $< -l $(patsubst %.map,%.loc,$<) -f $(FONTSCALE) -u $(UNITSIZE) -s $(MAPSCALE) | \
-	sed -e "s/@OPTS_START@/-font $(FONT) -pointsize 14 -type TruecolorMatte/g" \
+%.script: %.map %.loc title.png $(MAP_FONT)
+	$(MKLOC_BIN) -S -m $< -l $(patsubst %.map,%.loc,$<) -f $(MAP_FONT_SCALE) -u $(MAP_UNIT_SIZE) -s $(MAP_SCALE) | \
+	sed -e "s/@OPTS_START@/-font $(MAP_FONT) -pointsize 14 -type TruecolorMatte/g" \
 	-e "s/@OPTS_END@/\t-geometry +0+0 title.png -composite -compose screen \\\\\n\t-pointsize 20 -fill white -box none -draw \"text 5,50 \'@PAF@\n\n\n/g" | \
 	sed -e "/@PAF@/r $(patsubst %.map,%.desc,$<)" -e "s/@PAF@//g" > $@
 
 %.ppm: %.map
-	$(MAP2PPM_BIN) -s $(MAPSCALE) $(COLORMAP_EXTRA) $< -o $@
+	$(MAP2PPM_BIN) -s $(MAP_SCALE) $(COLORMAP_EXTRA) $< -o $@
 
 %.png: %.ppm %.script %.desc
 	/bin/sh $(patsubst %.ppm,%.script,$<) $< $@
--- a/world/config.mak	Thu Oct 12 11:29:21 2017 +0300
+++ b/world/config.mak	Thu Oct 12 11:43:43 2017 +0300
@@ -3,15 +3,15 @@
 #
 #COLORMAP_OPTS=-u "../www/urchin.inc.php" -v -a -C
 COLORMAP_OPTS=-v -a -C
-FONT=MonospaceBold.ttf
-FONTSCALE=8.0
-UNITSIZE=4.0
-MAPSCALE=4
+MAP_FONT=MonospaceBold.ttf
+MAP_FONT_SCALE=8.0
+MAP_UNIT_SIZE=4.0
+MAP_SCALE=4
 
 BINPATH=../bin/
 EXEEXT=
 
-MAPLIST=laenor rothikgen lucentium furnachia desolathya renardy tormentas
+WORLD_MAPS=laenor rothikgen lucentium furnachia desolathya renardy tormentas
 
 BATMAPURL=http://www.bat.org/maps/raw/
-MAPMAP=laenor rothikgen lucentium furnachia desolathya renardy
+CONT_MAPS=laenor rothikgen lucentium furnachia desolathya renardy