List Info

Thread: help with make file rules




help with make file rules
country flaguser name
United States
2008-03-14 06:43:57
Hello,

I have a need to merge contents of multiple static
libraries.

I am trying to use a make file to achieve this.

I do have the make file to extract libraries into a
temporary folder but I
can't read the directory listing into a variable to include
that in the
final archive command?

The attachment contains the make file and couple of sample
libraries...

Any help would be greatly appreciated.

Thanks in advance.

Cheers
http
://www.nabble.com/file/p16048049/libclub.tar libclub.tar

-- 
View this message in context: http://www.nabble.com/help-with-make-fil
e-rules-tp16048049p16048049.html
Sent from the Gnu - Make - Help mailing list archive at
Nabble.com.



_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: help with make file rules
country flaguser name
United States
2008-03-15 01:45:28
anonymoussuperuser wrote:

> I do have the make file to extract libraries into a
temporary folder but I
> can't read the directory listing into a variable to
include that in the
> final archive command?

When make runs a rule, it first expands all variables and
then runs the
command.  What you've written is the equivalent of telling
make to run
this:

sh -c "cd ../bins; ls > ; ar cru libtarget.a "

That's nonsensical.  In the context of the command being
executed there
is no means to access or modify any make variables --
they've already
been expanded at that point.  But that's not a problem as
there's no
need to assign the object filenames to a variable.  You
don't need any
"ls" here, just let the shell do it.  If you had
typed "cd ../bins; ar
-cru libtarget.a *.o" at a regular shell prompt it
would have worked, so
just put that in your rule:

$: $
	cd $; 
	ar -cru $ *.o

If for some reason you really need to get a list of
filenames from a
glob into a make variable then you can't do it by executing
commands in
a recipe, you have to use the make function $(wildcard).

Brian


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )