annotate Makefile @ 0:9a16bf50daba

Initial revision
author Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
date Sat, 27 Apr 2013 00:33:11 +0200
parents
children 1508a4c35c47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
1 #
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
2 # Copyright (C) 2013 Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
3 #
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
4 # Permission is hereby granted, free of charge, to any person obtaining
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
5 # a copy of this software and associated documentation files (the
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
6 # "Software"), to deal in the Software without restriction, including
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
7 # without limitation the rights to use, copy, modify, merge, publish,
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
8 # distribute, sublicense, and/or sell copies of the Software, and to
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
9 # permit persons to whom the Software is furnished to do so, subject to
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
10 # the following conditions:
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
11 #
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
12 # The above copyright notice and this permission notice shall be included
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
13 # in all copies or substantial portions of the Software.
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
14 #
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
22 #
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
23
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
24 PACKAGE = xinhibit-applet
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
25 APP_NAME = org.guido-berhoerster.xinhibit-applet
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
26 VERSION = 1
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
27 DISTNAME := $(PACKAGE)-$(VERSION)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
28
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
29 INSTALL := install
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
30 INSTALL.exec := $(INSTALL) -D -m 0755
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
31 INSTALL.data := $(INSTALL) -D -m 0644
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
32 PAX := pax
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
33 GZIP := gzip
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
34 SED := sed
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
35 MSGFMT := msgfmt
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
36 INTLTOOL_UPDATE := intltool-update
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
37 INTLTOOL_MERGE := intltool-merge
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
38
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
39 DESTDIR ?=
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
40 prefix ?= /usr/local
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
41 bindir ?= $(prefix)/bin
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
42 datadir ?= $(prefix)/share
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
43 mandir ?= $(datadir)/man
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
44 localedir ?= $(datadir)/locale
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
45 sysconfdir ?= /etc
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
46 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
47
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
48 HAVE_LIBXTST ?= 1
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
49
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
50 ifeq ($(HAVE_LIBXTST),1)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
51 CPPFLAGS_LIBXTST := -DHAVE_LIBXTST
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
52 LDLIBS_LIBXTST := -lX11 -lXext -lXtst
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
53 endif
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
54
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
55 OBJS = main.o xia-icon.o xia-inhibitor.o xia-debug.o
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
56 AUTOSTART_FILE = data/$(PACKAGE).desktop
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
57 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
58 POTFILE = po/$(PACKAGE).pot
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
59 POSRCS := $(shell sed -e 's/\#.*//' -e '/^[ \t]*$$/d' \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
60 -e 's/^\[[^]]*\]//' po/POTFILES.in | paste -s -d ' ')
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
61 CPPFLAGS := $(CPPFLAGS_LIBXTST) \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
62 $(shell pkg-config --cflags glib-2.0 gtk+-2.0 unique-1.0) \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
63 -DPACKAGE="\"$(PACKAGE)\"" \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
64 -DAPP_NAME=\"$(APP_NAME)\" \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
65 -DVERSION=\"$(VERSION)\" \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
66 -DLOCALEDIR="\"$(localedir)\""
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
67 LDLIBS := $(LDLIBS_LIBXTST) \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
68 $(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
69
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
70 .DEFAULT_TARGET = all
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
71
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
72 .PHONY: all clean clobber dist install
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
73
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
74 all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
75
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
76 $(PACKAGE): $(OBJS)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
77 $(LINK.o) $^ $(LDLIBS) -o $@
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
78
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
79 $(POTFILE): po/POTFILES.in $(POSRCS)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
80 cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)"
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
81
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
82 pot: $(POTFILE)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
83
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
84 update-po: $(POTFILE)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
85 cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
86 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
87 $${lang}; \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
88 done
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
89
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
90 %.o: %.c
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
91 $(COMPILE.c) -MD -o $@ $<
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
92 @cp $*.d $*.P; \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
93 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
94 -e 's/$$/ :/' < $*.d >> $*.P; \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
95 rm -f $*.d
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
96
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
97 %.desktop: %.desktop.in $(MOFILES)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
98 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
99
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
100 %.mo: %.po
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
101 $(MSGFMT) -o $@ $<
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
102
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
103 install:
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
104 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
105 for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
106 $(INSTALL.data) po/$${lang}.mo \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
107 "$(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo"; \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
108 done
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
109 cd data/icons && for icon in */*/*.png scalable/*/*.svg; do \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
110 $(INSTALL.data) $$icon \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
111 "$(DESTDIR)$(datadir)/icons/hicolor/$${icon}"; \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
112 done
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
113 $(INSTALL.data) $(AUTOSTART_FILE) \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
114 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))"
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
115 $(INSTALL.data) data/$(PACKAGE).1 \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
116 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1"
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
117
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
118 clean:
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
119 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
120
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
121 clobber: clean
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
122 rm -f *.P
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
123
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
124 dist: clobber
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
125 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
126 -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
127
9a16bf50daba Initial revision
Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
parents:
diff changeset
128 -include $(patsubst %.o,%.P,$(OBJS))