Mercurial > projects > xwrited
comparison Makefile @ 19:f0accfc74f7b
Port to GLib version 2.48 or later
Use GApplication instead of the custom XWritedUnique object for uniqueness.
Use GNotification from GIO instead of libnotify.
Remove help and debug options from documentation.
Replace intltool with GNU gettext (version 0.19 or later required).
author | Guido Berhoerster <guido+xwrited@berhoerster.name> |
---|---|
date | Sat, 28 Jul 2018 22:02:24 +0200 |
parents | 4a5330979433 |
children | 9d00c0e07c47 |
comparison
equal
deleted
inserted
replaced
18:4a5330979433 | 19:f0accfc74f7b |
---|---|
1 # | 1 # |
2 # Copyright (C) 2016 Guido Berhoerster <guido+xwrited@berhoerster.name> | 2 # Copyright (C) 2018 Guido Berhoerster <guido+xwrited@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, |
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 # | 22 # |
23 | 23 |
24 PACKAGE = xwrited | 24 PACKAGE = xwrited |
25 APP_NAME = org.guido-berhoerster.code.xwrited | 25 APPLICATION_ID = org.guido-berhoerster.code.xwrited |
26 VERSION = 2 | 26 VERSION = 2 |
27 DISTNAME := $(PACKAGE)-$(VERSION) | 27 DISTNAME := $(PACKAGE)-$(VERSION) |
28 BUG_ADDRESS = guido+xwrited@berhoerster.name | |
28 | 29 |
29 # gcc, clang, icc, Sun/Solaris Studio | 30 # gcc, clang, icc, Sun/Solaris Studio |
30 CC := $(CC) -std=c99 | 31 CC := $(CC) -std=c99 |
31 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c | 32 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c |
32 # gcc, clang, icc | 33 # gcc, clang, icc |
33 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) | 34 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
34 # Sun/Solaris Studio | 35 # Sun/Solaris Studio |
35 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) | 36 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
36 # X makedepend | 37 # X makedepend |
37 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) -- | 38 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) -- |
39 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) | |
40 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) | |
41 CP := cp | |
38 INSTALL := install | 42 INSTALL := install |
39 INSTALL.exec := $(INSTALL) -D -m 0755 | 43 INSTALL.exec := $(INSTALL) -D -m 0755 |
40 INSTALL.data := $(INSTALL) -D -m 0644 | 44 INSTALL.data := $(INSTALL) -D -m 0644 |
45 INSTALL.link := $(CP) -f -P | |
41 PAX := pax | 46 PAX := pax |
42 GZIP := gzip | 47 GZIP := gzip |
43 SED := sed | 48 SED := sed |
44 PASTE := paste | |
45 MSGFMT := msgfmt | |
46 INTLTOOL_UPDATE := intltool-update | |
47 INTLTOOL_MERGE := intltool-merge | |
48 XSLTPROC := xsltproc | 49 XSLTPROC := xsltproc |
49 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 |
51 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ | |
52 --stringparam man.copyright.section.enabled 0 | |
53 MSGFMT = msgfmt | |
54 MSGMERGE = msgmerge | |
55 XGETTEXT = xgettext | |
56 XGETTEXT_OPTIONS = --copyright-holder "$(AUTHOR)" \ | |
57 --package-name '$(PACKAGE)' \ | |
58 --package-version '$(VERSION)' \ | |
59 --msgid-bugs-address '$(BUG_ADDRESS)' \ | |
60 --default-domain '$(PACKAGE)' \ | |
61 --from-code UTF-8 \ | |
62 --keyword=_ \ | |
63 --keyword=N_ \ | |
64 --keyword=C_:1c,2 \ | |
65 --keyword=NC_:1c,2 \ | |
66 --keyword=g_dngettext:2,3 \ | |
67 --add-comments | |
50 | 68 |
51 define generate-manpage-rule = | 69 define generate-manpage-rule = |
52 %.$(1): %.$(1).xml | 70 %.$(1): %.$(1).xml |
53 $$(XSLTPROC) \ | 71 $$(XSLTPROC) \ |
54 --xinclude \ | 72 --xinclude \ |
55 --stringparam package $$(PACKAGE) \ | 73 --stringparam package $$(PACKAGE) \ |
56 --stringparam version $$(VERSION)\ | 74 --stringparam version $$(VERSION)\ |
57 data/docbook-update-source-data.xsl $$< | \ | 75 docbook-update-source-data.xsl $$< | \ |
58 $$(XSLTPROC) \ | 76 $$(XSLTPROC) \ |
59 --xinclude \ | 77 --xinclude \ |
60 $$(DOCBOOK5_MANPAGES_FLAGS) \ | 78 $$(DOCBOOK5_MANPAGES_FLAGS) \ |
61 --output $$@ \ | 79 --output $$@ \ |
62 $$(DOCBOOK5_MANPAGES_STYLESHEET) \ | 80 $$(DOCBOOK5_MANPAGES_STYLESHEET) \ |
73 xdgautostartdir ?= $(sysconfdir)/xdg/autostart | 91 xdgautostartdir ?= $(sysconfdir)/xdg/autostart |
74 | 92 |
75 OS_NAME := $(shell uname -s) | 93 OS_NAME := $(shell uname -s) |
76 OS_RELEASE := $(shell uname -r) | 94 OS_RELEASE := $(shell uname -r) |
77 | 95 |
78 ifeq ($(shell pkg-config --exists 'glib-2.0 >= 2.25.5' && printf "true"),true) | 96 OBJS = xwrited.o \ |
79 HAVE_GLIB_GDBUS = 1 | 97 xwd-application.o |
98 ifneq ($(findstring $(OS_NAME),Linux FreeBSD),) | |
99 OBJS += xwd-utmp-utempter.o | |
80 else | 100 else |
81 HAVE_GLIB_GDBUS = 0 | 101 OBJS += xwd-utmp-utmpx.o |
82 endif | 102 endif |
83 | 103 |
84 PKGCONFIG_LIBS := dbus-1 glib-2.0 libnotify | 104 MANPAGES = $(PACKAGE).1 |
85 ifeq ($(HAVE_GLIB_GDBUS),1) | 105 |
86 PKGCONFIG_LIBS += dbus-glib-1 | 106 AUTOSTART_FILE = $(APPLICATION_ID).desktop |
87 endif | 107 |
88 OBJS = main.o xwrited-debug.o xwrited-unique.o | 108 LINGUAS := $(shell sed 's/\#.*//' po/LINGUAS) |
89 ifneq ($(findstring $(OS_NAME),Linux FreeBSD),) | 109 MOFILES := $(patsubst %,po/%.mo,$(LINGUAS)) |
90 OBJS += xwrited-utmp-utempter.o | 110 POTFILES_IN := $(shell sed 's/\#.*//' po/POTFILES.in) |
91 else | |
92 OBJS += xwrited-utmp-utmpx.o | |
93 endif | |
94 MANPAGES = data/$(PACKAGE).1 | |
95 AUTOSTART_FILE = data/$(PACKAGE).desktop | |
96 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) | |
97 POTFILE = po/$(PACKAGE).pot | 111 POTFILE = po/$(PACKAGE).pot |
98 POSRCS := $(shell $(SED) -e 's/\#.*//' -e '/^[ \t]*$$/d' \ | |
99 -e 's/^\[[^]]*\]//' po/POTFILES.in | $(PASTE) -s -d ' ') | |
100 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ | |
101 --stringparam man.copyright.section.enabled 0 | |
102 | 112 |
103 .DEFAULT_TARGET = all | 113 .DEFAULT_TARGET = all |
104 | 114 |
105 .PHONY: all clean clobber dist install | 115 .PHONY: all pot update-po clean clobber dist install |
106 | 116 |
107 all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE) | 117 all: $(PACKAGE) $(AUTOSTART_FILE) $(MOFILES) $(MANPAGES) |
108 | 118 |
109 $(PACKAGE): CPPFLAGS := $(shell pkg-config --cflags $(PKGCONFIG_LIBS)) \ | 119 $(PACKAGE): XCFLAGS = $(shell pkg-config --cflags gobject-2.0 gio-2.0 \ |
110 -D_XOPEN_SOURCE=600 \ | 120 glib-2.0) \ |
111 -DPACKAGE="\"$(PACKAGE)\"" \ | 121 -DPACKAGE=\"$(PACKAGE)\" \ |
112 -DAPP_NAME=\"$(APP_NAME)\" \ | 122 -DAPPLICATION_ID=\"$(APPLICATION_ID)\" \ |
113 -DVERSION=\"$(VERSION)\" \ | 123 -DVERSION=\"$(VERSION)\" \ |
114 -DLOCALEDIR="\"$(localedir)\"" \ | 124 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \ |
115 -DG_LOG_DOMAIN=\"$(PACKAGE)\" | 125 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \ |
116 $(PACKAGE): LDLIBS := $(shell pkg-config --libs $(PKGCONFIG_LIBS)) | 126 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" |
117 ifeq ($(HAVE_GLIB_GDBUS),1) | 127 $(PACKAGE): LDLIBS = $(shell pkg-config --libs gobject-2.0 gio-2.0 \ |
118 $(PACKAGE): XCPPFLAGS += -DHAVE_GLIB_GDBUS | 128 glib-2.0) |
119 endif | 129 |
120 ifeq ($(OS_NAME),Linux) | 130 ifeq ($(OS_NAME),Linux) |
131 $(PACKAGE): XCPPFLAGS += -D_XOPEN_SOURCE=600 | |
121 $(PACKAGE): LDLIBS += -lutempter | 132 $(PACKAGE): LDLIBS += -lutempter |
122 else ifeq ($(OS_NAME),FreeBSD) | 133 else ifeq ($(OS_NAME),FreeBSD) |
123 $(PACKAGE): LDLIBS += -lulog | 134 $(PACKAGE): LDLIBS += -lulog |
124 else ifeq ($(OS_NAME),SunOS) | 135 else ifeq ($(OS_NAME),SunOS) |
125 $(PACKAGE): XCPPFLAGS += -I/usr/xpg4/include | 136 $(PACKAGE): XCPPFLAGS += -D_XOPEN_SOURCE=600 -I/usr/xpg4/include |
126 $(PACKAGE): XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib | 137 $(PACKAGE): XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib |
127 endif | 138 endif |
139 | |
128 $(PACKAGE): $(OBJS) | 140 $(PACKAGE): $(OBJS) |
129 $(LINK.o) $^ $(LDLIBS) -o $@ | 141 $(LINK.o) $^ $(LDLIBS) -o $@ |
130 | 142 |
131 $(POTFILE): po/POTFILES.in $(POSRCS) | 143 $(POTFILE): po/POTFILES.in $(POTFILES_IN) |
132 cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)" | 144 $(XGETTEXT) $(XGETTEXT_OPTIONS) --files-from $< --output $@ |
133 | 145 |
134 pot: $(POTFILE) | 146 pot: $(POTFILE) |
135 | 147 |
136 update-po: $(POTFILE) | 148 update-po: $(POTFILE) |
137 cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ | 149 for pofile in $(patsubst %.mo,%.po,$(MOFILES)); do \ |
138 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \ | 150 $(MSGMERGE) --update --backup off $$pofile $<; \ |
139 $${lang}; \ | |
140 done | 151 done |
152 | |
153 %.mo: %.po | |
154 $(MSGFMT) --output $@ $< | |
155 | |
156 %.desktop: %.desktop.in | |
157 $(MSGFMT) --desktop --template $< -d po --output $@ | |
158 | |
159 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) | |
160 | |
161 %.mo: %.po | |
162 $(MSGFMT) -o $@ $< | |
141 | 163 |
142 %.o: %.c | 164 %.o: %.c |
143 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d | 165 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d |
144 $(COMPILE.c) -o $@ $< | 166 $(COMPILE.c) -o $@ $< |
145 | 167 |
146 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) | 168 install: all |
147 | |
148 %.desktop: %.desktop.in $(MOFILES) | |
149 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ | |
150 | |
151 %.mo: %.po | |
152 $(MSGFMT) -o $@ $< | |
153 | |
154 install: | |
155 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" | 169 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" |
156 for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ | 170 $(INSTALL.data) $(AUTOSTART_FILE) \ |
157 $(INSTALL.data) po/$${lang}.mo \ | 171 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE) |
158 "$(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo"; \ | 172 for lang in $(LINGUAS); do \ |
173 $(INSTALL.data) po/$${lang}.mo \ | |
174 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \ | |
159 done | 175 done |
160 $(INSTALL.data) $(AUTOSTART_FILE) \ | 176 for manpage in $(MANPAGES); do \ |
161 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" | 177 $(INSTALL.data) $${manpage} \ |
162 $(INSTALL.data) data/$(PACKAGE).1 \ | 178 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
163 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1" | 179 done |
164 | 180 |
165 clean: | 181 clean: |
166 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE) | 182 rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILE) $(POTFILE) $(MOFILES) \ |
183 $(MANPAGES) | |
167 | 184 |
168 clobber: clean | 185 clobber: clean |
169 rm -f $(patsubst %.o,%.d,$(OBJS)) | 186 rm -f $(patsubst %.o,%.d,$(OBJS)) |
170 | 187 |
171 dist: clobber | 188 dist: clobber |
172 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \ | 189 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \ |
173 -s ',^\.$$,,' -s ',\./,$(DISTNAME)/,' . | \ | 190 -s ',^\.$$,,' -s ',\./,$(DISTNAME)/,' . | \ |
174 $(GZIP) > $(DISTNAME).tar.gz | 191 $(GZIP) > $(DISTNAME).tar.gz |
175 | 192 |
193 -include local.mk | |
194 | |
176 -include $(patsubst %.o,%.d,$(OBJS)) | 195 -include $(patsubst %.o,%.d,$(OBJS)) |