Bug 1492664 - generate portable URLs for Android mach commands; r=nalexander
[gecko.git] / build / rebuild-backend.mk
bloba1c64c0dee78c8878c0b806713eb45cc82624946
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/.
5 BACKEND_GENERATION_SCRIPT ?= config.status
7 # A traditional rule would look like this:
8 # backend.%:
9 # @echo do stuff
11 # But with -j<n>, and multiple items in BUILD_BACKEND_FILES, the command would
12 # run multiple times in parallel.
14 # "Fortunately", make has some weird semantics for pattern rules: if there are
15 # multiple targets in a pattern rule and each of them is matched at most once,
16 # the command will only run once. So:
17 # backend%RecursiveMakeBackend backend%FasterMakeBackend:
18 # @echo do stuff
19 # backend: backend.RecursiveMakeBackend backend.FasterMakeBackend
20 # would only execute the command once.
22 # Credit where due: http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file/3077254#3077254
23 $(subst .,%,$(BUILD_BACKEND_FILES)):
24 @echo 'Build configuration changed. Regenerating backend.'
25 $(PYTHON) $(BACKEND_GENERATION_SCRIPT)
27 define build_backend_rule
28 $(1): $$(wildcard $$(shell cat $(1).in))
30 endef
31 $(foreach file,$(BUILD_BACKEND_FILES),$(eval $(call build_backend_rule,$(file))))