[Top][All Lists]

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

Re: make question (dependency)

From: Paul Jarc
Subject: Re: make question (dependency)
Date: Fri, 10 Feb 2006 14:59:07 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

"James" <> wrote:
> How NOT to generate an empty dependency file if fails? For example,
> TOP = $(HOME)
> %.d: %.c
>     $(CC) -M $< | sed "s/$(TOP)/$$(TOP)/" > $@
> if $(CC) -M fails, it generates an empty .d file.

%.d: %.c
        $(CC) -M $< > $@.tmp
        sed "s/$(TOP)/$$(TOP)/" < $@.tmp > $@
        rm -f $@.tmp

But you probably want single quotes around the sed command, not double
quotes.  With double quotes, the shell will see:
  sed "s/something/$(TOP)/"
and so $(TOP) will be interpreted as command substitution.


reply via email to

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