annotate Makefile @ 8:58a3312a1c59

add internationalization support add German translation --HG-- rename : pk-update-icon.desktop => pk-update-icon.desktop.in
author Guido Berhoerster <guido@berhoerster.name>
date Tue, 11 Oct 2011 17:07:49 +0200
parents 56a7ed833d0a
children 0e50d3652326
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
1 INSTALL := install
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
2 INSTALL.exec := $(INSTALL) -D -m 0755
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
3 INSTALL.data := $(INSTALL) -D -m 0644
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
4 SED := sed
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
5 MSGFMT := msgfmt
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
6 INTLTOOL_UPDATE := intltool-update
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
7 INTLTOOL_MERGE := intltool-merge
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
8
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
9 DESTDIR ?=
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
10 prefix ?= /usr/local
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
11 bindir ?= $(prefix)/bin
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
12 datadir ?= $(prefix)/share
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
13 localedir ?= $(datadir)/locale
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
14 sysconfdir ?= /etc
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
15 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
16
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
17 PACKAGE = pk-update-icon
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
18 VERSION = 0.1
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
19 OBJS = main.o notify.o packagekit.o
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
20 AUTOSTART_FILE = $(PACKAGE).desktop
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
21 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
22 POTFILE = po/$(PACKAGE).pot
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
23 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 libnotify packagekit-glib2) \
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
24 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
25 -DPACKAGE="\"$(PACKAGE)\"" \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
26 -DLOCALEDIR="\"$(localedir)\""
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
27 LDLIBS := $(shell pkg-config --libs gtk+-2.0 libnotify packagekit-glib2)
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
28
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
29 .DEFAULT_TARGET = all
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
30
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
31 .PHONY: all clean install
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
32
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
33 all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE)
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
34
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
35 $(PACKAGE): $(OBJS)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
36 $(LINK.o) $^ $(LDLIBS) -o $@
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
37
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
38 $(POTFILE): po/POTFILES.in
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
39 cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)"
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
40
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
41 pot: $(POTFILE)
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
42
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
43 update-po: $(POTFILE)
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
44 cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
45 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
46 $${lang}; \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
47 done
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
48
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
49 %.o: %.c
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
50 $(COMPILE.c) -MD -o $@ $<
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
51 @cp $*.d $*.P; \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
52 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
53 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
54 rm -f $*.d
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
55
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
56 %.desktop: %.desktop.in $(MOFILES)
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
57 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
58
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
59 %.mo: %.po
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
60 $(MSGFMT) -o $@ $<
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
61
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
62 install:
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
63 $(INSTALL.exec) $(PACKAGE) $(DESTDIR)$(bindir)/$(PACKAGE)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
64 $(INSTALL.data) $(AUTOSTART_FILE) \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
65 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
66 for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
67 $(INSTALL.data) po/$${lang}.mo \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
68 $(DESTDIR)$(LOCALEDIR)/$${lang}/$(PACKAGE).mo; \
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
69 done
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
70
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
71 clean:
8
58a3312a1c59 add internationalization support
Guido Berhoerster <guido@berhoerster.name>
parents: 7
diff changeset
72 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
73
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
74 -include $(patsubst %.o,%.P,$(OBJS))