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

Re: Make, LDFLAGS, library, wrong order?



> 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).

Dammit, only seconds after posting, I see the answer:

File: make.info,  Node: 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)'.

i.e., I wanted LOADLIBES, and this works.

That does mean there's a bug in 
  File: make.info,  Node: Implicit Variables
as that node doesn't mention that LOADLIBES.

-- 
joost witteveen, joostje@debian.org

My spamfilter is so good, it correctly catches 90% of incoming spam,
*including* all email from my PhD supervisor.


--
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: