1*1b191cb5SApple OSS Distributions# -*- mode: makefile;-*- 2*1b191cb5SApple OSS Distributions# 3*1b191cb5SApple OSS Distributions# Copyright (C) 1999-2016 Apple Inc. All rights reserved. 4*1b191cb5SApple OSS Distributions# 5*1b191cb5SApple OSS Distributions# MakeInc.dir contains the recursion rules for the build system. 6*1b191cb5SApple OSS Distributions# For instance, the "build_installhdrs_md" target is auto-generated 7*1b191cb5SApple OSS Distributions# such that make(1) recurses into a specified set of subdirectories 8*1b191cb5SApple OSS Distributions# (building "build_installhdrs_md" in turn at each level) before 9*1b191cb5SApple OSS Distributions# building the special "do_installhdrs_md" target at the current 10*1b191cb5SApple OSS Distributions# level. "do_installhdrs_md" is defined in MakeInc.rule. 11*1b191cb5SApple OSS Distributions# 12*1b191cb5SApple OSS Distributions 13*1b191cb5SApple OSS Distributions# $(1) is the name of the target to produce that will perform the 14*1b191cb5SApple OSS Distributions# recursive behavior via dependencies 15*1b191cb5SApple OSS Distributions# $(2) is a list of subdirectories to recurse into 16*1b191cb5SApple OSS Distributions# $(3) is the target to build with a sub-make after 17*1b191cb5SApple OSS Distributions# the subdirectories have been recursed into 18*1b191cb5SApple OSS Distributions# $(4) should be "1" if TARGET should be pinned to the per-arch 19*1b191cb5SApple OSS Distributions# build COMPONENT directory, or empty if it should recurse 20*1b191cb5SApple OSS Distributions# in lockstep with the source recursion 21*1b191cb5SApple OSS Distributionsdefine RECURSIVE_BUILD_RULES_template 22*1b191cb5SApple OSS Distributions$(1)_recurse_target_list = $$(addprefix $(1)_recurse_into_,$(2)) 23*1b191cb5SApple OSS Distributions 24*1b191cb5SApple OSS Distributions.PHONY: $$($(1)_recurse_target_list) 25*1b191cb5SApple OSS Distributions 26*1b191cb5SApple OSS Distributions$$($(1)_recurse_target_list): 27*1b191cb5SApple OSS Distributions $$(_v)$$(MKDIR) "$$(CURDIR)/$$(patsubst $(1)_recurse_into_%,%,$$@)" 28*1b191cb5SApple OSS Distributions $$(_v)$${MAKE} -C "$$(CURDIR)/$$(patsubst $(1)_recurse_into_%,%,$$@)" \ 29*1b191cb5SApple OSS Distributions -f "$$(SOURCE)$$(patsubst $(1)_recurse_into_%,%,$$@)/Makefile" \ 30*1b191cb5SApple OSS Distributions CURRENT_KERNEL_CONFIG=$${CURRENT_KERNEL_CONFIG} \ 31*1b191cb5SApple OSS Distributions CURRENT_ARCH_CONFIG=$${CURRENT_ARCH_CONFIG} \ 32*1b191cb5SApple OSS Distributions CURRENT_MACHINE_CONFIG=$${CURRENT_MACHINE_CONFIG} \ 33*1b191cb5SApple OSS Distributions CURRENT_BUILD_CONFIG=$${CURRENT_BUILD_CONFIG} \ 34*1b191cb5SApple OSS Distributions SOURCE="$$(SOURCE)$$(patsubst $(1)_recurse_into_%,%,$$@)/" \ 35*1b191cb5SApple OSS Distributions RELATIVE_SOURCE_PATH="$$(RELATIVE_SOURCE_PATH)/$$(patsubst $(1)_recurse_into_%,%,$$@)" \ 36*1b191cb5SApple OSS Distributions TARGET=$(if $(4),$${OBJPATH}/$$(COMPONENT),$$(TARGET)$$(patsubst $(1)_recurse_into_%,%,$$@)/) \ 37*1b191cb5SApple OSS Distributions OBJPATH=$${OBJPATH} \ 38*1b191cb5SApple OSS Distributions $(1); 39*1b191cb5SApple OSS Distributions 40*1b191cb5SApple OSS Distributions.PHONY: $(1) 41*1b191cb5SApple OSS Distributions 42*1b191cb5SApple OSS Distributions$(1): $$($(1)_recurse_target_list) 43*1b191cb5SApple OSS Distributions $$(_v)$${MAKE} -C "$$(CURDIR)" \ 44*1b191cb5SApple OSS Distributions -f $$(firstword $$(MAKEFILE_LIST)) \ 45*1b191cb5SApple OSS Distributions CURRENT_KERNEL_CONFIG=$${CURRENT_KERNEL_CONFIG} \ 46*1b191cb5SApple OSS Distributions CURRENT_ARCH_CONFIG=$${CURRENT_ARCH_CONFIG} \ 47*1b191cb5SApple OSS Distributions CURRENT_MACHINE_CONFIG=$${CURRENT_MACHINE_CONFIG} \ 48*1b191cb5SApple OSS Distributions CURRENT_BUILD_CONFIG=$${CURRENT_BUILD_CONFIG} \ 49*1b191cb5SApple OSS Distributions SOURCE=$$(SOURCE) \ 50*1b191cb5SApple OSS Distributions RELATIVE_SOURCE_PATH=$$(RELATIVE_SOURCE_PATH) \ 51*1b191cb5SApple OSS Distributions TARGET=$$(TARGET) \ 52*1b191cb5SApple OSS Distributions OBJPATH=$${OBJPATH} \ 53*1b191cb5SApple OSS Distributions $(3); 54*1b191cb5SApple OSS Distributionsendef 55*1b191cb5SApple OSS Distributions 56*1b191cb5SApple OSS Distributions# 57*1b191cb5SApple OSS Distributions# Setup pass for all architectures for all Configuration/Architecture options 58*1b191cb5SApple OSS Distributions# 59*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_setup,$(SETUP_SUBDIRS),do_build_setup,)) 60*1b191cb5SApple OSS Distributions 61*1b191cb5SApple OSS Distributions# 62*1b191cb5SApple OSS Distributions# Install machine independent kernel header files 63*1b191cb5SApple OSS Distributions# 64*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_installhdrs_mi,$(INSTINC_SUBDIRS),do_installhdrs_mi,)) 65*1b191cb5SApple OSS Distributions 66*1b191cb5SApple OSS Distributions# 67*1b191cb5SApple OSS Distributions# Install machine dependent kernel header files 68*1b191cb5SApple OSS Distributions# 69*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_installhdrs_md,$(INSTINC_SUBDIRS_$(CURRENT_ARCH_CONFIG)),do_installhdrs_md,)) 70*1b191cb5SApple OSS Distributions 71*1b191cb5SApple OSS Distributions# 72*1b191cb5SApple OSS Distributions# Install machine independent kernel header files 73*1b191cb5SApple OSS Distributions# 74*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_exporthdrs_mi,$(EXPINC_SUBDIRS),do_exporthdrs_mi,)) 75*1b191cb5SApple OSS Distributions 76*1b191cb5SApple OSS Distributions# 77*1b191cb5SApple OSS Distributions# Install machine dependent kernel header files 78*1b191cb5SApple OSS Distributions# 79*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_exporthdrs_md,$(EXPINC_SUBDIRS_$(CURRENT_ARCH_CONFIG)),do_exporthdrs_md,)) 80*1b191cb5SApple OSS Distributions 81*1b191cb5SApple OSS Distributions# 82*1b191cb5SApple OSS Distributions# Build all architectures for all Configuration/Architecture options 83*1b191cb5SApple OSS Distributions# 84*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_all,$(COMP_SUBDIRS) $(COMP_SUBDIRS_$(CURRENT_ARCH_CONFIG)),do_build_all,1)) 85*1b191cb5SApple OSS Distributions 86*1b191cb5SApple OSS Distributions# 87*1b191cb5SApple OSS Distributions# Post-process build results 88*1b191cb5SApple OSS Distributions# 89*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,config_all,$(CONFIG_SUBDIRS),do_config_all,1)) 90*1b191cb5SApple OSS Distributions 91*1b191cb5SApple OSS Distributions# 92*1b191cb5SApple OSS Distributions# Install for all architectures for all Configuration/Architecture options 93*1b191cb5SApple OSS Distributions# 94*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_install_primary,$(INST_SUBDIRS),do_build_install_primary,1)) 95*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,build_install_non_primary,$(INST_SUBDIRS),do_build_install_non_primary,1)) 96*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,config_install_primary,$(CONFIG_SUBDIRS),do_config_install_primary,1)) 97*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,config_install_variant,$(CONFIG_SUBDIRS),do_config_install_variant,1)) 98*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,config_install,$(CONFIG_SUBDIRS),do_config_install,1)) 99*1b191cb5SApple OSS Distributions 100*1b191cb5SApple OSS Distributions# 101*1b191cb5SApple OSS Distributions# Install machine independent text files 102*1b191cb5SApple OSS Distributions# 103*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,textfiles_install_mi,$(INSTTEXTFILES_SUBDIRS),do_textfiles_install_mi,)) 104*1b191cb5SApple OSS Distributions 105*1b191cb5SApple OSS Distributions# 106*1b191cb5SApple OSS Distributions# Install machine dependent text files 107*1b191cb5SApple OSS Distributions# 108*1b191cb5SApple OSS Distributions$(eval $(call RECURSIVE_BUILD_RULES_template,textfiles_install_md,$(INSTTEXTFILES_SUBDIRS_$(CURRENT_ARCH_CONFIG)),do_textfiles_install_md,)) 109*1b191cb5SApple OSS Distributions 110*1b191cb5SApple OSS Distributions# vim: set ft=make: 111