projects/pk-update-icon

changeset 35:b84b4ae937e3

Fix automatic dependency generation and improve portability
author Guido Berhoerster <gber@opensuse.org>
date Fri Feb 07 17:55:13 2014 +0100 (2014-02-07)
parents 6049c7540dba
children 82a31628a26d
files Makefile deps.sed
line diff
     1.1 --- a/Makefile	Sat Apr 27 14:36:55 2013 +0000
     1.2 +++ b/Makefile	Fri Feb 07 17:55:13 2014 +0100
     1.3 @@ -1,3 +1,34 @@
     1.4 +#
     1.5 +# Copyright (C) 2014 Guido Berhoerster <gber@opensuse.org>
     1.6 +#
     1.7 +# Licensed under the GNU General Public License Version 2
     1.8 +#
     1.9 +# This program is free software; you can redistribute it and/or modify
    1.10 +# it under the terms of the GNU General Public License as published by
    1.11 +# the Free Software Foundation; either version 2 of the License, or
    1.12 +# (at your option) any later version.
    1.13 +#
    1.14 +# This program is distributed in the hope that it will be useful,
    1.15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +# GNU General Public License for more details.
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License
    1.20 +# along with this program; if not, write to the Free Software
    1.21 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +
    1.24 +PACKAGE =	pk-update-icon
    1.25 +APP_NAME =	org.opensuse.pk-update-icon
    1.26 +VERSION =	0.2.2
    1.27 +DISTNAME :=	$(PACKAGE)-$(VERSION)
    1.28 +
    1.29 +# gcc, clang, icc
    1.30 +MAKEDEPEND.c =	$(CC) -MM $(CFLAGS) $(CPPFLAGS)
    1.31 +# Sun/Solaris Studio
    1.32 +#MAKEDEPEND.c =	$(CC) -xM1 $(CFLAGS) $(CPPFLAGS)
    1.33 +# X makedepend
    1.34 +#MAKEDEPEND.c =	makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) --
    1.35  INSTALL :=	install
    1.36  INSTALL.exec :=	$(INSTALL) -D -m 0755
    1.37  INSTALL.data :=	$(INSTALL) -D -m 0644
    1.38 @@ -17,10 +48,6 @@
    1.39  sysconfdir ?=	/etc
    1.40  xdgautostartdir ?=	$(sysconfdir)/xdg/autostart
    1.41  
    1.42 -PACKAGE =	pk-update-icon
    1.43 -APP_NAME =	org.opensuse.pk-update-icon
    1.44 -VERSION =	0.2.2
    1.45 -DISTNAME :=	$(PACKAGE)-$(VERSION)
    1.46  OBJS =		main.o pkui-icon.o pkui-backend.o
    1.47  AUTOSTART_FILE =	$(PACKAGE).desktop
    1.48  MOFILES :=	$(patsubst %.po,%.mo,$(wildcard po/*.po))
    1.49 @@ -54,11 +81,8 @@
    1.50  	done
    1.51  
    1.52  %.o: %.c
    1.53 -	$(COMPILE.c) -MD -o $@ $<
    1.54 -	@cp $*.d $*.P; \
    1.55 -	$(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
    1.56 -	       -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
    1.57 -	rm -f $*.d
    1.58 +	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
    1.59 +	$(COMPILE.c) -o $@ $<
    1.60  
    1.61  %.desktop: %.desktop.in $(MOFILES)
    1.62  	$(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
    1.63 @@ -81,11 +105,11 @@
    1.64  	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
    1.65  
    1.66  clobber: clean
    1.67 -	rm -f *.P
    1.68 +	rm -f $(patsubst %.o,%.d,$(OBJS))
    1.69  
    1.70  dist: clobber
    1.71  	rm -f $(DISTNAME)
    1.72  	ln -s -f . $(DISTNAME)
    1.73  	$(TAR) cv $(DISTNAME)/* | $(GZIP) > $(DISTNAME).tar.gz
    1.74  
    1.75 --include $(patsubst %.o,%.P,$(OBJS))
    1.76 +-include $(patsubst %.o,%.d,$(OBJS))
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/deps.sed	Fri Feb 07 17:55:13 2014 +0100
     2.3 @@ -0,0 +1,26 @@
     2.4 +/^[^:]\{1,\}:.*\\$/{
     2.5 +    h
     2.6 +    s/\([^:]\{1,\}:\).*/\1/
     2.7 +    x
     2.8 +    s/[^:]\{1,\}://
     2.9 +}
    2.10 +/\\$/,/^$/bgen
    2.11 +/\\$/,/[^\\]$/{
    2.12 +:gen
    2.13 +    s/[[:blank:]]*\\$//
    2.14 +    s/^[[:blank:]]*//
    2.15 +    G
    2.16 +    s/\(.*\)\n\(.*\)/\2 \1/
    2.17 +}
    2.18 +/^[^:]\{1,\}:[[:blank:]]*$/d
    2.19 +/^[^:]\{1,\}\.o:/{
    2.20 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.[cC][[:blank:]]*/ /g
    2.21 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.[cC]$//g
    2.22 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.cc[[:blank:]]*/ /g
    2.23 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.cc$//g
    2.24 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.cpp[[:blank:]]*/ /g
    2.25 +    s/[[:blank:]]*[^[:blank:]]\{1,\}\.cpp$//g
    2.26 +    /^[^:]\{1,\}:[[:blank:]]*$/d
    2.27 +    s/^\([^:]\{1,\}\)\.o[[:blank:]]*:[[:blank:]]*\(.*\)/\1.d: $(wildcard \2)\
    2.28 +&/
    2.29 +}