This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GNU make builtin rules produce linker error due to command line arguments order


On 07/04/2010 00:24, Robrecht Dewaele wrote:

> $ LDFLAGS=-lpopt make options

  Only put flags in LDFLAGS.  Put libs in LDLIBS.  The default rule is

> %: %.c
> #  commands to execute (built-in):
> 	$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@

and LINK.c embeds LDFLAGS.  On ELF platforms where command-line order of
linker inputs doesn't matter so much, it'll often work to put -l options in
LDFLAGS, but it's not portable to PE platforms like Windows/Cygwin where the
libraries have to come last on the command-line.

    cheers,
      DaveK


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]