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