Changes between Version 6 and Version 7 of Attic/Building/BuildSystem


Ignore:
Timestamp:
Oct 9, 2006 11:04:51 AM (8 years ago)
Author:
alexey
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Attic/Building/BuildSystem

    v6 v7  
     1[[PageOutline]] 
     2 
    13= The {{{Makefile}}} architecture = 
    24 
     
    6668   consists of a large quantity of standard 
    6769   {{{Makefile}}} code.  We discuss this 
    68    boilerplate in more detail in [[ref(The {{{mk/boilerplate.mk}}} file)]]. 
     70   boilerplate in more detail in [[ref(The mk/boilerplate.mk file)]]. 
    6971   [[br]][[br]] 
    7072   Before the {{{include}}} statement, you 
     
    7577   directory in which the {{{boilerplate.mk}}} 
    7678   file is.  It is ''not'' OK to simply say 
    77  
    7879  {{{ 
    7980include ../mk/boilerplate.mk  # NO NO NO 
    8081}}} 
    81  
    82   Why?  Because the {{{boilerplate.mk}}} 
    83   file needs to know where it is, so that it can, in turn, 
    84   {{{include}}} other files.  (Unfortunately, 
    85   when an {{{include}}}d file does an 
    86   {{{include}}}, the filename is treated relative 
    87   to the directory in which {{{make}}} is being 
    88   run, not the directory in which the 
    89   {{{include}}}d sits.)  In general, 
    90   ''every file {{{foo.mk}}} assumes 
    91   that 
    92   {{{$(TOP)/mk/foo.mk}}} 
    93   refers to itself.'' It is up to the 
    94   {{{Makefile}}} doing the 
    95   {{{include}}} to ensure this is the case. 
     82   Why?  Because the {{{boilerplate.mk}}} 
     83   file needs to know where it is, so that it can, in turn, 
     84   {{{include}}} other files.  (Unfortunately, 
     85   when an {{{include}}}d file does an 
     86   {{{include}}}, the filename is treated relative 
     87   to the directory in which {{{make}}} is being 
     88   run, not the directory in which the 
     89   {{{include}}}d sits.)  In general, 
     90   ''every file {{{foo.mk}}} assumes 
     91   that 
     92   {{{$(TOP)/mk/foo.mk}}} 
     93   refers to itself.'' It is up to the 
     94   {{{Makefile}}} doing the 
     95   {{{include}}} to ensure this is the case. 
    9696 
    9797 
     
    115115   discuss the reason later, in <xref 
    116116   linkend="sec-boiler-arch"/>. 
    117  
    118   You do not ''have'' to 
    119   {{{include}}} the 
    120   {{{target.mk}}} file.  Instead, you can write 
    121   rules of your own for all the standard targets.  Usually, 
    122   though, you will find quite a big payoff from using the 
    123   canned rules in {{{target.mk}}}; the price 
    124   tag is that you have to understand what canned rules get 
    125   enabled, and what they do (<xref 
    126   linkend="sec-targets"/>). 
     117   [[br]][[br]] 
     118   You do not ''have'' to 
     119   {{{include}}} the 
     120   {{{target.mk}}} file.  Instead, you can write 
     121   rules of your own for all the standard targets.  Usually, 
     122   though, you will find quite a big payoff from using the 
     123   canned rules in {{{target.mk}}}; the price 
     124   tag is that you have to understand what canned rules get 
     125   enabled, and what they do (<xref 
     126   linkend="sec-targets"/>). 
    127127 
    128128       
     
    199199      tell {{{make}}} how to construct one file 
    200200      from another. 
    201  
    202            
    203  
    204   {{{boilerplate.mk}}} needs to be 
    205   {{{include}}}d at the ''top'' 
    206   of each {{{Makefile}}}, so that the user can 
    207   replace the boilerplate definitions or pattern rules by 
    208   simply giving a new definition or pattern rule in the 
    209   {{{Makefile}}}.  {{{make}}} 
    210   simply takes the last definition as the definitive one. 
    211  
    212   Instead of ''replacing'' boilerplate 
    213   definitions, it is also quite common to 
    214   ''augment'' them. For example, a 
    215   {{{Makefile}}} might say: 
    216  
    217   {{{ 
     201   [[br]] 
     202   {{{boilerplate.mk}}} needs to be 
     203   {{{include}}}d at the ''top'' 
     204   of each {{{Makefile}}}, so that the user can 
     205   replace the boilerplate definitions or pattern rules by 
     206   simply giving a new definition or pattern rule in the 
     207   {{{Makefile}}}.  {{{make}}} 
     208   simply takes the last definition as the definitive one. 
     209   [[br]][[br]] 
     210   Instead of ''replacing'' boilerplate 
     211   definitions, it is also quite common to 
     212   ''augment'' them. For example, a 
     213   {{{Makefile}}} might say: 
     214   {{{ 
    218215SRC_HC_OPTS += -O 
    219216}}} 
    220  
    221   thereby adding "{{{-O}}}" to 
    222   the end of 
    223   {{{SRC_HC_OPTS}}}. 
     217   thereby adding "{{{-O}}}" to 
     218   the end of 
     219   {{{SRC_HC_OPTS}}}. 
    224220 
    225221 * {{{target.mk}}} contains