Unix Programming - Automatic variable $^ in makefile

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > Automatic variable $^ in makefile





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Automatic variable $^ in makefile
Alex Vinokur

2005-11-21, 2:49 am

Here is quote from
http://www.gnu.org/software/make/ma...ake.html#IDX586
------------------
$^
The names of all the prerequisites, with spaces between them. For
prerequisites which are archive members, only the member named is used
(see section 11. Using make to Update Archive Files). A target has only
one prerequisite on each other file it depends on, no matter how many
times each file is listed as a prerequisite. So if you list a
prerequisite more than once for a target, the value of $^ contains just
one copy of the name.
------------------

Any sample of using og $^ ?

Thanks.

Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn

Paul Pluzhnikov

2005-11-21, 2:49 am

"Alex Vinokur" <alexvn@users.sourceforge.net> writes:

> Any sample of using og $^ ?


----------------------------------------
OBJS1 = main.o foo.o bar.o
OBJS2 = main.o foo.o baz.o

all: t1 t2

t1: $(OBJS1)
$(CC) -o $@ $^

t2: $(OBJS2) libZZZ.a
$(CXX) -o $@ $^
----------------------------------------

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com