michael@0: # -*- makefile -*- michael@0: # vim:set ts=8 sw=8 sts=8 noet: michael@0: # 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: # The purpose of this file is to pull in non-recursive targets when performing michael@0: # a partial tree (not top-level) build. This will allow people to continue to michael@0: # build individual directories while some of the targets may not be normally michael@0: # defined in that make file. michael@0: # michael@0: # Non-recursive targets are attached to existing make targets. The michael@0: # NONRECURSIVE_TARGETS variable lists the make targets that modified. For michael@0: # each target in this list, the NONRECURSIVE_TARGET_ variable will michael@0: # contain a list of partial variable names. We will then look in variables michael@0: # named NONRECURSIVE_TARGETS___* for information describing michael@0: # how to evaluate non-recursive make targets. michael@0: # michael@0: # Targets are defined by the following variables: michael@0: # michael@0: # FILE - The make file to evaluate. This is equivalent to michael@0: # |make -f | michael@0: # DIRECTORY - The directory whose Makefile to evaluate. This is michael@0: # equivalent to |make -C |. michael@0: # TARGETS - Targets to evaluate in that make file. michael@0: # michael@0: # Only 1 of FILE or DIRECTORY may be defined. michael@0: # michael@0: # For example: michael@0: # michael@0: # NONRECURSIVE_TARGETS = export libs michael@0: # NONRECURSIVE_TARGETS_export = headers michael@0: # NONRECURSIVE_TARGETS_export_headers_FILE = /path/to/exports.mk michael@0: # NONRECURSIVE_TARGETS_export_headers_TARGETS = $(DIST)/include/foo.h $(DIST)/include/bar.h michael@0: # NONRECURSIVE_TARGETS_libs = cppsrcs michael@0: # NONRECURSIVE_TARGETS_libs_cppsrcs_DIRECTORY = $(DEPTH)/foo michael@0: # NONRECURSIVE_TARGETS_libs_cppsrcs_TARGETS = /path/to/foo.o /path/to/bar.o michael@0: # michael@0: # Will get turned into the following: michael@0: # michael@0: # exports:: michael@0: # $(MAKE) -C $(DEPTH) -f /path/to/exports.mk $(DIST)/include/foo.h $(DIST)/include/bar.h michael@0: # michael@0: # libs:: michael@0: # $(MAKE) -C $(DEPTH)/foo /path/to/foo.o /path/to/bar.o michael@0: michael@0: ifndef INCLUDED_NONRECURSIVE_MK michael@0: michael@0: define define_nonrecursive_target michael@0: $(1):: michael@0: $$(MAKE) -C $(or $(4),$$(DEPTH)) $(addprefix -f ,$(3)) $(2) michael@0: endef michael@0: michael@0: $(foreach target,$(NONRECURSIVE_TARGETS), \ michael@0: $(foreach entry,$(NONRECURSIVE_TARGETS_$(target)), \ michael@0: $(eval $(call define_nonrecursive_target, \ michael@0: $(target), \ michael@0: $(NONRECURSIVE_TARGETS_$(target)_$(entry)_TARGETS), \ michael@0: $(NONRECURSIVE_TARGETS_$(target)_$(entry)_FILE), \ michael@0: $(NONRECURSIVE_TARGETS_$(target)_$(entry)_DIRECTORY), \ michael@0: )) \ michael@0: ) \ michael@0: ) michael@0: michael@0: INCLUDED_NONRECURSIVE_MK := 1 michael@0: endif michael@0: