mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 21:55:31 +00:00
Bug 1065306 - Part 2: Extract generated_file_template. r=mshal
This was essentially mechanical: s/$/$$/; s/suggestedsites/$(1)/; move libs realchrome:: and GARBAGE rules into template. I feel like there should be a more direct form of $$($(1)), but I can't think of it.
This commit is contained in:
parent
da59c4c558
commit
78cec80ed2
@ -31,13 +31,8 @@ GARBAGE += $(strings-xml)
|
||||
dir-res-raw := ../res/raw
|
||||
suggestedsites := $(dir-res-raw)/suggestedsites.json
|
||||
|
||||
GARBAGE += \
|
||||
$(suggestedsites) \
|
||||
$(NULL)
|
||||
|
||||
libs realchrome:: \
|
||||
$(strings-xml) \
|
||||
$(suggestedsites) \
|
||||
$(NULL)
|
||||
|
||||
chrome-%:: AB_CD=$*
|
||||
@ -94,21 +89,33 @@ $(dir-strings-xml)/strings.xml: $(strings-xml-preqs)
|
||||
$< \
|
||||
-o $@)
|
||||
|
||||
suggestedsites-srcdir := $(if $(filter en-US,$(AB_CD)),,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/mobile/chrome)
|
||||
# Arg 1: Valid Make identifier, like suggestedsites.
|
||||
# Arg 2: File name, like suggestedsites.json.
|
||||
define generated_file_template
|
||||
|
||||
# Determine the ../res/raw[-*] path. This can be ../res/raw when no
|
||||
# locale is explicitly specified.
|
||||
suggestedsites-bypath = $(filter %/suggestedsites.json,$(MAKECMDGOALS))
|
||||
ifeq (,$(strip $(suggestedsites-bypath)))
|
||||
suggestedsites-bypath = $(suggestedsites)
|
||||
$(1)-bypath = $(filter %/$(2),$(MAKECMDGOALS))
|
||||
ifeq (,$$(strip $$($(1)-bypath)))
|
||||
$(1)-bypath = $($(1))
|
||||
endif
|
||||
suggestedsites-dstdir-raw = $(patsubst %/,%,$(dir $(suggestedsites-bypath)))
|
||||
$(1)-dstdir-raw = $$(patsubst %/,%,$$(dir $$($(1)-bypath)))
|
||||
|
||||
GARBAGE += $($(1))
|
||||
|
||||
libs realchrome:: $($(1))
|
||||
endef
|
||||
|
||||
# L10NBASEDIR is not defined for en-US.
|
||||
l10n-srcdir := $(if $(filter en-US,$(AB_CD)),,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/mobile/chrome)
|
||||
|
||||
$(eval $(call generated_file_template,suggestedsites,suggestedsites.json))
|
||||
|
||||
$(suggestedsites-dstdir-raw)/suggestedsites.json: FORCE
|
||||
$(call py_action,generate_suggestedsites, \
|
||||
--verbose \
|
||||
--android-package-name=$(ANDROID_PACKAGE_NAME) \
|
||||
--resources=$(srcdir)/../resources \
|
||||
$(if $(filter en-US,$(AB_CD)),,--srcdir=$(suggestedsites-srcdir)) \
|
||||
$(if $(filter en-US,$(AB_CD)),,--srcdir=$(l10n-srcdir)) \
|
||||
--srcdir=$(topsrcdir)/mobile/locales/en-US/chrome \
|
||||
$@)
|
||||
|
Loading…
Reference in New Issue
Block a user