Bug#613046: debian-policy: please update example in 4.9.1 (debian/rules and DEB_BUILD_OPTIONS)
On Fri, 27 Jan 2012, Matthijs Kooijman wrote:
> > -ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
> > - CFLAGS += -O0
> > -else
> > - CFLAGS += -O2
> > -endif
> > +CFLAGS := -Wall $(shell dpkg-buildflags --get CFLAGS)
> > ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
> > INSTALL_PROGRAM += -s
> > endif
>
> Wouldn't it be more appropriate to use
>
> DEB_CFLAGS_MAINT_PREPEND := -Wall
>
> here before calling dpkg-buildflags? Possibly the rest of the example
> could be modified to use DEB_CFLAGS_MAINT_APPEND as well.
Well, they are there so that you can tweak the output of dpkg-buildflags
when the call happens in lower layer and that you have no control over the
call and its output.
And you must take care because $(shell dpkg-buildflags ...) will not see the
DEB_CFLAGS_MAINT_PREPEND that you have set in the rules files. Either you
do $(shell DEB_CFLAGS_MAINT_PREPEND=... dpkg-buildflags ...) or you use
/usr/share/dpkg/buildflags.mk which does the right thing for you.
> Not sure if this is really needed, but it seems to me that that is what
> these variables were invented for :-)
Maybe all the samples from Policy should be simplified to use the Makefile
snippets...
Cheers,
--
Raphaël Hertzog ◈ Debian Developer
Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/
Reply to: