|
1 # This Source Code Form is subject to the terms of the Mozilla Public |
|
2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 include $(topsrcdir)/config/config.mk |
|
6 |
|
7 # special case some locale codes, he and id |
|
8 # http://code.google.com/p/android/issues/detail?id=3639 |
|
9 AB_rCD = $(if $(filter he, $(AB_CD)),iw,$(if $(filter id, $(AB_CD)),in,$(subst -,-r,$(AB_CD)))) |
|
10 |
|
11 SYNCSTRINGSPATH = $(abspath $(call MERGE_FILE,sync_strings.dtd)) |
|
12 STRINGSPATH = $(abspath $(call MERGE_FILE,android_strings.dtd)) |
|
13 ifeq (,$(XPI_NAME)) |
|
14 BRANDPATH = $(abspath $(DEPTH)/dist/bin/chrome/$(AB_CD)/locale/branding/brand.dtd) |
|
15 else |
|
16 BRANDPATH = $(abspath $(DIST)/xpi-stage/$(XPI_NAME)/chrome/$(AB_CD)/locale/branding/brand.dtd) |
|
17 endif |
|
18 $(warnIfEmpty,AB_CD) # todo: $(errorIfEmpty ) |
|
19 |
|
20 DEFINES += -DAB_CD=$(AB_CD) |
|
21 |
|
22 dir-res-values := ../res/values |
|
23 strings-xml := $(dir-res-values)/strings.xml |
|
24 strings-xml-in := $(srcdir)/../strings.xml.in |
|
25 |
|
26 GARBAGE += $(strings-xml) |
|
27 |
|
28 libs realchrome:: $(strings-xml) |
|
29 |
|
30 chrome-%:: AB_CD=$* |
|
31 chrome-%:: |
|
32 @$(MAKE) $(dir-res-values)-$(AB_rCD)/strings.xml AB_CD=$* |
|
33 |
|
34 # setup the path to bookmarks.inc. copied and tweaked version of MERGE_FILE from config/config.mk |
|
35 MOBILE_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/mobile/locales/en-US,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/mobile) |
|
36 |
|
37 ifdef LOCALE_MERGEDIR |
|
38 BOOKMARKSPATH = $(firstword \ |
|
39 $(wildcard $(LOCALE_MERGEDIR)/mobile/profile/bookmarks.inc ) \ |
|
40 $(wildcard $(MOBILE_LOCALE_SRCDIR)/profile/bookmarks.inc ) \ |
|
41 $(topsrcdir)/mobile/locales/en-US/profile/bookmarks.inc ) |
|
42 else |
|
43 BOOKMARKSPATH = $(abspath $(MOBILE_LOCALE_SRCDIR)/profile/bookmarks.inc) |
|
44 endif |
|
45 |
|
46 # Determine the ../res/values[-*]/ path |
|
47 strings-xml-bypath = $(filter %/strings.xml,$(MAKECMDGOALS)) |
|
48 ifeq (,$(strip $(strings-xml-bypath))) |
|
49 strings-xml-bypath = $(strings-xml) |
|
50 endif |
|
51 dir-strings-xml = $(patsubst %/,%,$(dir $(strings-xml-bypath))) |
|
52 |
|
53 strings-xml-preqs =\ |
|
54 $(strings-xml-in) \ |
|
55 $(BRANDPATH) \ |
|
56 $(STRINGSPATH) \ |
|
57 $(SYNCSTRINGSPATH) \ |
|
58 $(BOOKMARKSPATH) \ |
|
59 $(if $(IS_LANGUAGE_REPACK),FORCE) \ |
|
60 $(NULL) |
|
61 |
|
62 $(if $(MOZ_ANDROID_SHARED_ACCOUNT_TYPE),,$(error Missing MOZ_ANDROID_SHARED_ACCOUNT_TYPE)) |
|
63 $(if $(MOZ_ANDROID_SHARED_FXACCOUNT_TYPE),,$(error Missing MOZ_ANDROID_SHARED_FXACCOUNT_TYPE)) |
|
64 |
|
65 $(dir-strings-xml)/strings.xml: $(strings-xml-preqs) |
|
66 $(call py_action,preprocessor, \ |
|
67 $(DEFINES) \ |
|
68 -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \ |
|
69 -DBOOKMARKSPATH='$(BOOKMARKSPATH)' \ |
|
70 -DBRANDPATH='$(BRANDPATH)' \ |
|
71 -DMOZ_ANDROID_SHARED_ACCOUNT_TYPE=$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE) \ |
|
72 -DMOZ_ANDROID_SHARED_FXACCOUNT_TYPE=$(MOZ_ANDROID_SHARED_FXACCOUNT_TYPE) \ |
|
73 -DMOZ_APP_DISPLAYNAME='@MOZ_APP_DISPLAYNAME@' \ |
|
74 -DSTRINGSPATH='$(STRINGSPATH)' \ |
|
75 -DSYNCSTRINGSPATH='$(SYNCSTRINGSPATH)' \ |
|
76 $< \ |
|
77 -o $@) |