bitmap.flm 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
  2. # All rights reserved.
  3. # This component and the accompanying materials are made available
  4. # under the terms of the License "Eclipse Public License v1.0"
  5. # which accompanies this distribution, and is available
  6. # at the URL "http://www.eclipse.org/legal/epl-v10.html".
  7. #
  8. # Initial Contributors:
  9. # Nokia Corporation - initial contribution.
  10. #
  11. # Contributors:
  12. #
  13. # Description:
  14. # Header file exporting Function Like Makefile (FLM)
  15. # The file destinations relative to EPOCROOT
  16. #
  17. #
  18. ## Parameters that are expected:
  19. # BMCONV
  20. # EPOCROOT
  21. # HEADER
  22. # OUTPUTPATH
  23. # SOURCE
  24. # BMTARGET
  25. # TARGETPATH
  26. # BINCOPYDIRS
  27. ifneq ($(TARGETPATH),)
  28. DATAPATH:=$(subst //,/,$(EPOCROOT)/epoc32/data/z/$(TARGETPATH))
  29. else
  30. DATAPATH:=$(subst //,/,$(EPOCROOT)/epoc32/data)
  31. endif
  32. CREATABLEPATHS:=$(DATAPATH) $(OUTPUTPATH)
  33. BITMAPFILE:=$(subst //,/,$(DATAPATH)/$(BMTARGET))
  34. # additional binary resource copies performed based on BINCOPYDIRS
  35. MBMCOPYDIRS:=
  36. MBMCOPYFILES:=
  37. ifneq ($(BINCOPYDIRS),)
  38. MBMCOPYDIRS:=$(subst //,/,$(patsubst %,%/$(if $(TARGETPATH),/z/$(TARGETPATH),),$(BINCOPYDIRS)))
  39. CREATABLEPATHS:=$(CREATABLEPATHS) $(MBMCOPYDIRS)
  40. MBMCOPYFILES:=$(subst //,/,$(patsubst %, %/$(notdir $(BITMAPFILE)),$(MBMCOPYDIRS)))
  41. endif
  42. ifneq ($(HEADER),)
  43. BITMAPHEADER:=$(subst //,/,$(EPOCROOT)/epoc32/include/$(basename $(BMTARGET)).mbg)
  44. else
  45. BITMAPHEADER:=
  46. endif
  47. # SOURCE is something like "DEPTH=2 FILE=/var/local/fred.bmp"
  48. # Extract the file parts for the dependencies.
  49. # Generate -2/var/local/fred.bmp for the command-line argument.
  50. SOURCEDEPS:=$(subst //,/,$(subst FILE=,,$(filter FILE=%,$(SOURCE))))
  51. SOURCEARGS:=$(subst //,/,$(subst DEPTH=,-,$(subst $(CHAR_SPACE)FILE=,,$(SOURCE))))
  52. BMCONVCMDFILE:=$(OUTPUTPATH)/$(BMTARGET)_bmconvcommands
  53. RELEASEABLES:=$(BITMAPHEADER) $(BITMAPFILE)
  54. CLEANTARGETS:=$(BMCONVCMDFILE)
  55. # The groupbmpin10 macro allows us to construct a command file, 10
  56. # bitmap objects at a time to avoid limits on argument lengths and
  57. # sizes on Windows.
  58. define groupbmpin10
  59. $(if $1,$(shell echo -e $(foreach L,$(wordlist 1,10,$1),"$(L)\\n") >>$(BMCONVCMDFILE)),)
  60. $(if $1,$(call groupbmpin10,$(wordlist 11,$(words $1),$1)))
  61. endef
  62. GUARD:=$(call sanitise,TARGET_$(BITMAPFILE))
  63. define generatebitmap
  64. $(GUARD):=1
  65. BITMAP:: $(RELEASEABLES)
  66. ifneq ($(BITMAPHEADER),)
  67. $(BITMAPHEADER): $(BITMAPFILE)
  68. endif
  69. # Create commandfile during parse so that the log is not littered with
  70. # these commands in parallel builds.
  71. $(info <bmconvcmdfile>)
  72. $(info $(BMCONVCMDFILE))
  73. $(shell $(GNUMKDIR) -p "$(dir $(BMCONVCMDFILE))")
  74. $(if $(BITMAPHEADER),$(shell echo -e "-h$(BITMAPHEADER)\n$(BITMAPFILE)" >$(BMCONVCMDFILE)),$(shell echo "$(BITMAPFILE)" >$(BMCONVCMDFILE)) )
  75. $(call groupbmpin10, $(SOURCEARGS))
  76. $(info </bmconvcmdfile>)
  77. $(BITMAPFILE): $(SOURCEDEPS) $(BMCONV)
  78. $(call startrule,bitmapcompile,FORCESUCCESS) \
  79. $(BMCONV) $(BMCONVCMDFILE) \
  80. $(call endrule,bitmapcompile)
  81. endef
  82. # Some builds require further copies of the generated mbm binaries
  83. define copybitmap
  84. BITMAP:: $(MBMCOPYFILES)
  85. $(MBMCOPYFILES): $(BITMAPFILE)
  86. $(call startrule,bitmapcopy,FORCESUCCESS) \
  87. $(GNUCP) $$< $$@ \
  88. $(call endrule,bitmapcopy)
  89. endef
  90. ifeq ($($(GUARD)),)
  91. $(eval $(call generatebitmap))
  92. endif
  93. ifneq ($(MBMCOPYFILES),)
  94. $(eval $(call copybitmap))
  95. endif
  96. ## Clean up
  97. $(call raptor_clean,$(CLEANTARGETS))
  98. $(call makepath,$(CREATABLEPATHS))
  99. $(call makepathfor,$(BITMAPHEADER))
  100. # for the abld -what target
  101. BMPRELEASEABLES:=$(RELEASEABLES) $(MBMCOPYFILES)
  102. $(call raptor_release,$(BMPRELEASEABLES),BITMAP)