[Top][All Lists]

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

Suggestion: Modification to 'make' manual

From: Scott A. Colcord
Subject: Suggestion: Modification to 'make' manual
Date: Fri, 27 Jul 2001 14:41:46 -0400
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.16-3 i686; en-US; m18) Gecko/20010131 Netscape6/6.01

Hello...after fiddling around a bit learning make, I'd like to suggest
a minor change to the make manual at http://www.gnu.org/manual/make/

In the section "Generating Prerequisites Automatically", there's a
sed script used to add a rule for the .d file. The problem I ran into is that I was using source files in a different directory than the Makefile, and thus they contained slashes, which blew up the sed expression. I used a subst expression to escape out the slashes, and things started working again.

I also '@'-ed the expression to keep the noise down.

Anyway, I thought these fixes might be handy to pass on.


        Scott A. Colcord
        Software Engineer

%.d: %.c
        set -e; $(CC) -M $(CPPFLAGS) $< \
        | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
        [ -s $@ ] || rm -f
%.d: %.c
        @set -e; $(CC) -M $(CPPFLAGS) $< \
        |sed 's/\($(subst /,\/,$*)\)\.o[ :]*/\1.o $(subst /,\/,$@) : /g' > $@; \
        [ -s $@ ] || rm -f $@

reply via email to

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