Mercurial > hg > batmud > maputils
annotate world/Makefile @ 2505:a01c82b8b7d2
Clean up the maps build process.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 01 Aug 2023 16:17:58 +0300 |
parents | 972cd6162ea9 |
children | de2e01e4343b |
rev | line source |
---|---|
346
721bfe123726
Minor refactoring of the build files.
Matti Hamalainen <ccr@tnsp.org>
parents:
338
diff
changeset
|
1 include ../config.mak |
721bfe123726
Minor refactoring of the build files.
Matti Hamalainen <ccr@tnsp.org>
parents:
338
diff
changeset
|
2 include config.mak |
721bfe123726
Minor refactoring of the build files.
Matti Hamalainen <ccr@tnsp.org>
parents:
338
diff
changeset
|
3 |
1547 | 4 ### |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
5 ### Detect if we have some things |
2388 | 6 ### |
2492
972cd6162ea9
Redirect error outputs to /dev/null when detecting PHP etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
2463
diff
changeset
|
7 HAVE_CURL ?= $(shell curl --version > /dev/null 2>&1 && echo "yes") |
972cd6162ea9
Redirect error outputs to /dev/null when detecting PHP etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
2463
diff
changeset
|
8 HAVE_WGET ?= $(shell wget --version > /dev/null 2>&1 && echo "yes") |
972cd6162ea9
Redirect error outputs to /dev/null when detecting PHP etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
2463
diff
changeset
|
9 HAVE_PHP ?= $(shell php --version > /dev/null 2>&1 && echo "yes") |
2505
a01c82b8b7d2
Clean up the maps build process.
Matti Hamalainen <ccr@tnsp.org>
parents:
2492
diff
changeset
|
10 HAVE_GIMP_CONSOLE ?= $(shell gimp-console --version > /dev/null 2>&1 && echo "yes") |
2388 | 11 |
12 ifeq ($(HAVE_CURL),yes) | |
13 HTTPGET ?= curl -o | |
14 else | |
15 ifeq ($(HAVE_WGET),yes) | |
16 HTTPGET ?= wget -O | |
17 else | |
18 ifeq ($(HTTPGET),) | |
19 $(error Required utility 'curl' or 'wget' not found in PATH. You can configure HTTPGET variable in config.mak.) | |
20 endif | |
21 endif | |
22 endif | |
23 | |
24 | |
25 ### | |
1547 | 26 ### Main targets |
27 ### | |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
28 TARGETS = \ |
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
29 $(addsuffix .html,$(WORLD_MAPS)) \ |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
30 $(addsuffix .ansi,$(WORLD_MAPS)) \ |
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
31 $(addsuffix .png,$(WORLD_MAPS)) \ |
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
32 $(addsuffix .htm,$(WORLD_MAPS)) \ |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
33 util.js changelog.txt |
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
34 |
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
35 LOCFILES = $(addsuffix .loc,$(WORLD_MAPS)) special.loc limbo.loc |
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
36 |
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
37 ifeq ($(HAVE_PHP),yes) |
2408
f2e639d72f6f
Rename batclient.xml to markers.xml
Matti Hamalainen <ccr@tnsp.org>
parents:
2397
diff
changeset
|
38 TARGETS += markers.xml |
f2e639d72f6f
Rename batclient.xml to markers.xml
Matti Hamalainen <ccr@tnsp.org>
parents:
2397
diff
changeset
|
39 EXTRA_UPLOAD += markers.xml |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
40 endif |
1536
796cf56a9b0a
Disable plain HTML (non-javascript enhanced) versions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1515
diff
changeset
|
41 |
796cf56a9b0a
Disable plain HTML (non-javascript enhanced) versions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1515
diff
changeset
|
42 |
1547 | 43 ### |
44 ### If no target specified, show some help | |
45 ### | |
842
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
46 all: |
2067 | 47 @echo "Usage: make <target>" |
48 @echo "Available targets are as follows:" | |
49 @echo | |
50 @echo "maps : Build HTML, HTML+JS, PNG image and ANSI format maps." | |
51 @echo "fetch : Fetch latest raw ASCII map data from bat.org." | |
842
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
52 @echo |
2067 | 53 @echo "diff : Do special diff operation between new data (gotten via 'fetch')" |
54 @echo " and update .loc files for each continent with new locations." | |
55 @echo " A diff -u of new and old location files is outputted." | |
56 @echo | |
57 @echo "upload : Uploads map and loc-files via SCP to server specified in" | |
58 @echo " ../config.mak" | |
59 @echo | |
60 @echo "gimp : Execute Gimp with all PNG targets for post-processing." | |
61 @echo "clean : Delete all the generated files." | |
1512 | 62 @echo |
842
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
63 |
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
64 |
1547 | 65 ### |
66 ### Maps | |
67 ### | |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
68 maps: $(addsuffix .ppm,$(WORLD_MAPS)) $(TARGETS) |
39 | 69 |
1547 | 70 include Makefile.inc |
346
721bfe123726
Minor refactoring of the build files.
Matti Hamalainen <ccr@tnsp.org>
parents:
338
diff
changeset
|
71 |
2317
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
72 |
950 | 73 ### |
74 ### Special targets | |
75 ### | |
2317
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
76 changelog.txt: $(addsuffix .map,$(WORLD_MAPS)) \ |
2438
f90494b8efa7
Possibly fix the changelog.txt not updating properly -issue.
Matti Hamalainen <ccr@tnsp.org>
parents:
2421
diff
changeset
|
77 $(addsuffix .loc,$(WORLD_MAPS)) \ |
2317
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
78 $(addprefix ../$(MISC_MAPS_PATH),$(addsuffix .map,$(MISC_MAPS))) \ |
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
79 $(addprefix ../$(MISC_MAPS_PATH),$(addsuffix .loc,$(MISC_MAPS))) |
2463
7a33f1beaf71
Adjust changelog generation rule: hg up && ... instead of hg up ; ...
Matti Hamalainen <ccr@tnsp.org>
parents:
2438
diff
changeset
|
80 @hg up && ( echo '<?xml version="1.0"?>' && echo '<log>' && \ |
2069
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
81 hg log $+ -M -v -f --template \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
82 '<logentry revision="{rev}"><author>{author|escape}</author><date>{date|isodate}</date><paths><path>{files}</path></paths><msg>{desc|escape}</msg></logentry>\n' && \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
83 echo '</log>' ) | \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
84 iconv -f "iso-8859-1" -t "utf-8" | \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
85 xsltproc --stringparam strip-prefix "" \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
86 --stringparam linelen 80 \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
87 --stringparam groupbyday yes \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
88 --stringparam include-rev no \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
89 "svn2cl.xsl" - | \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
90 sed 's/world\///g;s/maps\///g;s/Matti .*/Ggr/g;s/Jarkko .*/Jeskko/g' \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
91 > $@ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
92 |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
93 |
2408
f2e639d72f6f
Rename batclient.xml to markers.xml
Matti Hamalainen <ccr@tnsp.org>
parents:
2397
diff
changeset
|
94 # Build Batclient markers.xml |
f2e639d72f6f
Rename batclient.xml to markers.xml
Matti Hamalainen <ccr@tnsp.org>
parents:
2397
diff
changeset
|
95 markers.xml: $(addsuffix .loc,$(WORLD_MAPS)) $(MKLOC_BIN) ../www/world.inc.php |
2395
42ee2079a69d
Rename generate_batclient_xml.php to genbcxml.php
Matti Hamalainen <ccr@tnsp.org>
parents:
2388
diff
changeset
|
96 php ../src/genbcxml.php $(MKLOC_BIN) ./ ../www/world.inc.php $@ |
2387
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
97 |
2069
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
98 |
950 | 99 # Upload changed files to site |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
100 upload: $(TARGETS) $(LOCFILES) $(EXTRA_UPLOAD) |
2047
7b18fb64dff1
Use rsync + ssh instead of scp for uploads.
Matti Hamalainen <ccr@tnsp.org>
parents:
1858
diff
changeset
|
101 $(RSCP) $? $(UPLOAD_URL) |
1623 | 102 @touch $@ |
95
0d2b25e342df
Also make PNG images from maps
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
103 |
950 | 104 # Upload only *.loc files |
2397
b76c25ad1b99
Change how batclient.xml is uploaded. Some improvements to the build rules.
Matti Hamalainen <ccr@tnsp.org>
parents:
2395
diff
changeset
|
105 uploc: $(LOCFILES) $(EXTRA_UPLOAD) |
2047
7b18fb64dff1
Use rsync + ssh instead of scp for uploads.
Matti Hamalainen <ccr@tnsp.org>
parents:
1858
diff
changeset
|
106 $(RSCP) $+ $(UPLOAD_URL) |
291
b78d089a0cf4
Upload target for location files only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
107 |
950 | 108 # Fetch raw ASCII maps from bat.org to *.new |
459 | 109 fetch: |
2369 | 110 @for AMAP in $(CONT_MAPS); do echo "Fetching $${AMAP}.new"; $(HTTPGET) "$${AMAP}.new" "$(BATMAPURL)$${AMAP}.txt"; done |
459 | 111 |
112 | |
950 | 113 # Remove all temporary .diff files |
653
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
114 cleardiff: |
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
115 $(RM) *.diff |
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
116 |
950 | 117 # Diff target - run diff for each .map and .new (fetched via 'fetch' target). |
1069
25cf3cf2acc8
Change to use Mercurial instead of Subversion.
Matti Hamalainen <ccr@tnsp.org>
parents:
950
diff
changeset
|
118 # Finally do 'hg diff' to show changes. |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
119 diff: cleardiff $(addsuffix .diff,$(CONT_MAPS)) |
1155
2f7ca3ec98e8
Only 'hg diff' current directory with 'make diff'.
Matti Hamalainen <ccr@tnsp.org>
parents:
1069
diff
changeset
|
120 @hg diff . |
459 | 121 |
2348
6ef9445390d2
Move Javascript files under src/ too.
Matti Hamalainen <ccr@tnsp.org>
parents:
2318
diff
changeset
|
122 %.js:: ../src/%.js |
1623 | 123 @ln -s $< $@ |
124 | |
950 | 125 # Clean temporary and generated targets |
39 | 126 clean: |
937
9342d636bc21
Remove *.script files on clean target.
Matti Hamalainen <ccr@tnsp.org>
parents:
911
diff
changeset
|
127 $(RM) $(TARGETS) *.diff *.ppm *.o *.script |
39 | 128 |
129 srcclean: clean | |
299 | 130 $(RM) *~ |