projects/pk-update-icon

view Makefile @ 41:ccbbb9f3d7fc

Release version 1
author Guido Berhoerster <gber@opensuse.org>
date Fri Feb 07 22:05:17 2014 +0100 (2014-02-07)
parents 7e44a0a8dc2c
children aa5d3752091d
line source
1 #
2 # Copyright (C) 2014 Guido Berhoerster <gber@opensuse.org>
3 #
4 # Licensed under the GNU General Public License Version 2
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
21 PACKAGE = pk-update-icon
22 APP_NAME = org.opensuse.pk-update-icon
23 VERSION = 1
24 DISTNAME := $(PACKAGE)-$(VERSION)
26 # gcc, clang, icc
27 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(CPPFLAGS)
28 # Sun/Solaris Studio
29 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(CPPFLAGS)
30 # X makedepend
31 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) --
32 INSTALL := install
33 INSTALL.exec := $(INSTALL) -D -m 0755
34 INSTALL.data := $(INSTALL) -D -m 0644
35 PAX := pax
36 GZIP := gzip
37 SED := sed
38 MSGFMT := msgfmt
39 INTLTOOL_UPDATE := intltool-update
40 INTLTOOL_MERGE := intltool-merge
41 XSLTPROC := xsltproc
42 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
44 define generate-manpage-rule =
45 %.$(1): %.$(1).xml
46 $$(XSLTPROC) \
47 --xinclude \
48 --stringparam package $$(PACKAGE) \
49 --stringparam version $$(VERSION)\
50 docbook-update-source-data.xsl $$< | \
51 $$(XSLTPROC) \
52 --xinclude \
53 $$(DOCBOOK5_MANPAGES_FLAGS) \
54 --output $$@ \
55 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
56 -
57 endef
59 DESTDIR ?=
60 prefix ?= /usr/local
61 bindir ?= $(prefix)/bin
62 datadir ?= $(prefix)/share
63 mandir ?= $(datadir)/man
64 localedir ?= $(datadir)/locale
65 sysconfdir ?= /etc
66 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
68 OBJS = main.o pkui-icon.o pkui-backend.o
69 MANPAGES = $(PACKAGE).1
70 AUTOSTART_FILE = $(PACKAGE).desktop
71 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
72 POTFILE = po/$(PACKAGE).pot
73 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 unique-1.0 libnotify packagekit-glib2) \
74 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
75 -DPACKAGE="\"$(PACKAGE)\"" \
76 -DAPP_NAME=\"$(APP_NAME)\" \
77 -DVERSION=\"$(VERSION)\" \
78 -DLOCALEDIR="\"$(localedir)\""
79 LDLIBS := $(shell pkg-config --libs gtk+-2.0 unique-1.0 libnotify packagekit-glib2)
80 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
81 --stringparam man.copyright.section.enabled 0
83 .DEFAULT_TARGET = all
85 .PHONY: all clean clobber dist install
87 all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
89 $(PACKAGE): $(OBJS)
90 $(LINK.o) $^ $(LDLIBS) -o $@
92 $(POTFILE): po/POTFILES.in
93 cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)"
95 pot: $(POTFILE)
97 update-po: $(POTFILE)
98 cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
99 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \
100 $${lang}; \
101 done
103 %.o: %.c
104 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
105 $(COMPILE.c) -o $@ $<
107 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
109 %.desktop: %.desktop.in $(MOFILES)
110 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
112 %.mo: %.po
113 $(MSGFMT) -o $@ $<
115 install:
116 $(INSTALL.exec) $(PACKAGE) $(DESTDIR)$(bindir)/$(PACKAGE)
117 $(INSTALL.data) $(AUTOSTART_FILE) \
118 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
119 for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
120 $(INSTALL.data) po/$${lang}.mo \
121 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \
122 done
123 $(INSTALL.data) $(PACKAGE).1 \
124 $(DESTDIR)$(mandir)/man1/$(PACKAGE).1
126 clean:
127 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
129 clobber: clean
130 rm -f $(patsubst %.o,%.d,$(OBJS))
132 dist: clobber
133 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
134 -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz
136 -include $(patsubst %.o,%.d,$(OBJS))