srctools/cmaker/src/include_template.mk
changeset 1 be27ed110b50
child 598 0a541d1f13c3
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Symbian Foundation License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 # The file defines a include template for cmaker project makefiles.
       
    16 # Includes automatically 
       
    17 #   - config/export.mk
       
    18 #   - anysubdir/makefile
       
    19 #   - ../makefile
       
    20 # However the template is built so that it will include subdir makefiles only from current 
       
    21 # level downwards and upwards. 
       
    22 # I.e. The included childs will not inlcude its parent, which would create an infinite include loop.
       
    23 #
       
    24 
       
    25 ifeq ($(DEBUG_INCLUDES),1)
       
    26   $(warning Entering include_template.mk for $(MAKEFILE))
       
    27 endif
       
    28 
       
    29 # Each makefile is pushed to a MAKFILE_STACK so that we know in which 
       
    30 # makefile we are in. I.e. The last one is the current! 
       
    31 # The current makefile is of course popped out in the end of the makefile
       
    32 $(call push,MAKEFILE_STACK,$(MAKEFILE))
       
    33 
       
    34 # Define the childs to be included if we are at the top most makefile
       
    35 # I.e. the first makefile
       
    36 ifeq ($(call length,MAKEFILE_STACK),1)
       
    37   INCLUDE_CHILD = 1
       
    38   INCLUDE_PARENT = 0
       
    39 endif
       
    40 
       
    41 include $(wildcard $(MAKEFILEDIR)config/export.mk)
       
    42 
       
    43 # include the child configuration file 
       
    44 ifeq ($(INCLUDE_CHILD),1)
       
    45   ifeq ($(DEBUG_INCLUDES),1)
       
    46     $(warning including childs $(MAKEFILEDIR))
       
    47   endif  
       
    48   include $(wildcard $(MAKEFILEDIR)*/makefile)
       
    49 endif
       
    50 
       
    51 # Define the parents to be included if we are at the top most makefile
       
    52 # I.e. the first makefile
       
    53 ifeq ($(call length,MAKEFILE_STACK),1)
       
    54   INCLUDE_CHILD = 0
       
    55   INCLUDE_PARENT = 1
       
    56 endif
       
    57 
       
    58 # include the parent configuration file 
       
    59 ifeq ($(INCLUDE_PARENT),1)
       
    60   ifeq ($(DEBUG_INCLUDES),1)
       
    61     $(warning including parents $(MAKEFILEDIR))
       
    62   endif  
       
    63   include $(wildcard $(MAKEFILEDIR)../makefile)
       
    64 endif
       
    65 
       
    66 $(call popout,MAKEFILE_STACK)