fd9188b6a06367bc0e13944e00e3491017320c3d
[wumpus.git] / Makefile
1 #
2 # Makefile for `Hunt the Wumpus' and `Superhack' games
3 #
4 #
5 # SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
6 # SPDX-License-Identifier: BSD-2-Clause
7 VERS=1.9
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 wumpus.6: wumpus.xml
29         xmlto man wumpus.xml 
30
31 wumpus.html: wumpus.xml
32         xmlto html-nochunks wumpus.xml 
33
34 SOURCES = README COPYING NEWS control Makefile wumpus.c superhack.c wumpus.xml wumpus.png wumpus.desktop superhack.desktop
35
36 install: wumpus superhack wumpus.6
37         mkdir -p $(prefix)/bin
38         mkdir -p $(prefix)/share/man/man6
39         cp wumpus superhack $(prefix)/bin/
40         cp wumpus.6 $(prefix)/share/man/man6/
41
42 uninstall:
43         rm $(prefix)/bin/wumpus $(prefix)/bin/superhack
44         rm $(prefix)/share/man/man6/wumpus.6
45
46 reflow:
47         @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
48
49 CPPCHECKOPTS =
50 cppcheck:
51         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) wumpus.c
52         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) superhack.c
53
54 wumpus-$(VERS).tar.gz: $(SOURCES) wumpus.6
55         @ls $(SOURCES) wumpus.6 | sed s:^:wumpus-$(VERS)/: >MANIFEST
56         @(cd ..; ln -s wumpus wumpus-$(VERS))
57         (cd ..; tar -czf wumpus/wumpus-$(VERS).tar.gz `cat wumpus/MANIFEST`)
58         @(cd ..; rm wumpus-$(VERS))
59
60 dist: wumpus-$(VERS).tar.gz
61
62 release: wumpus-$(VERS).tar.gz wumpus.html wumpus.6
63         shipper version=$(VERS) | sh -e -x
64
65 refresh: wumpus.html
66         shipper -N -w version=$(VERS) | sh -e -x