Re: addition to debian standards
On 22-Sep-1998, Kevin Dalley <firstname.lastname@example.org> wrote:
> Matthew Parry <email@example.com> writes:
> > My idea for doing this is to have a DEBIAN_OM variable for the
> > -O and -m flags defined in each rules file so that you'll have
> > something like:
> > DEBIAN_OM = -O2 -m486
> > CFLAGS = -g -Wall
> > CFLAGS += $(DEBIAN_OM)
> Actually, I think that CFLAGS is made for just such a situation. Read
> the GNU standards document. It should be easy to pass
> CFLAGS=favorite flags
> to any rules file.
Not if CFLAGS is defined as
# Note must compile with these options or horrible things happen
# after running for 3 days with lots of important data.
CFLAGS = -fPIC -fno-builtin -g -Wall
make CFLAGS=favorite flags
and you will kill this definition!
A better approach is to allow a new variable (such as DEBIAN_OM)
to be defined on the command line, which simply adds to the CFLAGS.
CFLAGS is too general to be misused in this way.
For a relatively complex build system I use every day we have 4
different CFLAGS-like variables (one for the system configuration, one
for the application, one for the user to customize, and one per file for
individual file flags). CFLAGS is defined as the concatenation of all 4.
Besides, not all programs are written in C. With a DEBIAN_OM or
similar approach, the individual rules file can be written to pass
the appropriate options to whatever compiler is used, or if optimization
turns out to be buggy, it can ignore the DEBIAN_OM variable.
So have a rules file with:
DEBIAN_OM = -O2 # default optimization
CFLAGS = -g -Wall
CFLAGS += $(DEBIAN_OM)
and you can override if you like with -O6 -m486 or whatever you like
for a particular architecture. It is the rules file responsibility
to pass the parameter to various sub-programs (or not).
This also means that existing packages will have to be modified one
by one to do this, but I think this is the only safe approach anyway.
Those who would give up essential liberty to purchase a little temporary
safety deserve neither liberty nor safety. - Benjamin Franklin
Tyson Dowd <firstname.lastname@example.org> http://tyse.net