Ready to ship 1.10
[wumpus.git] / Makefile
1 #
2 # Makefile for `Hunt the Wumpus' and `Superhack' games
3 #
4 # SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
5 # SPDX-License-Identifier: BSD-2-Clause
6
7 VERS=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1)
8
9 prefix?=/usr
10
11 CFLAGS = -Wall
12
13 all: wumpus superhack
14
15 wumpus: wumpus.c
16         $(CC) $(CFLAGS) wumpus.c -o wumpus
17
18 superhack: superhack.c
19         $(CC) $(CFLAGS) superhack.c -o superhack
20
21 clean:
22         rm -f wumpus wumpus.o superhack superhack.o TAGS *.6 
23         rm -f *~ *.1 *.html *.tar.gz MANIFEST
24
25 TAGS:
26         etags wumpus.c
27
28 # Note: to suppress the footers with timestamps being generated in HTML,
29 # we use "-a nofooter".
30 # To debug asciidoc problems, you may need to run "xmllint --nonet --noout --valid"
31 # on the intermediate XML that throws an error.
32 .SUFFIXES: .html .adoc .6
33
34 .adoc.6:
35         asciidoctor -D. -a nofooter -b manpage $<
36 .adoc.html:
37         asciidoctor -D. -a nofooter -a webfonts! $<
38
39 SOURCES = README.adoc COPYING NEWS.adoc control Makefile wumpus.c superhack.c wumpus.adoc wumpus.png wumpus.desktop superhack.desktop
40
41 install: wumpus superhack wumpus.6
42         mkdir -p $(prefix)/bin
43         mkdir -p $(prefix)/share/man/man6
44         cp wumpus superhack $(prefix)/bin/
45         cp wumpus.6 $(prefix)/share/man/man6/
46
47 uninstall:
48         rm $(prefix)/bin/wumpus $(prefix)/bin/superhack
49         rm $(prefix)/share/man/man6/wumpus.6
50
51 reflow:
52         @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
53
54 CPPCHECKOPTS =
55 cppcheck:
56         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) wumpus.c
57         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) superhack.c
58
59 wumpus-$(VERS).tar.gz: $(SOURCES) wumpus.6
60         @ls $(SOURCES) wumpus.6 | sed s:^:wumpus-$(VERS)/: >MANIFEST
61         @(cd ..; ln -s wumpus wumpus-$(VERS))
62         (cd ..; tar -czf wumpus/wumpus-$(VERS).tar.gz `cat wumpus/MANIFEST`)
63         @(cd ..; rm wumpus-$(VERS))
64
65 dist: wumpus-$(VERS).tar.gz
66
67 release: wumpus-$(VERS).tar.gz wumpus.html wumpus.6
68         shipper version=$(VERS) | sh -e -x
69
70 refresh: wumpus.html
71         shipper -N -w version=$(VERS) | sh -e -x