[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Make, LDFLAGS, library, wrong order?



On Wed, Nov 12, 1997 at 12:45:25PM +0100, joost witteveen wrote:
> I want to setup a makefile for a newbie user, so that all of his C files
> (that use math) compile and link OK. I was hoping to do that by simply
> creating a Makefile with only the line "LDFLAGS=-lm", but then the
> compiler is called with
> 
>   cc -lm file.c -o file
> 
> i.e., the wrong order (-lm should have appeared at the end of the
> commandline).
> 
> Does anyone know of a variable I can set, or a rule I can create that
> (preferably easily) will do what I want (I.e., run the compiler with "cc
> -o file123 file123.c -lm", when he types "make file123")

info "GNU make" "Implicit Rules" "Catalogue of Rules"
:Linking a single object file
:     `N' is made automatically from `N.o' by running the linker
:     (usually called `ld') via the C compiler.  The precise command
:     used is `$(CC) $(LDFLAGS) N.o $(LOADLIBES)'.

So, use LOADLIBES=-lm .

Ray
-- 
Cyberspace, a final frontier. These are the voyages of my messages, 
on a lightspeed mission to explore strange new systems and to boldly go
where no data has gone before. 


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: