Debian policy recommended snippet prevents building packages from external Makefile
Hi
The Problem
~~~~~~~~~~~
While preparing a backport of GNU tar, I notice that calling
dpkg-buildpackage from an external Makefile errors when we use the
parallel jobs options fails.
A Makefile with something like
do-build:
cd ${EXTRACTED}; dpkg-buildpackage -b -uc -us
does not work.
The Details
~~~~~~~~~~~
Suppose you have these files
$PWD/Makefile
all:
cd subdir && $(MAKE)
and
$PWD/subdir/Makefile
$(info $(MAKEFLAGS))
if you call make from $PWD you will get an output of w ( this is the
make switch --print-directory is added, I don't know why at the momment)
Now in the Debian policy 4.9.1 we recommend to add build flags as such:
MAKEFLAGS += -j$(NUMJOBS)
and I guess most packages, like tar, will then call
$(MAKE) $(MAKEFLAGS)
now if dpkg-buildpackages is called from a Makefile in a parent folder
w is passed without being prepended a dash, and it will be interpreted
as a target name, causing make to bail out with
RSH="/usr/bin/rsh" CPPFLAGS="`dpkg-buildflags --get CPPFLAGS`"
CFLAGS="`dpkg-buildflags --get CFLAGS` -Wall" \
LDFLAGS="`dpkg-buildflags --get LDFLAGS`" /usr/bin/make w -j
--jobserver-fds=3,4
make[2]: Entering directory '/home/e.kasper/pve/tar/tar-1.28'
make[2]: *** No rule to make target 'w'. Stop.
my workaround at the momment is to override dpkg-buildpackage make
call by doing
cd ${EXTRACTED}; dpkg-buildpackage -b -uc -us -R"$(MAKE)
--no-print-directory -f debian/rules"
So am I missing something here ? are we using MAKEFLAGS in a sane way ?
If you came down to here, thanks for your attention !
Emmanuel
Reply to: