Mercurial > projects > xinhibit-applet
comparison Makefile @ 19:1421ea50aa5c default tip
Improve build system
Do not clobber CPPFLAGS, use XCPPFLAGS instead.
Request POSIX:2004 headers and libraries.
Specify shared libraries in the correct order.
author | Guido Berhoerster <guido+xinhibit-applet@berhoerster.name> |
---|---|
date | Tue, 13 Sep 2016 20:57:12 +0200 |
parents | 7379cd513e6d |
children |
comparison
equal
deleted
inserted
replaced
18:7379cd513e6d | 19:1421ea50aa5c |
---|---|
24 PACKAGE = xinhibit-applet | 24 PACKAGE = xinhibit-applet |
25 APP_NAME = org.guido-berhoerster.xinhibit-applet | 25 APP_NAME = org.guido-berhoerster.xinhibit-applet |
26 VERSION = 2 | 26 VERSION = 2 |
27 DISTNAME := $(PACKAGE)-$(VERSION) | 27 DISTNAME := $(PACKAGE)-$(VERSION) |
28 | 28 |
29 # gcc, clang, icc, Sun/Solaris Studio | |
30 CC := $(CC) -std=c99 | |
31 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c | |
29 # gcc, clang, icc | 32 # gcc, clang, icc |
30 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(CPPFLAGS) | 33 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
31 # Sun/Solaris Studio | 34 # Sun/Solaris Studio |
32 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(CPPFLAGS) | 35 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(CPPFLAGS) |
33 # X makedepend | 36 # X makedepend |
34 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) -- | 37 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) -- |
38 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) | |
39 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) | |
35 INSTALL := install | 40 INSTALL := install |
36 INSTALL.exec := $(INSTALL) -D -m 0755 | 41 INSTALL.exec := $(INSTALL) -D -m 0755 |
37 INSTALL.data := $(INSTALL) -D -m 0644 | 42 INSTALL.data := $(INSTALL) -D -m 0644 |
38 PAX := pax | 43 PAX := pax |
39 GZIP := gzip | 44 GZIP := gzip |
40 SED := sed | 45 SED := sed |
41 MSGFMT := msgfmt | 46 MSGFMT := msgfmt |
42 INTLTOOL_UPDATE := intltool-update | 47 INTLTOOL_UPDATE := intltool-update |
43 INTLTOOL_MERGE := intltool-merge | 48 INTLTOOL_MERGE := intltool-merge |
44 XSLTPROC := xsltproc | 49 XSLTPROC := xsltproc |
45 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl | 50 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl |
46 | 51 |
47 define generate-manpage-rule = | 52 define generate-manpage-rule = |
48 %.$(1): %.$(1).xml | 53 %.$(1): %.$(1).xml |
64 bindir ?= $(prefix)/bin | 69 bindir ?= $(prefix)/bin |
65 datadir ?= $(prefix)/share | 70 datadir ?= $(prefix)/share |
66 mandir ?= $(datadir)/man | 71 mandir ?= $(datadir)/man |
67 localedir ?= $(datadir)/locale | 72 localedir ?= $(datadir)/locale |
68 sysconfdir ?= /etc | 73 sysconfdir ?= /etc |
69 xdgautostartdir ?= $(sysconfdir)/xdg/autostart | 74 xdgautostartdir ?= $(sysconfdir)/xdg/autostart |
75 | |
76 OS_NAME := $(shell uname -s) | |
77 OS_RELEASE := $(shell uname -r) | |
70 | 78 |
71 HAVE_LIBXTST ?= 1 | 79 HAVE_LIBXTST ?= 1 |
72 | 80 |
81 $(PACKAGE): XCPPFLAGS := $(shell pkg-config --cflags glib-2.0 gtk+-2.0 unique-1.0) \ | |
82 -D_XOPEN_SOURCE=600 \ | |
83 -DPACKAGE="\"$(PACKAGE)\"" \ | |
84 -DAPP_NAME=\"$(APP_NAME)\" \ | |
85 -DVERSION=\"$(VERSION)\" \ | |
86 -DLOCALEDIR="\"$(localedir)\"" \ | |
87 -DG_LOG_DOMAIN=\"$(PACKAGE)\" | |
88 $(PACKAGE): LDLIBS := $(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0) | |
89 ifeq ($(OS_NAME),SunOS) | |
90 $(PACKAGE): XCPPFLAGS += -I/usr/xpg4/include | |
91 $(PACKAGE): XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib | |
92 endif | |
73 ifeq ($(HAVE_LIBXTST),1) | 93 ifeq ($(HAVE_LIBXTST),1) |
74 CPPFLAGS_LIBXTST := -DHAVE_LIBXTST | 94 $(PACKAGE): XCPPFLAGS += -DHAVE_LIBXTST |
75 LDLIBS_LIBXTST := -lX11 -lXext -lXtst | 95 $(PACKAGE): LDLIBS += -lXtst -lXext -lX11 |
76 endif | 96 endif |
77 | 97 |
78 OBJS = main.o xia-icon.o xia-inhibitor.o xia-debug.o | 98 OBJS = main.o xia-icon.o xia-inhibitor.o xia-debug.o |
79 MANPAGES = data/$(PACKAGE).1 | 99 MANPAGES = data/$(PACKAGE).1 |
80 AUTOSTART_FILE = data/$(PACKAGE).desktop | 100 AUTOSTART_FILE = data/$(PACKAGE).desktop |
81 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) | 101 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) |
82 POTFILE = po/$(PACKAGE).pot | 102 POTFILE = po/$(PACKAGE).pot |
83 POSRCS := $(shell sed -e 's/\#.*//' -e '/^[ \t]*$$/d' \ | 103 POSRCS := $(shell sed -e 's/\#.*//' -e '/^[ \t]*$$/d' \ |
84 -e 's/^\[[^]]*\]//' po/POTFILES.in | paste -s -d ' ') | 104 -e 's/^\[[^]]*\]//' po/POTFILES.in | paste -s -d ' ') |
85 CPPFLAGS := $(CPPFLAGS_LIBXTST) \ | |
86 $(shell pkg-config --cflags glib-2.0 gtk+-2.0 unique-1.0) \ | |
87 -DPACKAGE="\"$(PACKAGE)\"" \ | |
88 -DAPP_NAME=\"$(APP_NAME)\" \ | |
89 -DVERSION=\"$(VERSION)\" \ | |
90 -DLOCALEDIR="\"$(localedir)\"" \ | |
91 -DG_LOG_DOMAIN=\"$(PACKAGE)\" | |
92 LDLIBS := $(LDLIBS_LIBXTST) \ | |
93 $(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0) | |
94 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ | 105 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ |
95 --stringparam man.copyright.section.enabled 0 | 106 --stringparam man.copyright.section.enabled 0 |
96 | 107 |
97 .DEFAULT_TARGET = all | 108 .DEFAULT_TARGET = all |
98 | 109 |
140 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" | 151 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" |
141 $(INSTALL.data) data/$(PACKAGE).1 \ | 152 $(INSTALL.data) data/$(PACKAGE).1 \ |
142 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1" | 153 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1" |
143 | 154 |
144 clean: | 155 clean: |
145 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE) | 156 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) \ |
157 $(AUTOSTART_FILE) | |
146 | 158 |
147 clobber: clean | 159 clobber: clean |
148 rm -f $(patsubst %.o,%.d,$(OBJS)) | 160 rm -f $(patsubst %.o,%.d,$(OBJS)) |
149 | 161 |
150 dist: clobber | 162 dist: clobber |