[Top][All Lists]

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

Re: Should this makefile really hang make?

From: Bryan Ischo
Subject: Re: Should this makefile really hang make?
Date: Tue, 15 Nov 2011 13:56:32 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1

On 11/15/11 13:41, Paul Smith wrote:
On Tue, 2011-11-15 at 13:30 -0800, Bryan Ischo wrote:
all: foo.a
%.a: $$(@:%.a=%.o)
An infinite loop is bad, sure; I'll check that out.  But why don't you
just write:

         all: foo.a
         %.a: %.o

??? There's no need for secondary expansion here.

It's just a demonstration of the problem, and the most succinct one I could find.

What I am really trying to do is something like this:

all: lib/libfoo.a lib/ lib/libbar.a lib/

%.o: %.c
      gcc -o %@ -c $^

%.po: %.c
      gcc -fPIC -o %@ -c $^

%.a: $$($$(basename $$(notdir $$@))_COMPONENTS)
      ar crv $@ $^ $$($$(basename $$(notdir $$@))_COMPONENTS:%.o=%.po)
      gcc -shared -o $@ $^

libfoo_COMPONENTS = foo.o foo2.o

libbar_COMPONENTS = bar.o

I have also tried this to get around the hang: $$(patsubst %.o,%.po,$$($$(basename $$(notdir $$@))_COMPONENTS))
      gcc -shared -o $@ $^

But the patsubst doesn't seem to work right; it doesn't substitute anything.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]