1TBS reflow.
[wumpus.git] / Makefile
1 #
2 # Makefile for `Hunt the Wumpus' and `Superhack' games
3 #
4 VERS=1.9
5
6 prefix?=/usr
7
8 CFLAGS = -Wall
9
10 all: wumpus superhack
11
12 wumpus: wumpus.c
13         $(CC) $(CFLAGS) wumpus.c -o wumpus
14
15 superhack: superhack.c
16         $(CC) $(CFLAGS) superhack.c -o superhack
17
18 clean:
19         rm -f wumpus wumpus.o superhack superhack.o TAGS *.6 
20         rm -f *~ *.1 *.html *.tar.gz MANIFEST
21
22 TAGS:
23         etags wumpus.c
24
25 wumpus.6: wumpus.xml
26         xmlto man wumpus.xml 
27
28 wumpus.html: wumpus.xml
29         xmlto html-nochunks wumpus.xml 
30
31 SOURCES = README COPYING NEWS control Makefile wumpus.c superhack.c wumpus.xml wumpus.png wumpus.desktop superhack.desktop
32
33 install: wumpus superhack wumpus.6
34         mkdir -p $(prefix)/bin
35         mkdir -p $(prefix)/share/man/man6
36         cp wumpus superhack $(prefix)/bin/
37         cp wumpus.6 $(prefix)/share/man/man6/
38
39 uninstall:
40         rm $(prefix)/bin/wumpus $(prefix)/bin/superhack
41         rm $(prefix)/share/man/man6/wumpus.6
42
43 reflow:
44         @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
45
46 CPPCHECKOPTS =
47 cppcheck:
48         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) wumpus.c
49         cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) superhack.c
50
51 wumpus-$(VERS).tar.gz: $(SOURCES) wumpus.6
52         @ls $(SOURCES) wumpus.6 | sed s:^:wumpus-$(VERS)/: >MANIFEST
53         @(cd ..; ln -s wumpus wumpus-$(VERS))
54         (cd ..; tar -czf wumpus/wumpus-$(VERS).tar.gz `cat wumpus/MANIFEST`)
55         @(cd ..; rm wumpus-$(VERS))
56
57 dist: wumpus-$(VERS).tar.gz
58
59 release: wumpus-$(VERS).tar.gz wumpus.html wumpus.6
60         shipper version=$(VERS) | sh -e -x
61
62 refresh: wumpus.html
63         shipper -N -w version=$(VERS) | sh -e -x