Mercurial > projects > pk-update-icon
annotate Makefile @ 35:b84b4ae937e3
Fix automatic dependency generation and improve portability
author | Guido Berhoerster <gber@opensuse.org> |
---|---|
date | Fri, 07 Feb 2014 17:55:13 +0100 |
parents | cd271b582019 |
children | 82a31628a26d |
rev | line source |
---|---|
35
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
1 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
2 # Copyright (C) 2014 Guido Berhoerster <gber@opensuse.org> |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
3 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
4 # Licensed under the GNU General Public License Version 2 |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
5 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
6 # This program is free software; you can redistribute it and/or modify |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
7 # it under the terms of the GNU General Public License as published by |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
8 # the Free Software Foundation; either version 2 of the License, or |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
9 # (at your option) any later version. |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
10 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
14 # GNU General Public License for more details. |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
15 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
16 # You should have received a copy of the GNU General Public License |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
17 # along with this program; if not, write to the Free Software |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
19 # |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
20 |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
21 PACKAGE = pk-update-icon |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
22 APP_NAME = org.opensuse.pk-update-icon |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
23 VERSION = 0.2.2 |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
24 DISTNAME := $(PACKAGE)-$(VERSION) |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
25 |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
26 # gcc, clang, icc |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
27 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(CPPFLAGS) |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
28 # Sun/Solaris Studio |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
29 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(CPPFLAGS) |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
30 # X makedepend |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
31 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) -- |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
32 INSTALL := install |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
33 INSTALL.exec := $(INSTALL) -D -m 0755 |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
34 INSTALL.data := $(INSTALL) -D -m 0644 |
22
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
35 TAR := tar |
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
36 GZIP := gzip |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
37 SED := sed |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
38 MSGFMT := msgfmt |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
39 INTLTOOL_UPDATE := intltool-update |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
40 INTLTOOL_MERGE := intltool-merge |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
41 |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
42 DESTDIR ?= |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
43 prefix ?= /usr/local |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
44 bindir ?= $(prefix)/bin |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
45 datadir ?= $(prefix)/share |
10 | 46 mandir ?= $(datadir)/man |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
47 localedir ?= $(datadir)/locale |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
48 sysconfdir ?= /etc |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
49 xdgautostartdir ?= $(sysconfdir)/xdg/autostart |
0 | 50 |
14
64f05992d8ec
GObject-based rewrite
Guido Berhoerster <guido@berhoerster.name>
parents:
13
diff
changeset
|
51 OBJS = main.o pkui-icon.o pkui-backend.o |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
52 AUTOSTART_FILE = $(PACKAGE).desktop |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
53 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
54 POTFILE = po/$(PACKAGE).pot |
9
0e50d3652326
use libunique to ensure that only a single instance of pk-update-icon can be run
Guido Berhoerster <guido@berhoerster.name>
parents:
8
diff
changeset
|
55 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 unique-1.0 libnotify packagekit-glib2) \ |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
56 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
57 -DPACKAGE="\"$(PACKAGE)\"" \ |
9
0e50d3652326
use libunique to ensure that only a single instance of pk-update-icon can be run
Guido Berhoerster <guido@berhoerster.name>
parents:
8
diff
changeset
|
58 -DAPP_NAME=\"$(APP_NAME)\" \ |
16
7af115023d5a
add CLI, make delay and interval configurable
Guido Berhoerster <guido@berhoerster.name>
parents:
15
diff
changeset
|
59 -DVERSION=\"$(VERSION)\" \ |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
60 -DLOCALEDIR="\"$(localedir)\"" |
9
0e50d3652326
use libunique to ensure that only a single instance of pk-update-icon can be run
Guido Berhoerster <guido@berhoerster.name>
parents:
8
diff
changeset
|
61 LDLIBS := $(shell pkg-config --libs gtk+-2.0 unique-1.0 libnotify packagekit-glib2) |
0 | 62 |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
63 .DEFAULT_TARGET = all |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
64 |
22
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
65 .PHONY: all clean clobber dist install |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
66 |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
67 all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE) |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
68 |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
69 $(PACKAGE): $(OBJS) |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
70 $(LINK.o) $^ $(LDLIBS) -o $@ |
0 | 71 |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
72 $(POTFILE): po/POTFILES.in |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
73 cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)" |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
74 |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
75 pot: $(POTFILE) |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
76 |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
77 update-po: $(POTFILE) |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
78 cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
79 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
80 $${lang}; \ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
81 done |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
82 |
0 | 83 %.o: %.c |
35
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
84 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d |
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
85 $(COMPILE.c) -o $@ $< |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
86 |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
87 %.desktop: %.desktop.in $(MOFILES) |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
88 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
89 |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
90 %.mo: %.po |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
91 $(MSGFMT) -o $@ $< |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
92 |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
93 install: |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
94 $(INSTALL.exec) $(PACKAGE) $(DESTDIR)$(bindir)/$(PACKAGE) |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
95 $(INSTALL.data) $(AUTOSTART_FILE) \ |
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
96 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE) |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
97 for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ |
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
98 $(INSTALL.data) po/$${lang}.mo \ |
13
dca97330d81e
fix the locale path
Guido Berhoerster <guido@berhoerster.name>
parents:
10
diff
changeset
|
99 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \ |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
100 done |
10 | 101 $(INSTALL.data) $(PACKAGE).1 \ |
102 $(DESTDIR)$(mandir)/man1/$(PACKAGE).1 | |
0 | 103 |
104 clean: | |
8
58a3312a1c59
add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents:
7
diff
changeset
|
105 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE) |
7
56a7ed833d0a
allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents:
6
diff
changeset
|
106 |
15
c7eac2574c76
add clobber target
Guido Berhoerster <guido@berhoerster.name>
parents:
14
diff
changeset
|
107 clobber: clean |
35
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
108 rm -f $(patsubst %.o,%.d,$(OBJS)) |
15
c7eac2574c76
add clobber target
Guido Berhoerster <guido@berhoerster.name>
parents:
14
diff
changeset
|
109 |
22
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
110 dist: clobber |
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
111 rm -f $(DISTNAME) |
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
112 ln -s -f . $(DISTNAME) |
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
113 $(TAR) cv $(DISTNAME)/* | $(GZIP) > $(DISTNAME).tar.gz |
b18c70b2a6ca
add dist target to Makefile
Guido Berhoerster <guido@berhoerster.name>
parents:
16
diff
changeset
|
114 |
35
b84b4ae937e3
Fix automatic dependency generation and improve portability
Guido Berhoerster <gber@opensuse.org>
parents:
32
diff
changeset
|
115 -include $(patsubst %.o,%.d,$(OBJS)) |