[PATCH] LDFLAGS configuration

Shaun Jackman sjackman at gmail.com
Wed Jun 7 16:08:57 UTC 2006


On 6/6/06, Rob Landley <rob at landley.net> wrote:
> Does supplying it as an environment variable work?
>
> LDFLAGS="-Wl,--verbose -Wl,-n -Wl,-O1 -Wl,-t" make
>
> There are such things as wrapper scripts...

Yes, using an environment variable would work, although it's not
recommended. See below for comments from the make's manual. I'd much
prefer, and it seems far more congruous, to set LDFLAGS in the same
place one sets CFLAGS. It seems pretty arbitrary that CFLAGS can be
set in the configuration process, but LDFLAGS cannot.

Cheers,
Shaun

info make: 6.9 Variables from the environment

	When `make' runs a command script, variables defined
	in the makefile are placed into the environment of
	that command.  This allows you to pass values to
	sub-`make' invocations (*note Recursive Use of
	`make': Recursion.).  By default, only variables that
	came from the environment or the command line are
	passed to recursive invocations.  You can use the
	`export' directive to pass other variables.

	Other use of variables from the environment is not
	recommended.  It is not wise for makefiles to depend
	for their functioning on environment variables set up
	outside their control, since this would cause
	different users to get different results from the
	same makefile.  This is against the whole purpose
	of most makefiles.



More information about the busybox mailing list