mobile/android/base/locales/Makefile.in
author Mike Hommey <mh+mozilla@glandium.org>
Thu, 05 Sep 2013 09:01:46 +0900
changeset 158516 45097bc3a57898f22a4f3b74f8f8cf7511f5d0a4
parent 115701 3c1d80269a137fc41bfdfd082692664f6021856d
child 159126 b1b292d8e383959cbd403a9b739f86e429ce8aab
permissions -rw-r--r--
Bug 912293 - Remove now redundant boilerplate from Makefile.in. r=gps

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

include $(topsrcdir)/config/config.mk

# special case some locale codes, he and id
# http://code.google.com/p/android/issues/detail?id=3639
AB_rCD = $(if $(filter he, $(AB_CD)),iw,$(if $(filter id, $(AB_CD)),in,$(subst -,-r,$(AB_CD))))

SYNCSTRINGSPATH = $(call core_abspath,$(call MERGE_FILE,sync_strings.dtd))
STRINGSPATH = $(call core_abspath,$(call MERGE_FILE,android_strings.dtd))
ifeq (,$(XPI_NAME))
BRANDPATH = $(call core_abspath,$(DEPTH)/dist/bin/chrome/$(AB_CD)/locale/branding/brand.dtd)
else
BRANDPATH = $(call core_abspath,$(DIST)/xpi-stage/$(XPI_NAME)/chrome/$(AB_CD)/locale/branding/brand.dtd)
endif
$(warnIfEmpty,AB_CD) # todo: $(errorIfEmpty )

DEFINES += -DAB_CD=$(AB_CD)

dir-res-values := ../res/values
strings-xml    := $(dir-res-values)/strings.xml
strings-xml-in := $(srcdir)/../strings.xml.in

GARBAGE += $(strings-xml)

libs realchrome:: $(strings-xml)

chrome-%:: AB_CD=$*
chrome-%:: 
	@$(MAKE) $(dir-res-values)-$(AB_rCD)/strings.xml AB_CD=$*

# setup the path to bookmarks.inc. copied and tweaked version of MERGE_FILE from config/config.mk
MOBILE_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/mobile/locales/en-US,$(call core_realpath,$(L10NBASEDIR))/$(AB_CD)/mobile)

ifdef LOCALE_MERGEDIR
BOOKMARKSPATH = $(firstword \
  $(wildcard $(LOCALE_MERGEDIR)/mobile/profile/bookmarks.inc ) \
  $(wildcard $(MOBILE_LOCALE_SRCDIR)/profile/bookmarks.inc ) \
  $(topsrcdir)/mobile/locales/en-US/profile/bookmarks.inc )
else
BOOKMARKSPATH = $(call core_abspath,$(MOBILE_LOCALE_SRCDIR)/profile/bookmarks.inc)
endif

# Determine the ../res/values[-*]/ path
strings-xml-bypath  = $(filter %/strings.xml,$(MAKECMDGOALS))
ifeq (,$(strip $(strings-xml-bypath)))
  strings-xml-bypath = $(strings-xml)
endif
dir-strings-xml = $(patsubst %/,%,$(dir $(strings-xml-bypath)))

strings-xml-preqs =\
  $(strings-xml-in) \
  $(BRANDPATH) \
  $(STRINGSPATH) \
  $(SYNCSTRINGSPATH) \
  $(BOOKMARKSPATH) \
  $(if $(IS_LANGUAGE_REPACK),FORCE) \
  $(NULL)

$(dir-strings-xml)/strings.xml: $(strings-xml-preqs)
	$(NSINSTALL) -D $(dir-strings-xml)
	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
      $(DEFINES) \
	  -DBRANDPATH="$(BRANDPATH)" \
	  -DSTRINGSPATH="$(STRINGSPATH)" \
	  -DSYNCSTRINGSPATH="$(SYNCSTRINGSPATH)" \
	  -DBOOKMARKSPATH="$(BOOKMARKSPATH)" \
	  -DMOZ_APP_DISPLAYNAME="@MOZ_APP_DISPLAYNAME@" \
      $< \
	  > $@