michael@0: # -*- makefile -*- michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ##################################################################################### michael@0: # Dependency build overhead: michael@0: # o always create/update/hard link targets boomkarks.json & searchplugins michael@0: # o latest symlink will be correct for the current locale / local build. michael@0: # o logic is essentially FORCE for language packs w/o all the build overhead michael@0: # o phase 2: replace hard links with a user function able to derive path michael@0: # based on current locale. michael@0: ##################################################################################### michael@0: michael@0: include $(topsrcdir)/config/config.mk michael@0: michael@0: USE_AUTOTARGETS_MK=1 michael@0: include $(topsrcdir)/config/makefiles/makeutils.mk michael@0: michael@0: # Separate items of contention michael@0: tgt-gendir = .deps/generated_$(AB_CD) michael@0: michael@0: GENERATED_DIRS += .deps michael@0: michael@0: ifdef LOCALE_MERGEDIR michael@0: vpath book%.inc $(LOCALE_MERGEDIR)/mobile/profile michael@0: endif michael@0: vpath book%.inc $(LOCALE_SRCDIR)/profile michael@0: ifdef LOCALE_MERGEDIR michael@0: vpath book%.inc @srcdir@/en-US/profile michael@0: endif michael@0: michael@0: $(call errorIfEmpty,MOZ_BRANDING_DIRECTORY) michael@0: SUBMAKEFILES += \ michael@0: $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \ michael@0: $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/Makefile \ michael@0: $(NULL) michael@0: michael@0: DEFINES += \ michael@0: -DAB_CD=$(AB_CD) \ michael@0: $(NULL) michael@0: michael@0: michael@0: ########################################################################### michael@0: # Default target, preserve existing functionality for: michael@0: # gmake -C $obj/mobile/locales michael@0: ########################################################################### michael@0: search-jar-default: search-jar michael@0: michael@0: michael@0: ########################################################################### michael@0: bookmarks = bookmarks.json michael@0: bookmarks-ts = $(tgt-gendir)/$(bookmarks) michael@0: src-bookmarks = $(srcdir)/generic/profile/$(bookmarks).in michael@0: michael@0: GARBAGE += $(bookmarks) $(bookmarks-ts) michael@0: # --------------------------------------------------------------------------- michael@0: # Note: Always symlink bookmarks.json to pickup the current build for a michael@0: # locale. Phase 2 edits should remove the common/symlink file and michael@0: # provide a user function able to derive the path. michael@0: ########################################################################### michael@0: michael@0: ## Searchlist plugin config michael@0: plugin-file-array = \ michael@0: $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \ michael@0: $(srcdir)/en-US/searchplugins/list.txt \ michael@0: $(NULL) michael@0: michael@0: ########################################################################### michael@0: plugin_file = $(firstword $(plugin-file-array)) michael@0: plugin-file-ts = $(tgt-gendir)/$(subst $(topsrcdir)/,$(NULL),$(plugin_file)).ts michael@0: michael@0: GARBAGE += $(plugin-file-ts) michael@0: # --------------------------------------------------------------------------- michael@0: # plugin-file-ts track searchlist file used ($path/list.txt) michael@0: # and time when the file was last modified. michael@0: ########################################################################### michael@0: plugin-file-ts-preqs = \ michael@0: $(call mkdir_deps,$(dir $(plugin-file-ts))) \ michael@0: $(plugin_file) \ michael@0: $(NULL) michael@0: michael@0: ########################################################################### michael@0: # Detect locale changes. Force stale deps when searchlist file michael@0: # or content has changed. michael@0: $(plugin-file-ts): $(plugin-file-ts-preqs) michael@0: @touch $@ michael@0: michael@0: michael@0: ########################################################################### michael@0: search-jar-common = tmp-search.jar.mn michael@0: search-jar = $(tgt-gendir)/$(search-jar-common) michael@0: search-jar-ts = $(search-jar).ts michael@0: michael@0: GARBAGE += $(search-jar) $(search-jar-ts) $(search-jar-common) michael@0: # --------------------------------------------------------------------------- michael@0: # search-jar contains a list of providers for the search plugin michael@0: ########################################################################### michael@0: SEARCH_PLUGINS = $(shell cat $(plugin_file)) michael@0: $(call errorIfEmpty,SEARCH_PLUGINS) michael@0: michael@0: search-jar-preqs = \ michael@0: $(plugin-file-ts) \ michael@0: $(if $(IS_LANGUAGE_REPACK),FORCE) \ michael@0: $(NULL) michael@0: michael@0: .PHONY: search-jar michael@0: search-jar: $(search-jar) michael@0: $(search-jar): $(search-jar-preqs) michael@0: @echo '\nGenerating: search-jar' michael@0: printf '$(AB_CD).jar:' > $@ michael@0: ln -fn $@ . michael@0: printf '$(foreach plugin,$(SEARCH_PLUGINS),$(subst __PLUGIN_SUBST__,$(plugin), \n locale/$(AB_CD)/browser/searchplugins/__PLUGIN_SUBST__.xml (__PLUGIN_SUBST__.xml)))' >> $@ michael@0: @echo >> $@ michael@0: michael@0: ################### michael@0: search-dir-deps = \ michael@0: $(plugin-file) \ michael@0: $(dir-chrome) \ michael@0: $(NULL) michael@0: michael@0: search-preqs =\ michael@0: $(call mkdir_deps,$(dir $(search-jar-ts))) \ michael@0: $(call mkdir_deps,$(FINAL_TARGET)/chrome) \ michael@0: $(search-jar) \ michael@0: $(search-dir-deps) \ michael@0: $(if $(IS_LANGUAGE_REPACK),FORCE) \ michael@0: $(GLOBAL_DEPS) \ michael@0: $(NULL) michael@0: michael@0: .PHONY: searchplugins michael@0: searchplugins: $(search-preqs) michael@0: $(call py_action,jar_maker,\ michael@0: $(QUIET) -j $(FINAL_TARGET)/chrome \ michael@0: -s $(topsrcdir)/$(relativesrcdir)/en-US/searchplugins \ michael@0: -s $(LOCALE_SRCDIR)/searchplugins \ michael@0: $(MAKE_JARS_FLAGS) $(search-jar)) michael@0: $(TOUCH) $@ michael@0: michael@0: include $(topsrcdir)/config/rules.mk michael@0: michael@0: michael@0: ############# michael@0: libs-preqs =\ michael@0: $(call mkdir-deps,$(DIST)/install) \ michael@0: $(NULL) michael@0: michael@0: libs-%: $(libs-preqs) michael@0: $(display-deps) michael@0: @$(MAKE) -C $(DEPTH)/toolkit/locales libs-$* michael@0: @$(MAKE) -C $(DEPTH)/intl/locales AB_CD=$* XPI_NAME=locale-$* michael@0: @$(MAKE) -B $(bookmarks) AB_CD=$* michael@0: @$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$* michael@0: @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref michael@0: @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* michael@0: michael@0: # Tailored target to just add the chrome processing for multi-locale builds michael@0: chrome-%: michael@0: $(display-deps) michael@0: @$(MAKE) -B $(bookmarks) AB_CD=$* michael@0: @$(MAKE) -B searchplugins AB_CD=$* michael@0: @$(MAKE) chrome AB_CD=$* michael@0: @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales chrome AB_CD=$* michael@0: michael@0: NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD)) michael@0: michael@0: michael@0: # emulate vpath to gather deps with a path michael@0: has-mergedir = $(if $(strip $(LOCALE_MERGEDIR)),1) michael@0: bookmarks-inc-array = \ michael@0: $(wildcard \ michael@0: $(if $(has_mergedir),$(LOCALE_MERGEDIR)/mobile/profile/bookmarks.inc) \ michael@0: $(LOCALE_SRCDIR)/profile/bookmarks.inc \ michael@0: $(if $(has-mergedir),$(srcdir)/en-US/profile/bookmarks.inc) \ michael@0: ) michael@0: bookmarks-inc = $(firstword $(bookmarks-inc-array)) michael@0: michael@0: bookmarks-preqs = \ michael@0: $(bookmarks-inc) \ michael@0: $(src-bookmarks) \ michael@0: generic/profile/$(bookmarks).in \ michael@0: $(if $(IS_LANGUAGE_REPACK),FORCE) \ michael@0: $(GLOBAL_DEPS) \ michael@0: $(NULL) michael@0: michael@0: $(bookmarks-ts): $(bookmarks-preqs) michael@0: $(display_deps) michael@0: $(call py_action,preprocessor, \ michael@0: -I $< \ michael@0: -DAB_CD=$(NO_JA_JP_MAC_AB_CD) \ michael@0: $(src-bookmarks) \ michael@0: -o $@) michael@0: michael@0: .PHONY: bookmarks $(bookmarks) michael@0: bookmarks: $(bookmarks) michael@0: $(bookmarks): $(bookmarks-ts) michael@0: @echo '\nGenerating: $@' michael@0: ln -fn $< . michael@0: michael@0: michael@0: export:: searchplugins bookmarks