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