changeset 2621:9ef91b0032f3

Refactor some of the 'make diff' code to Makefile.maps and add 'diff' target to old/Makefile too.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 17 Feb 2024 18:25:13 +0200
parents 164aa519640d
children 4c239ed3d768
files Makefile.maps old/Makefile world/Makefile
diffstat 3 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.maps	Fri Feb 16 23:50:59 2024 +0200
+++ b/Makefile.maps	Sat Feb 17 18:25:13 2024 +0200
@@ -37,3 +37,15 @@
 %.ansi: %.tmp1 %.desc $(COLORMAP_BIN)
 	@echo "COLORMAP $@"
 	@$(COLORMAP_BIN) $(COLORMAP_OPTS) $(COLORMAP_EXTRA) -f ansi -t "`cat $(patsubst %.tmp1,%.desc,$<)`" -o $@ $<
+
+
+###
+### Diff target between .map file and .new file. Makes necessary changes in .map and .loc
+###
+%.diff: %.map %.new
+	@echo "DIFFING $< ..."
+	@if $(DIFFMAP_BIN) $(DIFFMAP_OPTS) $+ -o $@ -a; then \
+		$(PATCHMAP_BIN) $< $@ -o $<; \
+	fi
+	@$(MKLOC_BIN) $(MKLOC_DIFF_OPTS) -v -m $(patsubst %.map,%.new,$<) -l $(patsubst %.map,%.loc,$<) -L -g -o $(patsubst %.map,%.nloc,$<)
+	@diff -ubB $(patsubst %.map,%.loc,$<) $(patsubst %.map,%.nloc,$<) | patch
--- a/old/Makefile	Fri Feb 16 23:50:59 2024 +0200
+++ b/old/Makefile	Sat Feb 17 18:25:13 2024 +0200
@@ -43,6 +43,14 @@
 		echo "WARNING: perl not found, not updating $@"; \
 	fi
 
+# Remove all temporary .diff files
+cleardiff:
+	$(RM) *.diff
+
+# Diff target - run diff for each .map and .new
+# Finally do 'hg diff' to show changes.
+diff: cleardiff $(addsuffix .diff,hcbat)
+	@hg diff .
 
 ###
 ### Special targets
--- a/world/Makefile	Fri Feb 16 23:50:59 2024 +0200
+++ b/world/Makefile	Sat Feb 17 18:25:13 2024 +0200
@@ -101,17 +101,6 @@
 endif
 
 
-###
-### Diff target between .map file and .new file. Makes necessary changes in .map and .loc
-###
-%.diff: %.map %.new
-	@echo "DIFFING $< ..."
-	@if $(DIFFMAP_BIN) $(DIFFMAP_OPTS) $+ -o $@ -a; then \
-		$(PATCHMAP_BIN) $< $@ -o $<; \
-	fi
-	@$(MKLOC_BIN) $(MKLOC_DIFF_OPTS) -v -m $(patsubst %.map,%.new,$<) -l $(patsubst %.map,%.loc,$<) -L -g -o $(patsubst %.map,%.nloc,$<)
-	@diff -ubB $(patsubst %.map,%.loc,$<) $(patsubst %.map,%.nloc,$<) | patch
-
 # Fetch raw ASCII maps from bat.org to *.new
 fetch:
 	@for AMAP in $(CONT_MAPS); do echo "Fetching $${AMAP}.new"; $(HTTPGET) "$${AMAP}.new" "$(BATMAP_URL)$${AMAP}.txt"; done
@@ -126,6 +115,7 @@
 diff: cleardiff $(addsuffix .diff,$(CONT_MAPS))
 	@hg diff .
 
+
 %.js:: ../src/%.js
 	@ln -s $< $@