| 1 |
# |
| 2 |
# |
| 3 |
# |
| 4 |
NAME := wargame |
| 5 |
VERSION := 0.8 |
| 6 |
LATEX_FLAGS := -interaction=nonstopmode \ |
| 7 |
-file-line-error \ |
| 8 |
--synctex=15 \ |
| 9 |
-shell-escape |
| 10 |
LATEX := pdflatex |
| 11 |
MAKEINDEX := makeindex |
| 12 |
SED := sed |
| 13 |
CTANOMAT := ctan-o-mat |
| 14 |
CTANOMAT_FLAGS := -n |
| 15 |
SOURCES := wargame.ins \ |
| 16 |
wargame.dtx \ |
| 17 |
package.dtx \ |
| 18 |
util/core.dtx \ |
| 19 |
util/misc.dtx \ |
| 20 |
util/compound.dtx \ |
| 21 |
util/bb.dtx \ |
| 22 |
util/tikz.dtx \ |
| 23 |
util/randomid.dtx \ |
| 24 |
util/icons.dtx \ |
| 25 |
util/export.dtx \ |
| 26 |
chit/shape.dtx \ |
| 27 |
chit/misc.dtx \ |
| 28 |
chit/modifiers.dtx \ |
| 29 |
chit/stack.dtx \ |
| 30 |
chit/oob.dtx \ |
| 31 |
chit/table.dtx \ |
| 32 |
chit/battle.dtx \ |
| 33 |
chit/dice.dtx \ |
| 34 |
chit/elements.dtx \ |
| 35 |
chit/core.dtx \ |
| 36 |
hex/shape.dtx \ |
| 37 |
hex/tile.dtx \ |
| 38 |
hex/ridges.dtx \ |
| 39 |
hex/towns.dtx \ |
| 40 |
hex/terrain.dtx \ |
| 41 |
hex/paths.dtx \ |
| 42 |
hex/core.dtx \ |
| 43 |
hex/labels.dtx \ |
| 44 |
hex/extra.dtx \ |
| 45 |
hex/terrain/woods.dtx \ |
| 46 |
hex/terrain/town.dtx \ |
| 47 |
hex/terrain/tree.dtx \ |
| 48 |
hex/terrain/beach.dtx \ |
| 49 |
hex/terrain/mountain.dtx \ |
| 50 |
hex/terrain/light_woods.dtx \ |
| 51 |
hex/terrain/mountains.dtx \ |
| 52 |
hex/terrain/village.dtx \ |
| 53 |
hex/terrain/city.dtx \ |
| 54 |
hex/terrain/swamp.dtx \ |
| 55 |
hex/terrain/rough.dtx \ |
| 56 |
hex/terrain/fields.dtx \ |
| 57 |
hex/terrain/speckle.dtx \ |
| 58 |
hex/board.dtx \ |
| 59 |
hex/coord.dtx \ |
| 60 |
hex/split.dtx \ |
| 61 |
natoapp6c/shape.dtx \ |
| 62 |
natoapp6c/symbols.dtx \ |
| 63 |
natoapp6c/list.dtx \ |
| 64 |
natoapp6c/compat/seasurface.dtx \ |
| 65 |
natoapp6c/compat/activity.dtx \ |
| 66 |
natoapp6c/compat/subsurface.dtx \ |
| 67 |
natoapp6c/compat/missile.dtx \ |
| 68 |
natoapp6c/compat/air.dtx \ |
| 69 |
natoapp6c/compat/seamine.dtx \ |
| 70 |
natoapp6c/compat/land.dtx \ |
| 71 |
natoapp6c/compat/equipment.dtx \ |
| 72 |
natoapp6c/compat/installation.dtx \ |
| 73 |
natoapp6c/compat/space.dtx \ |
| 74 |
natoapp6c/frames/hostile.dtx \ |
| 75 |
natoapp6c/frames/base.dtx \ |
| 76 |
natoapp6c/frames/friendly.dtx \ |
| 77 |
natoapp6c/frames/neutral.dtx \ |
| 78 |
natoapp6c/frames/unknown.dtx \ |
| 79 |
natoapp6c/weaponry.dtx \ |
| 80 |
natoapp6c/core.dtx \ |
| 81 |
natoapp6c/text.dtx \ |
| 82 |
natoapp6c/echelon.dtx \ |
| 83 |
natoapp6c/util.dtx \ |
| 84 |
tests/map.dtx \ |
| 85 |
tests/chits.dtx |
| 86 |
SCRIPTS := utils/wgsvg2tikz.py \ |
| 87 |
utils/wgexport.py \ |
| 88 |
utils/wgmakenato.py |
| 89 |
|
| 90 |
DESTDIR := $(HOME)/texmf/ |
| 91 |
instdir := tex/latex/$(NAME) |
| 92 |
docdir := doc/latex/$(NAME) |
| 93 |
srcdir := source/latex/$(NAME) |
| 94 |
ctandir := ctan |
| 95 |
distsdir := $(NAME)-$(VERSION) |
| 96 |
|
| 97 |
TILES := beach \ |
| 98 |
city \ |
| 99 |
light_woods \ |
| 100 |
mountains \ |
| 101 |
rough \ |
| 102 |
swamp \ |
| 103 |
town \ |
| 104 |
village \ |
| 105 |
woods \ |
| 106 |
fields \ |
| 107 |
speckle |
| 108 |
TILES_PDF := $(TILES:%=wargame.%.pdf) |
| 109 |
TILES_TEX := $(TILES:%=wargame.%.tex) |
| 110 |
TABLES := air \ |
| 111 |
missile \ |
| 112 |
land \ |
| 113 |
equipment \ |
| 114 |
installation \ |
| 115 |
seasurface \ |
| 116 |
subsurface \ |
| 117 |
seamine \ |
| 118 |
space \ |
| 119 |
activity |
| 120 |
PKG_FILES := wargame.sty \ |
| 121 |
tikzlibrarywargame.util.code.tex \ |
| 122 |
tikzlibrarywargame.hex.code.tex \ |
| 123 |
tikzlibrarywargame.natoapp6c.code.tex \ |
| 124 |
tikzlibrarywargame.chit.code.tex \ |
| 125 |
wgexport.cls \ |
| 126 |
$(TILES_PDF) |
| 127 |
|
| 128 |
DOC_FILES := wargame.pdf symbols.pdf compat.pdf |
| 129 |
|
| 130 |
ifdef VERBOSE |
| 131 |
MUTE := |
| 132 |
REDIR := |
| 133 |
LATEX_FLAGS := |
| 134 |
else |
| 135 |
MUTE := @ |
| 136 |
REDIR := > /dev/null 2>&1 |
| 137 |
endif |
| 138 |
ifdef CI_COMMIT_REF_NAME |
| 139 |
VERSION := $(CI_COMMIT_REF_NAME) |
| 140 |
else |
| 141 |
ifdef := $(CI_JOB_ID) |
| 142 |
endif |
| 143 |
|
| 144 |
%.pdf:%.tex |
| 145 |
@echo "LATEX $< -> $@" |
| 146 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $< $(REDIR) |
| 147 |
|
| 148 |
%.aux:%.tex |
| 149 |
@echo "LATEX $< -> $@" |
| 150 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $< $(REDIR) |
| 151 |
|
| 152 |
%.idx:%.dtx |
| 153 |
@echo "LATEX $< -> $@" |
| 154 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $< $(REDIR) |
| 155 |
|
| 156 |
%.aux:%.idx |
| 157 |
@echo "LATEX $*.dtx -> $@ (via $<)" |
| 158 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $*.dtx $(REDIR) |
| 159 |
$(MUTE)touch $< $@ |
| 160 |
|
| 161 |
%.pdf:%.aux %.ind |
| 162 |
@echo "LATEX $*.dtx -> $@ (via $<)" |
| 163 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $*.dtx $(REDIR) |
| 164 |
$(MUTE)touch $^ $@ |
| 165 |
|
| 166 |
%.pdf:%.aux %.tex |
| 167 |
@echo "LATEX $*.tex -> $@ (via $<)" |
| 168 |
$(MUTE)$(LATEX) $(LATEX_FLAGS) $*.tex $(REDIR) |
| 169 |
|
| 170 |
|
| 171 |
%.ind:%.idx |
| 172 |
@echo "INDEX $< -> $@ $<" |
| 173 |
$(MUTE)$(MAKEINDEX) -s gind -o $@ $< $(REDIR) |
| 174 |
$(MUTE)touch $^ $@ |
| 175 |
|
| 176 |
%.gls:%.glo |
| 177 |
@echo "GLOSSAY $< -> $@" |
| 178 |
$(MUTE)$(MAKEINDEX) -s gglo -o $@ $< $(REDIR) |
| 179 |
$(MUTE)touch $^ $@ |
| 180 |
|
| 181 |
all: wargame.pdf |
| 182 |
|
| 183 |
package: $(PKG_FILES) |
| 184 |
|
| 185 |
everything: all symbols.pdf compat.pdf tests/test.pdf |
| 186 |
|
| 187 |
tutorial: tutorial/game.pdf |
| 188 |
tutorial/game.pdf: all |
| 189 |
@echo "MAKE -C tutorial Game.vmod" |
| 190 |
$(MUTE)$(MAKE) -C tutorial Game.vmod |
| 191 |
|
| 192 |
clean: |
| 193 |
@echo "CLEAN" |
| 194 |
$(MUTE)rm -f *~ *.log* *.aux *.toc *.lof *.lot *.out *.ilg *.idx *.ind |
| 195 |
$(MUTE)rm -f cmp_*.tex *.synctex* *.hd |
| 196 |
$(MUTE)rm -f symbols.tex compat.tex testmap.tex testchits.tex |
| 197 |
$(MUTE)rm -f wargame.sty wgdoc.sty logo.png logo.pdf |
| 198 |
$(MUTE)rm -f symbols.pdf compat.pdf test.pdf wargame.pdf |
| 199 |
$(MUTE)rm -f tikzlibrarywargame.util.code.tex |
| 200 |
$(MUTE)rm -f tikzlibrarywargame.hex.code.tex |
| 201 |
$(MUTE)rm -f tikzlibrarywargame.natoapp6c.code.tex |
| 202 |
$(MUTE)rm -f tikzlibrarywargame.chit.code.tex |
| 203 |
$(MUTE)rm -f wgexport.cls mksvg.pdf README.md.version |
| 204 |
$(MUTE)rm -f $(TILES_TEX) $(TILES_PDF) |
| 205 |
$(MUTE)rm -rf public texmf tex doc |
| 206 |
$(MUTE)rm -rf $(distsdir) |
| 207 |
$(MUTE)rm -f $(distsdir).tar.gz |
| 208 |
$(MUTE)rm -f $(distsdir).zip |
| 209 |
$(MUTE)rm -f $(NAME).tar.gz |
| 210 |
$(MUTE)rm -rf __pycache__ |
| 211 |
$(MUTE)rm -rf $(ctandir) tmp |
| 212 |
$(MUTE)rm -f ctan.tex $(NAME).ctan.tar.gz |
| 213 |
$(MUTE)$(MAKE) -C tutorial clean |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
wargame.sty \ |
| 218 |
testmap.tex \ |
| 219 |
testchits.tex \ |
| 220 |
wgdoc.sty \ |
| 221 |
compat.tex \ |
| 222 |
symbols.tex \ |
| 223 |
tikzlibrarywargame.hex.code.tex \ |
| 224 |
tikzlibrarywargame.natoapp6c.code.tex \ |
| 225 |
tikzlibrarywargame.chit.code.tex \ |
| 226 |
wgexport.cls \ |
| 227 |
$(TILES_TEX) \ |
| 228 |
$(TABLES:%=cmp_%.tex): $(SOURCES) |
| 229 |
@echo "DOCSTRIP $<" |
| 230 |
$(MUTE)$(LATEX) $< $(REDIR) |
| 231 |
|
| 232 |
wargame.idx: wargame.dtx wargame.sty $(TILES_PDF) |
| 233 |
wargame.pdf: wargame.aux wargame.ind |
| 234 |
fast: wargame.idx |
| 235 |
symbols.aux: symbols.tex wargame.sty |
| 236 |
symbols.pdf: symbols.aux |
| 237 |
compat.aux: compat.tex $(TABLES:%=cmp_%.tex) wargame.sty |
| 238 |
compat.pdf: compat.aux |
| 239 |
test.aux: test.tex wargame.sty |
| 240 |
|
| 241 |
beach.pdf: beach.tex |
| 242 |
city.pdf: city.tex |
| 243 |
light_woods.pdf:light_woods.tex |
| 244 |
mountains.pdf: mountains.tex |
| 245 |
rough.pdf: rough.tex |
| 246 |
swamp.pdf: swamp.tex |
| 247 |
town.pdf: town.tex |
| 248 |
village.pdf: village.tex |
| 249 |
woods.pdf: woods.tex |
| 250 |
|
| 251 |
install-devel: all |
| 252 |
(cd $(dir $(DESTDIR)/$(instdir)) && \ |
| 253 |
rm -f $(notdir $(instdir)) && \ |
| 254 |
ln -fs $(PWD) $(notdir $(instdir))) |
| 255 |
|
| 256 |
install:$(PKG_FILES) $(DOC_FILES) $(SCRIPTS) |
| 257 |
@echo "Installing DESTDIR=$(DESTDIR)" |
| 258 |
$(MUTE)mkdir -p $(DESTDIR)$(instdir) |
| 259 |
$(MUTE)mkdir -p $(DESTDIR)$(docdir) |
| 260 |
$(MUTE)cp $(PKG_FILES) $(DESTDIR)$(instdir) |
| 261 |
$(MUTE)cp $(DOC_FILES) $(DESTDIR)$(docdir) |
| 262 |
$(MUTE)cp $(SCRIPTS) $(DESTDIR)$(instdir) |
| 263 |
|
| 264 |
uninstall: |
| 265 |
rm -rf $(DESTDIR)$(instdir) |
| 266 |
rm -rf $(DESTDIR)$(docdir) |
| 267 |
|
| 268 |
distdir:$(SOURCES) $(SCRIPTS) Makefile tests/test.tex |
| 269 |
$(MUTE)rm -rf $(distsdir) |
| 270 |
$(MUTE)mkdir -p $(distsdir) |
| 271 |
$(foreach s, $^, \ |
| 272 |
mkdir -p $(distsdir)/$(shell dirname $(s)); \ |
| 273 |
cp $(s) $(distsdir)/$(s);) |
| 274 |
|
| 275 |
distcheck:distdir |
| 276 |
$(MAKE) $(MAKEFLAGS) -C $(distsdir) everything |
| 277 |
|
| 278 |
dist:distdir |
| 279 |
zip -r $(distsdir).zip $(distsdir) |
| 280 |
|
| 281 |
bindist: DESTDIR:=$(distsdir)/ |
| 282 |
bindist:install |
| 283 |
zip -r $(distsdir).zip $(distsdir) |
| 284 |
|
| 285 |
|
| 286 |
logo.png:logo.pdf |
| 287 |
pdftocairo -transp -png $< |
| 288 |
mv logo-1.png logo.png |
| 289 |
|
| 290 |
README.md.version:README.md |
| 291 |
@echo "Versioned README.md $(VERSION)" |
| 292 |
$(MUTE)$(SED) 's/^# \(.*\)/# \1\n## Version $(VERSION)/' \ |
| 293 |
< $< | pandoc --to markdown > $@ |
| 294 |
|
| 295 |
ctandir: all tutorial/game.pdf README.md.version |
| 296 |
@echo "Preparing CTAN directory" |
| 297 |
$(MUTE)$(MAKE) install DESTDIR:=tmp/ |
| 298 |
$(MUTE)mkdir -p tmp/$(docdir)/tutorial |
| 299 |
$(MUTE)cp $(foreach i, game.tex game.sty export.tex patch.py \ |
| 300 |
README.md Makefile game.pdf,\ |
| 301 |
tutorial/$(i)) tmp/$(docdir)/tutorial |
| 302 |
$(MUTE)cp README.md.version tmp/$(docdir)/README.md |
| 303 |
$(MUTE)$(MAKE) distdir distsdir:=tmp/$(srcdir) $(REDIR) |
| 304 |
$(MUTE)mkdir -p $(ctandir)/$(NAME) |
| 305 |
$(MUTE)cp tmp/$(docdir)/README.md $(ctandir)/$(NAME)/ |
| 306 |
$(MUTE)(cd tmp && zip -q -r ../$(ctandir)/$(NAME).tds.zip *) |
| 307 |
$(MUTE)rm tmp/$(docdir)/README.md |
| 308 |
$(MUTE)(cd tmp && cp -a $(docdir) ../$(ctandir)/$(NAME)/doc) |
| 309 |
$(MUTE)(cd tmp && cp -a $(srcdir) ../$(ctandir)/$(NAME)/source) |
| 310 |
$(MUTE) rm -rf tmp |
| 311 |
|
| 312 |
ctan.tex:utils/ctan.tex.in |
| 313 |
@echo "SED $< -> $@" |
| 314 |
$(MUTE)$(SED) -e 's/@NAME@/$(NAME)/g' \ |
| 315 |
-e 's/@VERSION@/$(VERSION)/' \ |
| 316 |
< $< > $@ |
| 317 |
|
| 318 |
ctandist: $(NAME).ctan.tar.gz |
| 319 |
$(NAME).ctan.tar.gz: ctandir |
| 320 |
@echo "TAR $@" |
| 321 |
$(MUTE)rm -f $@ |
| 322 |
$(MUTE)(cd $(ctandir) && tar -czf ../$(NAME).ctan.tar.gz *) |
| 323 |
$(MUTE)rm -rf $(ctandir) tmp |
| 324 |
|
| 325 |
|
| 326 |
ctan-upload:ctan.tex $(NAME).ctan.tar.gz |
| 327 |
@echo "CTAN $< -> CTAN ($(CTANOMAT_FLAGS))" |
| 328 |
$(MUTE)$(CTANOMAT) $(CTANOMAT_FLAGS) -c $< |
| 329 |
|
| 330 |
|
| 331 |
docker: |
| 332 |
docker run --user root --group-add users -e GRANT_SUDO=yes -it --rm \ |
| 333 |
-v $(PWD):/root/$(notdir $(PWD)) texlive/texlive \ |
| 334 |
/bin/bash |
| 335 |
|
| 336 |
docker-prep: |
| 337 |
apt update |
| 338 |
apt install -y poppler-utils python3-pil pandoc zip \ |
| 339 |
libwww-mechanize-perl libfile-copy-recursive-perl |
| 340 |
pwd |
| 341 |
ls |
| 342 |
make clean |
| 343 |
|
| 344 |
docker-artifacts: DESTDIR=$(PWD)/ |
| 345 |
docker-artifacts: install tutorial/game.pdf |
| 346 |
cp tutorial/game.pdf $(DESTDIR)$(docdir)/tutorial.pdf |
| 347 |
cp tutorial/Game.vmod $(DESTDIR)$(docdir)/Game.vmod |
| 348 |
|
| 349 |
|
| 350 |
# |
| 351 |
# EOF |
| 352 |
# |