Re: Environment variables, debian/rules and dpkg-buildpackage
On Mon, 16 Mar 2009, Manoj Srivastava wrote:
> > However, if the caller really wish that his build options prevail in
> > all cases, he can use "make -e" (and dpkg-buildpackage has the -R
> > option that let him call "debian/rules" as "make -e -f debian/rules"
> > instead).
> We do not want to override *EVERYTHING* in the Makefile, just
> the CFLAGS. This blunt instrument of the -e flag is not a good
Then he can add the required parameter on the command line instead
of using the environment.
make -f debian/rules CFLAGS="..." <target>
You don't seem to grasp the fact that mandating some variables to be
preset doesn't forbid us to rely on Makefile features if we chose to.
> > Apparently there's no way to know from where the variable value come in
> > make. That's true for environment variables like for command line
> > variables.
> > (at least according to my lookup of info make)
> Err, I think you need to get more conversant with Make. Yes,
> there is no way to know whether or not the environment variables were
> set by dpkg or the user; but it is itrivial to make it so that the
> project wide defaults can be overridden by the site wide stuff, and
> each being overridden by the package at will. We can even make it so
> that the package can tell which one set the value, and override only
> the project wide one and not the site variable.
It is trivial to do with whatever solution we retain. The problematic part
that I pointed out is "how to know in the rules file if the CFLAGS value
comes from the command-line, from the environment or from the makefile
Do you have a solution to that ? If no, then there was no point in
suggesting me to get more conversant with Make. If yes, show it to
Suppose you have "FOO ?= bar" in the Makefile, write me the rest of the
Makefile so that I have this:
$ FOO=foo make
FOO was set in the environment
$ make FOO=foo
FOO was set on the command-line
FOO was set in the Makefile
Contribuez à Debian et gagnez un cahier de l'admin Debian Lenny :