makepath.mk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. # Macros for creating Standard targets
  17. ifeq ($(_METAFLM_MK_),)
  18. _METAFLM_MK_:=1
  19. ## path creation #########################
  20. # Make the destination directory if neccessary. For some
  21. # make engines we must do this outside the rule or they
  22. # get confused by the apparent way in which different rules
  23. # can create a particular directory and they infer some kind
  24. # of dependency.
  25. # Makepath. Copyright (C) 2008 Symbian Software Ltd.
  26. # buffering with repeat prevention, makes directories after every 30 calls. Any more might overload
  27. # the createprocess limit on arguments.
  28. #
  29. # makepathLIST is initialised in globals.mk
  30. define makepath_single
  31. $(if $(findstring $1,$(makepathLIST)),,$(eval makepathLIST:=$(makepathLIST) $1))
  32. $(if $(subst 90,,$(words $(makepathLIST))),,$(shell $(GNUMKDIR) -p $(makepathLIST))$(eval makepathLIST:=))
  33. endef
  34. # The following turns out to be extremely slow - something to do with using eval
  35. # or to do with creating huge numbers of TARGET_ variables? BTW, this is an attempt
  36. # to not make things that we have already made.
  37. # define makepath
  38. # $(info makepath_start)$(foreach DIR,$1,$(if $(TARGET_$(1)),,$(call makepath_single,$(DIR))$(eval TARGET_$(1):=1)))$(info makepath_end)
  39. # endef
  40. # In general, makepath creates directories during FLM evaluation.
  41. # However, if the WHAT target is being processed then it should do nothing.
  42. define makepath
  43. $(strip $(foreach DIR,$(sort $1),$(call makepath_single,$(DIR))))
  44. endef
  45. define makepathfor
  46. $(call makepath,$(dir $1))
  47. endef
  48. # Make any remaining paths in the path buffer
  49. define makepathfinalise
  50. $(strip $(if $(makepathLIST),$(shell $(GNUMKDIR) $(makepathLIST))$(eval makepathLIST:=),))
  51. endef
  52. ## END TEST BATCH FILES MACRO