3
|
1 |
# Copyright (c) 2007-2009 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 |
|
|
19 |
## Parameters that are expected:
|
|
20 |
# BMCONV
|
|
21 |
# EPOCROOT
|
|
22 |
# HEADER
|
|
23 |
# OUTPUTPATH
|
|
24 |
# SOURCE
|
|
25 |
# BMTARGET
|
|
26 |
# TARGETPATH
|
|
27 |
# BINCOPYDIRS
|
|
28 |
|
|
29 |
ifneq ($(TARGETPATH),)
|
|
30 |
DATAPATH:=$(subst //,/,$(EPOCROOT)/epoc32/data/z/$(TARGETPATH))
|
|
31 |
else
|
|
32 |
DATAPATH:=$(subst //,/,$(EPOCROOT)/epoc32/data)
|
|
33 |
endif
|
|
34 |
CREATABLEPATHS:=$(DATAPATH) $(OUTPUTPATH)
|
|
35 |
|
|
36 |
BITMAPFILE:=$(subst //,/,$(DATAPATH)/$(BMTARGET))
|
|
37 |
|
|
38 |
# additional binary resource copies performed based on BINCOPYDIRS
|
|
39 |
MBMCOPYDIRS:=
|
|
40 |
MBMCOPYFILES:=
|
|
41 |
ifneq ($(BINCOPYDIRS),)
|
|
42 |
MBMCOPYDIRS:=$(subst //,/,$(patsubst %,%/$(if $(TARGETPATH),/z/$(TARGETPATH),),$(BINCOPYDIRS)))
|
|
43 |
CREATABLEPATHS:=$(CREATABLEPATHS) $(MBMCOPYDIRS)
|
|
44 |
MBMCOPYFILES:=$(subst //,/,$(patsubst %, %/$(notdir $(BITMAPFILE)),$(MBMCOPYDIRS)))
|
|
45 |
endif
|
|
46 |
|
|
47 |
|
|
48 |
ifneq ($(HEADER),)
|
|
49 |
BITMAPHEADER:=$(subst //,/,$(EPOCROOT)/epoc32/include/$(basename $(BMTARGET)).mbg)
|
|
50 |
else
|
|
51 |
BITMAPHEADER:=
|
|
52 |
endif
|
|
53 |
|
|
54 |
|
|
55 |
# SOURCE is something like "DEPTH=2 FILE=/var/local/fred.bmp"
|
|
56 |
# Extract the file parts for the dependencies.
|
|
57 |
# Generate -2/var/local/fred.bmp for the command-line argument.
|
|
58 |
SOURCEDEPS:=$(subst //,/,$(subst FILE=,,$(filter FILE=%,$(SOURCE))))
|
|
59 |
SOURCEARGS:=$(subst //,/,$(subst DEPTH=,-,$(subst $(CHAR_SPACE)FILE=,,$(SOURCE))))
|
|
60 |
|
|
61 |
BMCONVCMDFILE:=$(OUTPUTPATH)/$(BMTARGET)_bmconvcommands
|
|
62 |
RELEASEABLES:=$(BITMAPHEADER) $(BITMAPFILE)
|
5
|
63 |
CLEANTARGETS:=$(BMCONVCMDFILE)
|
3
|
64 |
|
|
65 |
# The groupbmpin10 macro allows us to construct a command file, 10
|
|
66 |
# bitmap objects at a time to avoid limits on argument lengths and
|
|
67 |
# sizes on Windows.
|
|
68 |
define groupbmpin10
|
|
69 |
$(if $1,$(shell echo -e $(foreach L,$(wordlist 1,10,$1),"$(L)\\n") >>$(BMCONVCMDFILE)),)
|
|
70 |
$(if $1,$(call groupbmpin10,$(wordlist 11,$(words $1),$1)))
|
|
71 |
endef
|
|
72 |
|
|
73 |
GUARD:=$(call sanitise,TARGET_$(BITMAPFILE))
|
|
74 |
define generatebitmap
|
|
75 |
$(GUARD):=1
|
|
76 |
|
|
77 |
BITMAP:: $(RELEASEABLES)
|
|
78 |
|
|
79 |
ifneq ($(BITMAPHEADER),)
|
|
80 |
$(BITMAPHEADER): $(BITMAPFILE)
|
|
81 |
endif
|
|
82 |
|
|
83 |
# Create commandfile during parse so that the log is not littered with
|
|
84 |
# these commands in parallel builds.
|
|
85 |
$(info <bmconvcmdfile>)
|
|
86 |
$(info $(BMCONVCMDFILE))
|
|
87 |
$(shell $(GNUMKDIR) -p "$(dir $(BMCONVCMDFILE))")
|
|
88 |
$(if $(BITMAPHEADER),$(shell echo -e "-h$(BITMAPHEADER)\n$(BITMAPFILE)" >$(BMCONVCMDFILE)),$(shell echo "$(BITMAPFILE)" >$(BMCONVCMDFILE)) )
|
|
89 |
$(call groupbmpin10, $(SOURCEARGS))
|
|
90 |
$(info </bmconvcmdfile>)
|
|
91 |
|
|
92 |
$(BITMAPFILE): $(SOURCEDEPS) $(BMCONV)
|
|
93 |
$(call startrule,bitmapcompile,FORCESUCCESS) \
|
|
94 |
$(BMCONV) $(BMCONVCMDFILE) \
|
|
95 |
$(call endrule,bitmapcompile)
|
|
96 |
|
|
97 |
endef
|
|
98 |
|
|
99 |
|
|
100 |
# Some builds require further copies of the generated mbm binaries
|
|
101 |
define copybitmap
|
|
102 |
|
|
103 |
BITMAP:: $(MBMCOPYFILES)
|
|
104 |
|
|
105 |
$(MBMCOPYFILES): $(BITMAPFILE)
|
|
106 |
$(call startrule,bitmapcopy,FORCESUCCESS) \
|
|
107 |
$(GNUCP) $$< $$@ \
|
|
108 |
$(call endrule,bitmapcopy)
|
|
109 |
|
|
110 |
endef
|
|
111 |
|
|
112 |
|
|
113 |
ifeq ($($(GUARD)),)
|
|
114 |
$(eval $(call generatebitmap))
|
|
115 |
endif
|
|
116 |
|
|
117 |
ifneq ($(MBMCOPYFILES),)
|
|
118 |
$(eval $(call copybitmap))
|
|
119 |
endif
|
|
120 |
|
|
121 |
################################### localisation #########################################
|
|
122 |
## copy .bmp files to localisation
|
|
123 |
|
|
124 |
# $(BMPFILES) is a list of bmp files in src
|
|
125 |
BMPFILES:=$(subst FILE=,,$(filter FILE=%,$(SOURCE)))
|
|
126 |
BMBASENAME:=$(call lowercase,$(basename $(BMTARGET)))
|
|
127 |
BMPCOPYFILES:=
|
|
128 |
BMPCOPYDIR:=$(EPOCROOT)/epoc32/localisation/$(BMBASENAME)/mbm
|
|
129 |
$(call makepath,$(BMPCOPYDIR))
|
|
130 |
|
|
131 |
define copyBMP
|
|
132 |
# $(1) is the source .bmp file
|
|
133 |
# $(2) is the (lower cased) copy in localisation
|
|
134 |
|
|
135 |
ifneq ($(BINCOPYDIRS),)
|
|
136 |
BITMAP:: $(2)
|
|
137 |
|
|
138 |
$(2): $(1)
|
|
139 |
$(call startrule,bmpfilecopy,FORCESUCCESS) \
|
|
140 |
$(GNUCP) $(1) $(2) && $(GNUCHMOD) +rw $(2) \
|
|
141 |
$(call endrule,bmpfilecopy)
|
5
|
142 |
|
3
|
143 |
endif
|
|
144 |
|
|
145 |
BMPCOPYFILES:=$$(BMPCOPYFILES) $(2)
|
|
146 |
endef
|
|
147 |
|
|
148 |
$(foreach BMP,$(BMPFILES),$(eval $(call copyBMP,$(BMP),$(BMPCOPYDIR)/$(call lowercase,$(notdir $(BMP))))))
|
|
149 |
|
|
150 |
## create and edit info files for bitmap files in localisation/group
|
|
151 |
INFOFILE:=$(EPOCROOT)/epoc32/localisation/group/$(BMBASENAME).info
|
|
152 |
DEPTH:=$(subst DEPTH=,,$(filter DEPTH=%,$(SOURCE)))
|
|
153 |
BMP:=$(notdir $(BMPFILES))
|
|
154 |
DEPTHBMP:=$(subst _,\,$(join $(patsubst %,/%,$(DEPTH)),$(patsubst %,_%,$(BMP))))
|
|
155 |
|
|
156 |
define bmpInfo
|
|
157 |
|
|
158 |
BITMAP::$(INFOFILE)
|
|
159 |
|
|
160 |
$(INFOFILE)::
|
|
161 |
@if [ ! -d $(EPOCROOT)/epoc32/localisation/group ]; then $(GNUMKDIR) -p $(EPOCROOT)/epoc32/localisation/group; fi
|
|
162 |
@if [ ! -f $$@ ]; then echo "DATADIR: /$(BMBASENAME)" > $$@ ; fi
|
|
163 |
@echo -e "\n/z$(TARGETPATH)/$(BMTARGET) : $(DEPTHBMP)" >> $$@
|
|
164 |
endef
|
|
165 |
|
|
166 |
$(eval $(call bmpInfo))
|
|
167 |
|
|
168 |
# end of localisation #########################################################
|
|
169 |
|
|
170 |
## Clean up
|
5
|
171 |
$(call raptor_clean,$(CLEANTARGETS))
|
3
|
172 |
$(call makepath,$(CREATABLEPATHS))
|
|
173 |
$(call makepathfor,$(BITMAPHEADER))
|
|
174 |
|
|
175 |
# for the abld -what target
|
|
176 |
BMPRELEASEABLES:=$(RELEASEABLES) $(MBMCOPYFILES) $(BMPCOPYFILES) $(INFOFILE)
|
5
|
177 |
$(call raptor_release,$(BMPRELEASEABLES),BITMAP)
|
3
|
178 |
|