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: ali hagigat
Subject: Re: #include in a C file
Date: Mon, 6 Dec 2010 11:02:38 +0330

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?)



reply via email to

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