annotate Makefile @ 5:ada3bc46169e

Added tag version-2 for changeset aec74ae4d6e5
author Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
date Fri, 24 Oct 2014 17:13:48 +0200
parents a9a7ad180c3b
children 1d7143a612e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
1 #
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
2 # Copyright (C) 2014 Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
3 #
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
4 # Permission is hereby granted, free of charge, to any person obtaining
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
5 # a copy of this software and associated documentation files (the
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
6 # "Software"), to deal in the Software without restriction, including
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
7 # without limitation the rights to use, copy, modify, merge, publish,
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
8 # distribute, sublicense, and/or sell copies of the Software, and to
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
9 # permit persons to whom the Software is furnished to do so, subject to
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
10 # the following conditions:
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
11 #
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
12 # The above copyright notice and this permission notice shall be included
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
13 # in all copies or substantial portions of the Software.
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
14 #
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
22 #
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
23
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
24 PACKAGE = rantaiwarna
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
25 VERSION = 1
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
26 DISTNAME := $(PACKAGE)-$(VERSION)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
27
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
28 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
29 # gcc, clang, icc
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
30 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
31 # Sun/Solaris Studio
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
32 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
33 # X makedepend
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
34 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
35 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
36 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
37 INSTALL := install
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
38 INSTALL.exec := $(INSTALL) -D -m 0755
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
39 INSTALL.data := $(INSTALL) -D -m 0644
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
40 PAX := pax
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
41 GZIP := gzip
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
42 SED := sed
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
43 XSLTPROC := xsltproc
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
44 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
45
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
46 define generate-manpage-rule =
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
47 %.$(1): %.$(1).xml
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
48 $$(XSLTPROC) \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
49 --xinclude \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
50 --stringparam package $$(PACKAGE) \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
51 --stringparam version $$(VERSION)\
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
52 docbook-update-source-data.xsl $$< | \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
53 $$(XSLTPROC) \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
54 --xinclude \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
55 $$(DOCBOOK5_MANPAGES_FLAGS) \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
56 --output $$@ \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
57 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
58 -
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
59 endef
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
60
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
61 DESTDIR ?=
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
62 prefix ?= /usr/local
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
63 bindir ?= $(prefix)/bin
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
64 datadir ?= $(prefix)/share
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
65 mandir ?= $(datadir)/man
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
66
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
67 OBJS = rantaiwarna.o board.o highscore.o util.o
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
68 MANPAGES = $(PACKAGE).6
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
69 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
70 --stringparam man.copyright.section.enabled 0
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
71
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
72 .DEFAULT_TARGET = all
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
73
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
74 .PHONY: all clean clobber dist install
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
75
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
76 all: $(PACKAGE) $(MANPAGES)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
77
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
78 $(PACKAGE): XCPPFLAGS :=
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
79 # Illumos/Solaris
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
80 #$(PACKAGE): XCPPFLAGS := -I/usr/xpg4/include
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
81 $(PACKAGE): XCFLAGS :=
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
82 $(PACKAGE): LDLIBS := -lcurses -lm
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
83 # Linux, FreeBSD, OpenBSD
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
84 #$(PACKAGE): LDLIBS := -lncursesw -ltinfo -lm
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
85 # Illumos/Solaris, UnixWare, NetBSD
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
86 #$(PACKAGE): LDLIBS := -lcurses -lm
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
87 $(PACKAGE): XLDFLAGS :=
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
88 # Illumos/Solaris
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
89 #$(PACKAGE): XLDFLAGS := -L/usr/xpg4/lib -R/usr/xpg4/lib
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
90 $(PACKAGE): $(OBJS)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
91 $(LINK.o) $^ $(LDLIBS) -o $@
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
92
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
93 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
94
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
95 %.o: %.c
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
96 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
97 $(COMPILE.c) -o $@ $<
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
98
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
99 install:
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
100 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
101 for manpage in $(MANPAGES); do \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
102 $(INSTALL.data) $${manpage} \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
103 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
104 done
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
105
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
106 clean:
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
107 rm -f $(PACKAGE) $(OBJS) $(MANPAGES)
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
108
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
109 clobber: clean
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
110 rm -f $(patsubst %.o,%.d,$(OBJS))
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
111
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
112 dist: clobber
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
113 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
114 -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
115
a9a7ad180c3b Initial revision
Guido Berhoerster <guido+rantaiwarna@berhoerster.name>
parents:
diff changeset
116 -include $(patsubst %.o,%.d,$(OBJS))