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