Makefile tweak for -lm?

Rob Landley rob at
Sat Dec 3 03:39:04 UTC 2005

On Friday 02 December 2005 10:28, Mike Frysinger wrote:
> if you move the first line to the top, duplicate the second line for
> every applet, and move the third line to the 'end' (basically after
> all of the previous settings), then no, it wont add -lm more than once

Ok, so you're talking about having specific mentions of CONFIG_FEATURE_BLAH 
not in the Makefile snippet for the blah/ subdirectory, but in Rules.mak?

I'd really, really, really rather not have specific applet mentions outside of 
the directory for that applet, if we can avoid it.

> the make foo is expanded to:
> needlibm-y :=
> ...
> needlibm-y := -lm
> needlibm-y := -lm
> needlibm-n := -lm
> ...
> LIBRARIES += $(needlibm-y)
> and since the := only ever sets, not increments, it isnt an issue ...

The old problem I always have with makefiles is "what order does this happen 
in".  How do I know that LIBRARIES += $(needlibm-y) will be evaluated after 
needlibm-y gets set in all the places it needs to be?

Is there an obvious place in the top level makefile to stick LIBRARIES += 
$(needlibm-y), after all the sub-makefiles have been #included?  I'll 

Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.

More information about the busybox mailing list