Mercurial > projects > rantaiwarna
comparison Makefile @ 10:4f6bf50dbc4a default tip
Detect the OS and configure build flags and libraries automatically
author | Guido Berhoerster <guido+rantaiwarna@berhoerster.name> |
---|---|
date | Tue, 13 Sep 2016 18:19:44 +0200 |
parents | 6cbf50148e87 |
children |
comparison
equal
deleted
inserted
replaced
9:6cbf50148e87 | 10:4f6bf50dbc4a |
---|---|
1 # | 1 # |
2 # Copyright (C) 2014 Guido Berhoerster <guido+rantaiwarna@berhoerster.name> | 2 # Copyright (C) 2016 Guido Berhoerster <guido+rantaiwarna@berhoerster.name> |
3 # | 3 # |
4 # Permission is hereby granted, free of charge, to any person obtaining | 4 # Permission is hereby granted, free of charge, to any person obtaining |
5 # a copy of this software and associated documentation files (the | 5 # a copy of this software and associated documentation files (the |
6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
7 # without limitation the rights to use, copy, modify, merge, publish, | 7 # without limitation the rights to use, copy, modify, merge, publish, |
23 | 23 |
24 PACKAGE = rantaiwarna | 24 PACKAGE = rantaiwarna |
25 VERSION = 2 | 25 VERSION = 2 |
26 DISTNAME := $(PACKAGE)-$(VERSION) | 26 DISTNAME := $(PACKAGE)-$(VERSION) |
27 | 27 |
28 # gcc, clang, icc, Sun/Solaris Studio | |
29 CC := $(CC) -std=c99 | |
28 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c | 30 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c |
29 # gcc, clang, icc | 31 # gcc, clang, icc |
30 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) | 32 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
31 # Sun/Solaris Studio | 33 # Sun/Solaris Studio |
32 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) | 34 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
39 INSTALL.data := $(INSTALL) -D -m 0644 | 41 INSTALL.data := $(INSTALL) -D -m 0644 |
40 PAX := pax | 42 PAX := pax |
41 GZIP := gzip | 43 GZIP := gzip |
42 SED := sed | 44 SED := sed |
43 XSLTPROC := xsltproc | 45 XSLTPROC := xsltproc |
44 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl | 46 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl |
45 | 47 |
46 define generate-manpage-rule = | 48 define generate-manpage-rule = |
47 %.$(1): %.$(1).xml | 49 %.$(1): %.$(1).xml |
48 $$(XSLTPROC) \ | 50 $$(XSLTPROC) \ |
49 --xinclude \ | 51 --xinclude \ |
62 prefix ?= /usr/local | 64 prefix ?= /usr/local |
63 bindir ?= $(prefix)/bin | 65 bindir ?= $(prefix)/bin |
64 datadir ?= $(prefix)/share | 66 datadir ?= $(prefix)/share |
65 mandir ?= $(datadir)/man | 67 mandir ?= $(datadir)/man |
66 | 68 |
69 OS_NAME := $(shell uname -s) | |
70 OS_RELEASE := $(shell uname -r) | |
71 | |
67 OBJS = rantaiwarna.o board.o highscore.o util.o | 72 OBJS = rantaiwarna.o board.o highscore.o util.o |
68 MANPAGES = $(PACKAGE).6 | 73 MANPAGES = $(PACKAGE).6 |
69 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ | 74 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ |
70 --stringparam man.copyright.section.enabled 0 | 75 --stringparam man.copyright.section.enabled 0 |
71 | 76 |
73 | 78 |
74 .PHONY: all clean clobber dist install | 79 .PHONY: all clean clobber dist install |
75 | 80 |
76 all: $(PACKAGE) $(MANPAGES) | 81 all: $(PACKAGE) $(MANPAGES) |
77 | 82 |
78 $(PACKAGE): XCPPFLAGS := | 83 $(PACKAGE): XCPPFLAGS = -D_XOPEN_SOURCE=600 |
79 # Illumos/Solaris | 84 $(PACKAGE): LDLIBS = -lm |
80 #$(PACKAGE): XCPPFLAGS := -I/usr/xpg4/include | 85 ifeq ($(OS_NAME),SunOS) |
81 $(PACKAGE): XCFLAGS := | 86 $(PACKAGE): XCPPFLAGS += -I/usr/xpg4/include |
82 $(PACKAGE): LDLIBS := -lcurses -lm | 87 $(PACKAGE): XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib |
83 # Linux, FreeBSD, OpenBSD | 88 $(PACKAGE): LDLIBS += -lcurses |
84 #$(PACKAGE): LDLIBS := -lncursesw -ltinfo -lm | 89 else ifneq ($(findstring $(OS_NAME),UnixWare NetBSD),) |
85 # Illumos/Solaris, UnixWare, NetBSD | 90 $(PACKAGE): LDLIBS += -lcurses |
86 #$(PACKAGE): LDLIBS := -lcurses -lm | 91 else |
87 $(PACKAGE): XLDFLAGS := | 92 $(PACKAGE): LDLIBS += -lncursesw -ltinfo |
88 # Illumos/Solaris | 93 endif |
89 #$(PACKAGE): XLDFLAGS := -L/usr/xpg4/lib -R/usr/xpg4/lib | |
90 $(PACKAGE): $(OBJS) | 94 $(PACKAGE): $(OBJS) |
91 $(LINK.o) $^ $(LDLIBS) -o $@ | 95 $(LINK.o) $^ $(LDLIBS) -o $@ |
92 | 96 |
93 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) | 97 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) |
94 | 98 |