comparison Makefile @ 1:2f04ec9e0506

Add preferences application Split settings into separate file.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Fri, 08 Jun 2018 08:38:42 +0200
parents 6884bb8130ca
children 7172a0db97af
comparison
equal deleted inserted replaced
0:6884bb8130ca 1:2f04ec9e0506
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 = package-update-indicator 24 PACKAGE = package-update-indicator
25 APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator 25 APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator
26 PREFS_APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator.preferences
26 VERSION = 1 27 VERSION = 1
27 DISTNAME = $(PACKAGE)-$(VERSION) 28 DISTNAME = $(PACKAGE)-$(VERSION)
28 AUTHOR = Guido Berhoerster 29 AUTHOR = Guido Berhoerster
29 BUG_ADDRESS = guido+pui@berhoerster.name 30 BUG_ADDRESS = guido+pui@berhoerster.name
30 31
46 INSTALL.link := $(CP) -f -P 47 INSTALL.link := $(CP) -f -P
47 PAX := pax 48 PAX := pax
48 GZIP := gzip 49 GZIP := gzip
49 SED := sed 50 SED := sed
50 GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0) 51 GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0)
52 GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0)
51 XSLTPROC := xsltproc 53 XSLTPROC := xsltproc
52 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl 54 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
53 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ 55 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
54 --stringparam man.copyright.section.enabled 0 56 --stringparam man.copyright.section.enabled 0
55 MSGFMT = msgfmt 57 MSGFMT = msgfmt
89 datadir ?= $(prefix)/share 91 datadir ?= $(prefix)/share
90 mandir ?= $(datadir)/man 92 mandir ?= $(datadir)/man
91 localedir ?= $(datadir)/locale 93 localedir ?= $(datadir)/locale
92 sysconfdir ?= /etc 94 sysconfdir ?= /etc
93 xdgautostartdir ?= $(sysconfdir)/xdg/autostart 95 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
96 xdgapplicationsdir ?= $(datadir)/applications
94 97
95 OS_NAME := $(shell uname -s) 98 OS_NAME := $(shell uname -s)
96 OS_RELEASE := $(shell uname -r) 99 OS_RELEASE := $(shell uname -r)
97 100
98 OBJS = package-update-indicator.o \ 101 $(PACKAGE)_OBJS = package-update-indicator.o \
99 pui-application.o \ 102 pui-application.o \
100 pui-backend.o \ 103 pui-backend.o \
101 pui-get-updates.o \ 104 pui-get-updates.o \
105 pui-settings.o \
102 pui-types.o 106 pui-types.o
103 107
108 $(PACKAGE)-prefs_OBJS = package-update-indicator-prefs.o \
109 pui-prefs-application.o \
110 pui-settings.o \
111 pui-prefs-resources.o
112
113 OBJS = $($(PACKAGE)_OBJS) $($(PACKAGE)-prefs_OBJS)
114
104 GSETTINGS_SCHEMAS = $(APPLICATION_ID).gschema.xml 115 GSETTINGS_SCHEMAS = $(APPLICATION_ID).gschema.xml
105 116
106 AUTOSTART_FILES = $(APPLICATION_ID).desktop 117 GRESOURCE_FILES = pui-prefs.gresource.xml
118
119 AUTOSTART_FILE = $(APPLICATION_ID).desktop
120
121 DESKTOP_FILES = $(PREFS_APPLICATION_ID).desktop
107 122
108 LINGUAS := $(shell sed 's/\#.*//' po/LINGUAS) 123 LINGUAS := $(shell sed 's/\#.*//' po/LINGUAS)
109 MOFILES := $(patsubst %,po/%.mo,$(LINGUAS)) 124 MOFILES := $(patsubst %,po/%.mo,$(LINGUAS))
110 POTFILES_IN := $(shell sed 's/\#.*//' po/POTFILES.in) 125 POTFILES_IN := $(shell sed 's/\#.*//' po/POTFILES.in)
111 POTFILE = po/$(PACKAGE).pot 126 POTFILE = po/$(PACKAGE).pot
112 127
113 MANPAGES = $(PACKAGE).1 128 MANPAGES = $(PACKAGE).1 $(PACKAGE)-prefs.1
114 129
115 .DEFAULT_TARGET = all 130 .DEFAULT_TARGET = all
116 131
117 .PHONY: all pot update-po clean clobber dist install 132 .PHONY: all pot update-po clean clobber dist install
118 133
119 all: $(PACKAGE) $(AUTOSTART_FILES) $(MOFILES) $(MANPAGES) 134 all: $(PACKAGE) $(PACKAGE)-prefs $(AUTOSTART_FILE) $(DESKTOP_FILES) $(MOFILES) $(MANPAGES)
120 135
121 $(PACKAGE): XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \ 136 $(PACKAGE): XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
122 -DAPPLICATION_ID=\"$(APPLICATION_ID)\" \ 137 -DAPPLICATION_ID=\"$(APPLICATION_ID)\" \
123 -DVERSION=\"$(VERSION)\" \ 138 -DVERSION=\"$(VERSION)\" \
124 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \ 139 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \
125 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \ 140 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
126 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \ 141 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
142 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \
127 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE 143 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
128 $(PACKAGE): XCFLAGS = $(shell pkg-config --cflags gtk+-3.0 \ 144 $(PACKAGE): XCFLAGS = $(shell pkg-config --cflags gtk+-3.0 \
129 appindicator3-0.1 packagekit-glib2) 145 appindicator3-0.1 packagekit-glib2)
130 $(PACKAGE): LDLIBS = $(shell pkg-config --libs gtk+-3.0 \ 146 $(PACKAGE): LDLIBS = $(shell pkg-config --libs gtk+-3.0 \
131 appindicator3-0.1 packagekit-glib2) 147 appindicator3-0.1 packagekit-glib2)
148
149 $(PACKAGE)-prefs: XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
150 -DAPPLICATION_ID=\"$(PREFS_APPLICATION_ID)\" \
151 -DVERSION=\"$(VERSION)\" \
152 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \
153 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
154 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
155 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\"
156 $(PACKAGE)-prefs: XCFLAGS = $(shell pkg-config --cflags gtk+-3.0)
157 $(PACKAGE)-prefs: LDLIBS = $(shell pkg-config --libs gtk+-3.0)
132 158
133 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),) 159 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
134 $(PACKAGE): XCPPFLAGS += -I/usr/local/include 160 $(PACKAGE): XCPPFLAGS += -I/usr/local/include
135 $(PACKAGE): XLDFLAGS += -L/usr/local/lib 161 $(PACKAGE): XLDFLAGS += -L/usr/local/lib
136 else ifeq ($(OS_NAME),NetBSD) 162 else ifeq ($(OS_NAME),NetBSD)
139 endif 165 endif
140 ifeq ($(findstring $(OS_NAME),FreeBSD DragonFly NetBSD OpenBSD),) 166 ifeq ($(findstring $(OS_NAME),FreeBSD DragonFly NetBSD OpenBSD),)
141 $(PACKAGE): XCPPFLAGS += -D_XOPEN_SOURCE=600 167 $(PACKAGE): XCPPFLAGS += -D_XOPEN_SOURCE=600
142 endif 168 endif
143 169
144 $(PACKAGE): $(OBJS) 170 $(PACKAGE): $($(PACKAGE)_OBJS)
145 $(LINK.o) $^ $(LDLIBS) -o $@ 171 $(LINK.o) $^ $(LDLIBS) -o $@
172
173 $(PACKAGE)-prefs: $($(PACKAGE)-prefs_OBJS)
174 $(LINK.o) $^ $(LDLIBS) -o $@
175
176 %-resources.c: %.gresource.xml
177 $(GLIB_COMPILE_RESOURCES) --generate-dependencies $< | \
178 while read -r resource_file; do \
179 printf '%s: %s\n' $@ "$${resource_file}"; \
180 done
181 $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=. --generate-source $<
146 182
147 $(POTFILE): po/POTFILES.in $(POTFILES_IN) 183 $(POTFILE): po/POTFILES.in $(POTFILES_IN)
148 $(XGETTEXT) $(XGETTEXT_OPTIONS) --files-from $< --output $@ 184 $(XGETTEXT) $(XGETTEXT_OPTIONS) --files-from $< --output $@
149 185
150 pot: $(POTFILE) 186 pot: $(POTFILE)
166 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d 202 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
167 $(COMPILE.c) -o $@ $< 203 $(COMPILE.c) -o $@ $<
168 204
169 install: all 205 install: all
170 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" 206 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
207 $(INSTALL.exec) $(PACKAGE)-prefs \
208 "$(DESTDIR)$(bindir)/$(PACKAGE)-prefs"
171 for schema in $(GSETTINGS_SCHEMAS); do \ 209 for schema in $(GSETTINGS_SCHEMAS); do \
172 $(INSTALL.data) $${schema} \ 210 $(INSTALL.data) $${schema} \
173 $(DESTDIR)$(datadir)/glib-2.0/schemas/$${schema}; \ 211 $(DESTDIR)$(datadir)/glib-2.0/schemas/$${schema}; \
174 done 212 done
175 [ -n "$(GSETTINGS_SCHEMAS)" ] && \ 213 [ -n "$(GSETTINGS_SCHEMAS)" ] && \
176 $(GLIB_COMPILE_SCHEMAS) $(datadir)/glib-2.0/schemas 214 $(GLIB_COMPILE_SCHEMAS) $(datadir)/glib-2.0/schemas
177 for desktop_file in $(AUTOSTART_FILES); do \ 215 $(INSTALL.data) $(AUTOSTART_FILE) \
216 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
217 for desktop_file in $(DESKTOP_FILES); do \
178 $(INSTALL.data) $${desktop_file} \ 218 $(INSTALL.data) $${desktop_file} \
179 $(DESTDIR)$(xdgautostartdir)/$${desktop_file}; \ 219 $(DESTDIR)$(xdgapplicationsdir)/$${desktop_file}; \
180 done 220 done
181 for lang in $(LINGUAS); do \ 221 for lang in $(LINGUAS); do \
182 $(INSTALL.data) po/$${lang}.mo \ 222 $(INSTALL.data) po/$${lang}.mo \
183 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \ 223 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \
184 done 224 done
186 $(INSTALL.data) $${manpage} \ 226 $(INSTALL.data) $${manpage} \
187 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ 227 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
188 done 228 done
189 229
190 clean: 230 clean:
191 rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILES) $(POTFILE) $(MOFILES) \ 231 rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILE) $(DESKTOP_FILES) $(POTFILE) \
192 $(MANPAGES) 232 $(MOFILES) $(MANPAGES)
193 233
194 clobber: clean 234 clobber: clean
195 rm -f $(patsubst %.o,%.d,$(OBJS)) 235 rm -f $(patsubst %.o,%.d,$(OBJS))
196 236
197 dist: clobber 237 dist: clobber
200 $(GZIP) > $(DISTNAME).tar.gz 240 $(GZIP) > $(DISTNAME).tar.gz
201 241
202 -include local.mk 242 -include local.mk
203 243
204 -include $(patsubst %.o,%.d,$(OBJS)) 244 -include $(patsubst %.o,%.d,$(OBJS))
245 -include $(patsubst %.gresource.xml,%.gresource.d,$(GRESOURCE_FILES))