Mercurial > hg > batmud > maputils
annotate world/Makefile @ 2388:e845f54be995
Autodetect curl or wget.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 06 Nov 2021 18:11:40 +0200 |
parents | 53c34aaf4515 |
children | 42ee2079a69d |
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 ### |
2388 | 5 ### Detect curl or wget |
6 ### | |
7 HAVE_CURL ?= $(shell curl --version > /dev/null && echo "yes") | |
8 HAVE_WGET ?= $(shell wget --version > /dev/null && echo "yes") | |
9 | |
10 ifeq ($(HAVE_CURL),yes) | |
11 HTTPGET ?= curl -o | |
12 else | |
13 ifeq ($(HAVE_WGET),yes) | |
14 HTTPGET ?= wget -O | |
15 else | |
16 ifeq ($(HTTPGET),) | |
17 $(error Required utility 'curl' or 'wget' not found in PATH. You can configure HTTPGET variable in config.mak.) | |
18 endif | |
19 endif | |
20 endif | |
21 | |
22 | |
23 ### | |
1547 | 24 ### Main targets |
25 ### | |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
26 TARGETS=$(addsuffix .html,$(WORLD_MAPS)) \ |
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
27 $(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
|
28 $(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
|
29 $(addsuffix .htm,$(WORLD_MAPS)) \ |
1624 | 30 util.js |
1536
796cf56a9b0a
Disable plain HTML (non-javascript enhanced) versions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1515
diff
changeset
|
31 |
796cf56a9b0a
Disable plain HTML (non-javascript enhanced) versions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1515
diff
changeset
|
32 |
1547 | 33 ### |
34 ### If no target specified, show some help | |
35 ### | |
842
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
36 all: |
2067 | 37 @echo "Usage: make <target>" |
38 @echo "Available targets are as follows:" | |
39 @echo | |
40 @echo "maps : Build HTML, HTML+JS, PNG image and ANSI format maps." | |
41 @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
|
42 @echo |
2067 | 43 @echo "diff : Do special diff operation between new data (gotten via 'fetch')" |
44 @echo " and update .loc files for each continent with new locations." | |
45 @echo " A diff -u of new and old location files is outputted." | |
46 @echo | |
47 @echo "upload : Uploads map and loc-files via SCP to server specified in" | |
48 @echo " ../config.mak" | |
49 @echo | |
50 @echo "gimp : Execute Gimp with all PNG targets for post-processing." | |
51 @echo "clean : Delete all the generated files." | |
2069
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
52 @echo "changelog : Build changelog for map and location changes only." |
1512 | 53 @echo |
842
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
54 |
f5dda74e6e07
Print help if no target is given. Remove generation of worldmap.
Matti Hamalainen <ccr@tnsp.org>
parents:
807
diff
changeset
|
55 |
1547 | 56 ### |
57 ### Maps | |
58 ### | |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
59 maps: $(addsuffix .ppm,$(WORLD_MAPS)) $(TARGETS) |
39 | 60 |
1547 | 61 include Makefile.inc |
346
721bfe123726
Minor refactoring of the build files.
Matti Hamalainen <ccr@tnsp.org>
parents:
338
diff
changeset
|
62 |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
63 LOCLIST=$(addsuffix .loc,$(WORLD_MAPS)) special.loc limbo.loc |
99 | 64 |
2317
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
65 |
950 | 66 ### |
67 ### Special targets | |
68 ### | |
2317
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
69 changelog.txt: $(addsuffix .map,$(WORLD_MAPS)) \ |
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
70 $(LOCLIST) \ |
f90303eec665
Include misc maps in generated changelog as well.
Matti Hamalainen <ccr@tnsp.org>
parents:
2315
diff
changeset
|
71 $(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
|
72 $(addprefix ../$(MISC_MAPS_PATH),$(addsuffix .loc,$(MISC_MAPS))) |
2069
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
73 @( echo '<?xml version="1.0"?>' && echo '<log>' && \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
74 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
|
75 '<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
|
76 echo '</log>' ) | \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
77 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
|
78 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
|
79 --stringparam linelen 80 \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
80 --stringparam groupbyday yes \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
81 --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
|
82 "svn2cl.xsl" - | \ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
83 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
|
84 > $@ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
85 |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
86 # Build changelog |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
87 changelog: changelog.txt |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
88 @touch $@ |
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
89 |
2387
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
90 # Build batclient.xml |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
91 HAVE_PHP ?= $(shell php --version > /dev/null && echo "yes") |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
92 ifeq ($(HAVE_PHP),yes) |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
93 TARGETS += batclient.xml |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
94 |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
95 batclient.xml: $(addsuffix .loc,$(WORLD_MAPS)) $(MKLOC_BIN) ../www/world.inc.php |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
96 php ../src/generate_batclient_xml.php $(MKLOC_BIN) ./ ../www/world.inc.php $@ |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
97 |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
98 endif |
53c34aaf4515
Add PHP kludge for generating batclient.xml and necessary Makefile rules for
Matti Hamalainen <ccr@tnsp.org>
parents:
2369
diff
changeset
|
99 |
2069
d0e00cd7b2a5
Add make target for building changelog.txt, that contains cleaned up
Matti Hamalainen <ccr@tnsp.org>
parents:
2067
diff
changeset
|
100 |
950 | 101 # Upload changed files to site |
2318
7424be5d9d3c
Do not upload changelog with 'changelog' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
2317
diff
changeset
|
102 upload: $(TARGETS) $(LOCLIST) changelog.txt |
2047
7b18fb64dff1
Use rsync + ssh instead of scp for uploads.
Matti Hamalainen <ccr@tnsp.org>
parents:
1858
diff
changeset
|
103 $(RSCP) $? $(UPLOAD_URL) |
1623 | 104 @touch $@ |
95
0d2b25e342df
Also make PNG images from maps
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
105 |
1514
835360392879
Add target for automatically running Gimp for PNG post-processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1512
diff
changeset
|
106 # Open PNG files in Gimp |
1708
9a124fdb6dab
Rename various Makefile variables and improve + modularize hcbat-related things better.
Matti Hamalainen <ccr@tnsp.org>
parents:
1707
diff
changeset
|
107 gimp: $(addsuffix .png,$(WORLD_MAPS)) |
1621
471fa81c6c67
Improve 'make gimp' target a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1586
diff
changeset
|
108 -@ls -lt $+ gimp |
471fa81c6c67
Improve 'make gimp' target a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1586
diff
changeset
|
109 @gimp $+ && touch $@ |
471fa81c6c67
Improve 'make gimp' target a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
1586
diff
changeset
|
110 -@ls -lt $+ gimp |
1514
835360392879
Add target for automatically running Gimp for PNG post-processing.
Matti Hamalainen <ccr@tnsp.org>
parents:
1512
diff
changeset
|
111 |
950 | 112 # Upload only *.loc files |
1585
f1c40a6a4019
Fix and improve *.loc file uploads.
Matti Hamalainen <ccr@tnsp.org>
parents:
1575
diff
changeset
|
113 uploc: $(LOCLIST) |
2047
7b18fb64dff1
Use rsync + ssh instead of scp for uploads.
Matti Hamalainen <ccr@tnsp.org>
parents:
1858
diff
changeset
|
114 $(RSCP) $+ $(UPLOAD_URL) |
291
b78d089a0cf4
Upload target for location files only.
Matti Hamalainen <ccr@tnsp.org>
parents:
255
diff
changeset
|
115 |
950 | 116 # Fetch raw ASCII maps from bat.org to *.new |
459 | 117 fetch: |
2369 | 118 @for AMAP in $(CONT_MAPS); do echo "Fetching $${AMAP}.new"; $(HTTPGET) "$${AMAP}.new" "$(BATMAPURL)$${AMAP}.txt"; done |
459 | 119 |
120 | |
950 | 121 # Remove all temporary .diff files |
653
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
122 cleardiff: |
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
123 $(RM) *.diff |
b5bd0d457481
Improved 'make diff' target.
Matti Hamalainen <ccr@tnsp.org>
parents:
605
diff
changeset
|
124 |
950 | 125 # 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
|
126 # 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
|
127 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
|
128 @hg diff . |
459 | 129 |
2348
6ef9445390d2
Move Javascript files under src/ too.
Matti Hamalainen <ccr@tnsp.org>
parents:
2318
diff
changeset
|
130 %.js:: ../src/%.js |
1623 | 131 @ln -s $< $@ |
132 | |
950 | 133 # Clean temporary and generated targets |
39 | 134 clean: |
937
9342d636bc21
Remove *.script files on clean target.
Matti Hamalainen <ccr@tnsp.org>
parents:
911
diff
changeset
|
135 $(RM) $(TARGETS) *.diff *.ppm *.o *.script |
39 | 136 |
137 srcclean: clean | |
299 | 138 $(RM) *~ |
39 | 139 |
297
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
140 .changelog: update |
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
141 @echo "* Making ChangeLog ..." |
1547 | 142 @hg2cl |
297
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
143 @touch $@ |
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
144 |
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
145 ChangeLog: .changelog |
5482736f3913
ChangeLog generation target added.
Matti Hamalainen <ccr@tnsp.org>
parents:
291
diff
changeset
|
146 |