sbsv2/raptor/util/tmkdir/makepath.mk
changeset 625 a1925fb7753a
equal deleted inserted replaced
624:f70b728ea30c 625:a1925fb7753a
       
     1 #
       
     2 # Copyright (c) 2010 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 "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 
       
    18 # Macros for creating Standard targets
       
    19 
       
    20 ifeq ($(_METAFLM_MK_),)
       
    21 _METAFLM_MK_:=1
       
    22 
       
    23 ## path creation #########################
       
    24 # Make the destination directory if neccessary.  For some
       
    25 # make engines we must do this outside the rule or they
       
    26 # get confused by the apparent way in which different rules
       
    27 # can create a particular directory and they infer some kind
       
    28 # of dependency.
       
    29 
       
    30 # Makepath. Copyright (C) 2008 Symbian Software Ltd.
       
    31 # buffering with repeat prevention, makes directories after every 30 calls. Any more might overload 
       
    32 # the createprocess limit on arguments.
       
    33 #
       
    34 # makepathLIST is initialised in globals.mk
       
    35 define makepath_single
       
    36 $(if $(findstring $1,$(makepathLIST)),,$(eval makepathLIST:=$(makepathLIST) $1))
       
    37 $(if $(subst 90,,$(words $(makepathLIST))),,$(shell $(GNUMKDIR) -p $(makepathLIST))$(eval makepathLIST:=))
       
    38 endef
       
    39 
       
    40 # The following turns out to be extremely slow - something to do with using eval 
       
    41 # or to do with creating huge numbers of TARGET_ variables? BTW, this is an attempt
       
    42 # to not make things that we have already made.
       
    43 # define makepath
       
    44 # $(info makepath_start)$(foreach DIR,$1,$(if $(TARGET_$(1)),,$(call makepath_single,$(DIR))$(eval TARGET_$(1):=1)))$(info makepath_end)
       
    45 # endef
       
    46 
       
    47 # In general, makepath creates directories during FLM evaluation.
       
    48 # However, if the WHAT target is being processed then it should do nothing.
       
    49 define makepath
       
    50 $(strip $(foreach DIR,$(sort $1),$(call makepath_single,$(DIR))))
       
    51 endef
       
    52 
       
    53 
       
    54 define makepathfor
       
    55 $(call makepath,$(dir $1))
       
    56 endef
       
    57 
       
    58 # Make any remaining paths in the path buffer
       
    59 define makepathfinalise
       
    60 $(strip $(if $(makepathLIST),$(shell $(GNUMKDIR) $(makepathLIST))$(eval makepathLIST:=),))
       
    61 endef
       
    62 
       
    63 ## END TEST BATCH FILES MACRO