comparison 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
comparison
equal deleted inserted replaced
34:6049c7540dba 35:b84b4ae937e3
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 #
20
21 PACKAGE = pk-update-icon
22 APP_NAME = org.opensuse.pk-update-icon
23 VERSION = 0.2.2
24 DISTNAME := $(PACKAGE)-$(VERSION)
25
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) --
1 INSTALL := install 32 INSTALL := install
2 INSTALL.exec := $(INSTALL) -D -m 0755 33 INSTALL.exec := $(INSTALL) -D -m 0755
3 INSTALL.data := $(INSTALL) -D -m 0644 34 INSTALL.data := $(INSTALL) -D -m 0644
4 TAR := tar 35 TAR := tar
5 GZIP := gzip 36 GZIP := gzip
15 mandir ?= $(datadir)/man 46 mandir ?= $(datadir)/man
16 localedir ?= $(datadir)/locale 47 localedir ?= $(datadir)/locale
17 sysconfdir ?= /etc 48 sysconfdir ?= /etc
18 xdgautostartdir ?= $(sysconfdir)/xdg/autostart 49 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
19 50
20 PACKAGE = pk-update-icon
21 APP_NAME = org.opensuse.pk-update-icon
22 VERSION = 0.2.2
23 DISTNAME := $(PACKAGE)-$(VERSION)
24 OBJS = main.o pkui-icon.o pkui-backend.o 51 OBJS = main.o pkui-icon.o pkui-backend.o
25 AUTOSTART_FILE = $(PACKAGE).desktop 52 AUTOSTART_FILE = $(PACKAGE).desktop
26 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) 53 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
27 POTFILE = po/$(PACKAGE).pot 54 POTFILE = po/$(PACKAGE).pot
28 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 unique-1.0 libnotify packagekit-glib2) \ 55 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 unique-1.0 libnotify packagekit-glib2) \
52 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \ 79 $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \
53 $${lang}; \ 80 $${lang}; \
54 done 81 done
55 82
56 %.o: %.c 83 %.o: %.c
57 $(COMPILE.c) -MD -o $@ $< 84 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
58 @cp $*.d $*.P; \ 85 $(COMPILE.c) -o $@ $<
59 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
60 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
61 rm -f $*.d
62 86
63 %.desktop: %.desktop.in $(MOFILES) 87 %.desktop: %.desktop.in $(MOFILES)
64 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ 88 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
65 89
66 %.mo: %.po 90 %.mo: %.po
79 103
80 clean: 104 clean:
81 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE) 105 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
82 106
83 clobber: clean 107 clobber: clean
84 rm -f *.P 108 rm -f $(patsubst %.o,%.d,$(OBJS))
85 109
86 dist: clobber 110 dist: clobber
87 rm -f $(DISTNAME) 111 rm -f $(DISTNAME)
88 ln -s -f . $(DISTNAME) 112 ln -s -f . $(DISTNAME)
89 $(TAR) cv $(DISTNAME)/* | $(GZIP) > $(DISTNAME).tar.gz 113 $(TAR) cv $(DISTNAME)/* | $(GZIP) > $(DISTNAME).tar.gz
90 114
91 -include $(patsubst %.o,%.P,$(OBJS)) 115 -include $(patsubst %.o,%.d,$(OBJS))