help-make
[Top][All Lists]
Advanced

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

Re: #include in a C file


From: Sam Ravnborg
Subject: Re: #include in a C file
Date: Mon, 6 Dec 2010 11:14:16 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, Dec 06, 2010 at 11:02:38AM +0330, ali hagigat wrote:
> In section 4.13, we have the following example:
> ----------------------------------------------------------
> %.d: %.c
> @set -e; rm -f $@; \
> $(CC) -M $(CPPFLAGS) $< > address@hidden; \
> sed ’s,\($*\)\.o[ :]*,\1.o $@ : ,g’ < address@hidden > $@; \
> rm -f address@hidden
> ----------------------------------------------------------
> Under what conditions this implicit rule is executed?
> Would you please give an example?
> 
> Why the 'sed' command is necessary? and why we need to have the following 
> rule:
> main.o main.d : main.c defs.h
> Can the command, 'sed' be replaced with:
> cp address@hidden $@
> (I mean we have one .d file for each .c file and it will be included,
> why we need a rule like   main.d : main.c defs.h? This rule is without
> recipe and what is it supposed to do?)

Sorry Ali.
I have tried to explain things but obvioulsy without luck.
Please go ahead and try out the things described - and _then_ ask questions.
I guess you would then figure out that the above has a receipe,
the purpose of sed etc.

Until then,

        Sam



reply via email to

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