Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 # Makefile for Greed
2 #
3 # SPDX-FileCopyrightText: (C) Eric S. Raymond <[email protected]>
4 # SPDX-License-Identifier: BSD-2-Clause
5
6 PREFIX ?= /usr/local
7 BINDIR ?= $(PREFIX)/bin
8 DATADIR ?= $(PREFIX)/share
9 MANDIR ?= $(DATADIR)/man
10
•11 SFILE=/var/games/greed/greed.hs
12
13 CFLAGS += -O -Wall -Werror -Wextra -Wno-unused-parameter
14
15 VERSION=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1)
16
17 # Rules
18
19 # Note: to suppress the footers with timestamps being generated in HTML,
20 # we use "-a nofooter".
21 # To debug asciidoc problems, you may need to run "xmllint --nonet --noout --valid"
22 # on the intermediate XML that throws an error.
23 .SUFFIXES: .html .adoc .6
24
25 .adoc.6:
26 asciidoctor -D. -a nofooter -b manpage $<
27 .adoc.html:
28 asciidoctor -D. -a nofooter -a webfonts! $<
29
30 .PHONY: all clean reflow cppcheck spellcheck install uninstall dist release refresh
31
32 # Build
33
34 all: greed greed.6
35
36 greed: greed.c
37 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSCOREFILE=\"$(SFILE)\" -DRELEASE=\"$(VERSION)\" -o greed greed.c -O3 -lcurses
38
39 clean:
40 rm -f *~ *.o greed greed-*.tar.gz greed*.rpm *.html
41 rm -f greed.6 manpage.links manpage.refs
42
43 # Validate
44
45 reflow:
46 @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
47
48 CPPCHECKOPTS =
49 cppcheck:
50 @cppcheck --quiet --template=gcc $(CPPCHECKOPTS) greed.c
51
52 spellcheck:
53 @spellcheck greed.adoc
54
55 # Install/uninstall
56
57 install: greed.6 uninstall
58 install -m 0755 -d $(DESTDIR)$(BINDIR)
59 install -m 0755 greed $(DESTDIR)$(BINDIR)/
60 install -m 0755 -d $(DESTDIR)$(MANDIR)
61 install -m 0755 -d $(DESTDIR)$(MANDIR)/man6
62 install -m 0644 greed.6 $(DESTDIR)$(MANDIR)/man6/
63
64 uninstall:
65 rm -f $(DESTDIR)$(BINDIR)/greed
66 rm -f $(DESTDIR)$(MANDIR)/man6/greed.6
67
68 # Export
69
70 SOURCES = README.adoc NEWS.adoc COPYING Makefile greed.c greed.adoc control greed-logo.png
71
72 greed-$(VERSION).tar.gz: $(SOURCES)
73 mkdir greed-$(VERSION)
74 cp -r $(SOURCES) greed-$(VERSION)
75 tar -czf greed-$(VERSION).tar.gz greed-$(VERSION)
76 rm -fr greed-$(VERSION)
77 ls -l greed-$(VERSION).tar.gz
78
79 dist: greed-$(VERSION).tar.gz
80
81 release: greed-$(VERSION).tar.gz greed.html
82 shipper version=$(VERSION) | sh -e -x
83
84 refresh: greed.html
85 shipper -N -w version=$(VERSION) | sh -e -x
86
87 # end