[Top][All Lists]
[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: |
Sat, 4 Dec 2010 14:35:41 +0330 |
the section 4.13 makes reader confused a bit!!
-------------------------------------------
For example, the command:
cc -M main.c
Note that such a prerequisite constitutes mentioning ‘main.o’ in a
makefile, so it can
never be considered an intermediate file by implicit rule search.
-------------------------------------------
What file will be considered as an intermediate file? and how?
> On 12/1/10, Paul Smith <address@hidden> wrote:
>> On Tue, 2010-11-30 at 11:54 +0330, ali hagigat wrote:
>>> If compiler generates the necessary prerequisites automatically by -M
>>> option why we need to have one makefile for each source file?
>>
>> I don't understand the relationship between the first part of the
>> sentence and the second part.
>>
>> The reason we recommend having one makefile per source file is that it's
>> very difficult to update the makefile with a new set of prerequisites
>> for a single file that's changed, if you concatenate them all together
>> into one big makefile.
>>
>> If you have foo.c, bar.c, and baz.c and you write all the dependencies
>> into one makefile, say deps.mk:
>>
>> foo.o: foo.c foo.h bar.h
>> bar.o: bar.c bar.h baz.h \
>> stdio.h stdlib.h
>> baz.o: baz.c bar.h foo.h baz.h
>>
>> Now say you edit "bar.c" and so the build system wants to regenerate its
>> prerequisite list... it's a lot harder to write a rule to update just
>> those lines for "bar.o" in that combined makefile than it would be to
>> overwrite the entire contents of a single file "bar.deps" or whatever.
>>
>> --
>> -------------------------------------------------------------------------------
>> Paul D. Smith <address@hidden> Find some GNU make tips at:
>> http://www.gnu.org http://make.mad-scientist.net
>> "Please remain calm...I may be mad, but I am a professional." --Mad
>> Scientist
>>
>>
>
- #include in a C file, ali hagigat, 2010/12/01
- Re: #include in a C file, Paul Smith, 2010/12/01
- Re: #include in a C file, David Boyce, 2010/12/01
- Re: #include in a C file, ali hagigat, 2010/12/04
- Re: #include in a C file, Sam Ravnborg, 2010/12/04
- Re: #include in a C file, ali hagigat, 2010/12/05
- Re: #include in a C file, Sam Ravnborg, 2010/12/05
- Re: #include in a C file, ali hagigat, 2010/12/05
- Re: #include in a C file, Sam Ravnborg, 2010/12/05
- Re: #include in a C file, ali hagigat, 2010/12/06
- Re: #include in a C file, Sam Ravnborg, 2010/12/06
- Re: #include in a C file, ali hagigat, 2010/12/06
- Re: #include in a C file, Paul Smith, 2010/12/06