2 # Makefile for `Hunt the Wumpus' and `Superhack' games
4 # SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
5 # SPDX-License-Identifier: BSD-2-Clause
7 VERS=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1)
16 $(CC) $(CFLAGS) wumpus.c -o wumpus
18 superhack: superhack.c
19 $(CC) $(CFLAGS) superhack.c -o superhack
22 rm -f wumpus wumpus.o superhack superhack.o TAGS *.6
23 rm -f *~ *.1 *.html *.tar.gz MANIFEST
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
35 asciidoctor -D. -a nofooter -b manpage $<
37 asciidoctor -D. -a nofooter -a webfonts! $<
39 SOURCES = README.adoc COPYING NEWS.adoc control Makefile wumpus.c superhack.c wumpus.adoc wumpus.png wumpus.desktop superhack.desktop
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/
48 rm $(prefix)/bin/wumpus $(prefix)/bin/superhack
49 rm $(prefix)/share/man/man6/wumpus.6
52 @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
56 cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) wumpus.c
57 cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) superhack.c
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))
65 dist: wumpus-$(VERS).tar.gz
67 release: wumpus-$(VERS).tar.gz wumpus.html wumpus.6
68 shipper version=$(VERS) | sh -e -x
71 shipper -N -w version=$(VERS) | sh -e -x