1*fdd8201dSApple OSS Distributions# -*- mode: makefile;-*- 2*fdd8201dSApple OSS Distributions# 3*fdd8201dSApple OSS Distributions# Copyright (C) 2010-2020 Apple Inc. All rights reserved. 4*fdd8201dSApple OSS Distributions# 5*fdd8201dSApple OSS Distributions# MakeInc.top is the top-level makefile for the xnu 6*fdd8201dSApple OSS Distributions# build system. All the main XBS targets 7*fdd8201dSApple OSS Distributions# (like "installhdrs") are defined here, as 8*fdd8201dSApple OSS Distributions# well as globals that can be overridden on 9*fdd8201dSApple OSS Distributions# the command-line by the user. 10*fdd8201dSApple OSS Distributions# 11*fdd8201dSApple OSS Distributions# This makefile's main purpose is to bootstrap 12*fdd8201dSApple OSS Distributions# the user's intent ("build these 3 kernels") 13*fdd8201dSApple OSS Distributions# into 3 single-architecture builds that each 14*fdd8201dSApple OSS Distributions# invoke the recursive make build system. 15*fdd8201dSApple OSS Distributions# As such, we have no knowledge of how to build 16*fdd8201dSApple OSS Distributions# a kernel or perform actions other than 17*fdd8201dSApple OSS Distributions# invoking a sub-make with a different 18*fdd8201dSApple OSS Distributions# current directory, makefile, and target. One 19*fdd8201dSApple OSS Distributions# side effect of this is that each 20*fdd8201dSApple OSS Distributions# single-architecture build is responsible for 21*fdd8201dSApple OSS Distributions# inserting its build products into the final 22*fdd8201dSApple OSS Distributions# multi-architecture output files. To avoid 23*fdd8201dSApple OSS Distributions# races, these aggregating stages for 24*fdd8201dSApple OSS Distributions# "primary" build configs are done in serial. 25*fdd8201dSApple OSS Distributions# 26*fdd8201dSApple OSS Distributions 27*fdd8201dSApple OSS Distributionsexport MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd 28*fdd8201dSApple OSS Distributions 29*fdd8201dSApple OSS Distributionsinclude $(MakeInc_cmd) 30*fdd8201dSApple OSS Distributions 31*fdd8201dSApple OSS Distributions 32*fdd8201dSApple OSS Distributions# 33*fdd8201dSApple OSS Distributions# Architecture Configuration options 34*fdd8201dSApple OSS Distributions# 35*fdd8201dSApple OSS Distributions 36*fdd8201dSApple OSS Distributions# Default to current kernel architecture 37*fdd8201dSApple OSS Distributions 38*fdd8201dSApple OSS Distributionsifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) 39*fdd8201dSApple OSS Distributions override DEFAULT_ARCH_CONFIG := ARM 40*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),) 41*fdd8201dSApple OSS Distributions override DEFAULT_ARCH_CONFIG := X86_64 42*fdd8201dSApple OSS Distributionselse 43*fdd8201dSApple OSS Distributions override DEFAULT_ARCH_CONFIG := X86_64 44*fdd8201dSApple OSS Distributionsendif 45*fdd8201dSApple OSS Distributions 46*fdd8201dSApple OSS Distributions# Accept either explicit ARCH_CONFIGS or XBS-style RC_ARCHS 47*fdd8201dSApple OSS Distributionsifndef ARCH_CONFIGS 48*fdd8201dSApple OSS Distributionsifdef RC_ARCHS 49*fdd8201dSApple OSS DistributionsARCH_CONFIGS := $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z | $(TR) " " "\n" | sort -u | $(TR) "\n" " ") 50*fdd8201dSApple OSS Distributionselse 51*fdd8201dSApple OSS DistributionsARCH_CONFIGS := DEFAULT 52*fdd8201dSApple OSS Distributionsendif 53*fdd8201dSApple OSS Distributionsendif 54*fdd8201dSApple OSS Distributions 55*fdd8201dSApple OSS Distributions# 56*fdd8201dSApple OSS Distributions# Kernel Configuration options 57*fdd8201dSApple OSS Distributions# 58*fdd8201dSApple OSS Distributions 59*fdd8201dSApple OSS DistributionsDEFAULT_PRODUCT_CONFIGS := 60*fdd8201dSApple OSS Distributions 61*fdd8201dSApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),) 62*fdd8201dSApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEBUG 63*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),) 64*fdd8201dSApple OSS Distributionsoverride KERNEL_CONFIGS := KASAN 65*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) 66*fdd8201dSApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEVELOPMENT 67*fdd8201dSApple OSS Distributionselse ifeq ($(PLATFORM),MacOSX) 68*fdd8201dSApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEVELOPMENT 69*fdd8201dSApple OSS Distributionselse 70*fdd8201dSApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := RELEASE 71*fdd8201dSApple OSS Distributionsendif 72*fdd8201dSApple OSS Distributions 73*fdd8201dSApple OSS Distributions# If KERNEL_CONFIGS is specified it should override default 74*fdd8201dSApple OSS Distributionsifndef KERNEL_CONFIGS 75*fdd8201dSApple OSS DistributionsKERNEL_CONFIGS := DEFAULT 76*fdd8201dSApple OSS Distributionsendif 77*fdd8201dSApple OSS Distributions 78*fdd8201dSApple OSS Distributions# If PRODUCT_CONFIGS is specified it should override default 79*fdd8201dSApple OSS Distributionsifndef PRODUCT_CONFIGS 80*fdd8201dSApple OSS DistributionsPRODUCT_CONFIGS := $(DEFAULT_PRODUCT_CONFIGS) 81*fdd8201dSApple OSS Distributionsendif 82*fdd8201dSApple OSS Distributions 83*fdd8201dSApple OSS Distributions# 84*fdd8201dSApple OSS Distributions# Machine Configuration options 85*fdd8201dSApple OSS Distributions# 86*fdd8201dSApple OSS Distributions 87*fdd8201dSApple OSS Distributionsoverride DEFAULT_I386_MACHINE_CONFIG := NONE 88*fdd8201dSApple OSS Distributionsoverride DEFAULT_X86_64_MACHINE_CONFIG := NONE 89*fdd8201dSApple OSS Distributionsoverride DEFAULT_X86_64H_MACHINE_CONFIG := NONE 90*fdd8201dSApple OSS Distributions 91*fdd8201dSApple OSS Distributionsifneq ($(findstring _Sim,$(RC_ProjectName)),) 92*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM_MACHINE_CONFIG := NONE 93*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG := NONE 94*fdd8201dSApple OSS Distributionselse ifneq ($(findstring _host,$(RC_ProjectName)),) 95*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM_MACHINE_CONFIG := NONE 96*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG := NONE 97*fdd8201dSApple OSS Distributionselse 98*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM_MACHINE_CONFIG := NONE 99*fdd8201dSApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG := VMAPPLE 100*fdd8201dSApple OSS Distributionsendif 101*fdd8201dSApple OSS Distributions 102*fdd8201dSApple OSS Distributions# This is typically never specified (TARGET_CONFIGS is used) 103*fdd8201dSApple OSS Distributionsifndef MACHINE_CONFIGS 104*fdd8201dSApple OSS DistributionsMACHINE_CONFIGS := DEFAULT 105*fdd8201dSApple OSS Distributionsendif 106*fdd8201dSApple OSS Distributions 107*fdd8201dSApple OSS Distributions# 108*fdd8201dSApple OSS Distributions# Target configuration options. NOTE - target configurations will 109*fdd8201dSApple OSS Distributions# override ARCH_CONFIGS and KERNEL_CONFIGS and MACHINE_CONFIGS. 110*fdd8201dSApple OSS Distributions# 111*fdd8201dSApple OSS Distributions# Target configs come in groups of three parameters. The first is the 112*fdd8201dSApple OSS Distributions# kernel configuration, the second is the architecture configuration, 113*fdd8201dSApple OSS Distributions# and the third is the machine configuration. You may pass in as 114*fdd8201dSApple OSS Distributions# many groups of configurations as you wish. Each item passed in is 115*fdd8201dSApple OSS Distributions# seperated by whitespace. 116*fdd8201dSApple OSS Distributions# 117*fdd8201dSApple OSS Distributions# Example: 118*fdd8201dSApple OSS Distributions# TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS" 119*fdd8201dSApple OSS Distributions# Parameters may be in upper or lower case (they are converted to upper). 120*fdd8201dSApple OSS Distributions# 121*fdd8201dSApple OSS Distributions# "default" parameter is a special case. It means use the default value for 122*fdd8201dSApple OSS Distributions# that parameter. Here are the default values for each configuration: 123*fdd8201dSApple OSS Distributions# 124*fdd8201dSApple OSS Distributions# default kernel configuration = DEFAULT_KERNEL_CONFIG 125*fdd8201dSApple OSS Distributions# default architecture configuration = system architecture where you are running make. 126*fdd8201dSApple OSS Distributions 127*fdd8201dSApple OSS Distributionsifneq ($(filter $(SUPPORTED_PLATFORMS),$(PLATFORM)),) 128*fdd8201dSApple OSS Distributions 129*fdd8201dSApple OSS Distributions# Defaults for "make all_embedded" 130*fdd8201dSApple OSS Distributionsifeq ($(KERNEL_CONFIGS),DEFAULT) 131*fdd8201dSApple OSS DistributionsKERNEL_CONFIGS_EMBEDDED := RELEASE DEVELOPMENT 132*fdd8201dSApple OSS Distributionselse 133*fdd8201dSApple OSS DistributionsKERNEL_CONFIGS_EMBEDDED := $(KERNEL_CONFIGS) 134*fdd8201dSApple OSS Distributionsendif 135*fdd8201dSApple OSS Distributions 136*fdd8201dSApple OSS Distributionsifeq ($(ARCH_CONFIGS),DEFAULT) 137*fdd8201dSApple OSS DistributionsARCH_CONFIGS_EMBEDDED := ARM ARM64 138*fdd8201dSApple OSS DistributionsARCH_CONFIGS_DESKTOP := X86_64 139*fdd8201dSApple OSS Distributionselse 140*fdd8201dSApple OSS DistributionsARCH_CONFIGS_EMBEDDED := $(strip $(shell echo $(filter-out X86_64, $(ARCH_CONFIGS)) | $(TR) a-z A-Z)) 141*fdd8201dSApple OSS DistributionsARCH_CONFIGS_DESKTOP := $(strip $(shell echo $(filter X86_64, $(ARCH_CONFIGS)) | $(TR) a-z A-Z)) 142*fdd8201dSApple OSS Distributionsendif 143*fdd8201dSApple OSS Distributions 144*fdd8201dSApple OSS Distributions# Find supported products from the device map 145*fdd8201dSApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),) 146*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_ARMV7 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ 147*fdd8201dSApple OSS Distributions -query 'SELECT DISTINCT TargetType \ 148*fdd8201dSApple OSS Distributions FROM Files \ 149*fdd8201dSApple OSS Distributions INNER JOIN Manifests USING (manifestID) \ 150*fdd8201dSApple OSS Distributions INNER JOIN Targets USING (Target) \ 151*fdd8201dSApple OSS Distributions WHERE (KernelMachOArchitecture LIKE "armv7" \ 152*fdd8201dSApple OSS Distributions AND fileType in ("KernelCache", "RestoreKernelCache"))') 153*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_ARMV7S := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ 154*fdd8201dSApple OSS Distributions -query 'SELECT DISTINCT TargetType \ 155*fdd8201dSApple OSS Distributions FROM Files \ 156*fdd8201dSApple OSS Distributions INNER JOIN Manifests USING (manifestID) \ 157*fdd8201dSApple OSS Distributions INNER JOIN Targets USING (Target) \ 158*fdd8201dSApple OSS Distributions WHERE (KernelMachOArchitecture LIKE "armv7s" \ 159*fdd8201dSApple OSS Distributions AND fileType in ("KernelCache", "RestoreKernelCache"))') 160*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_ARMV7K := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ 161*fdd8201dSApple OSS Distributions -query 'SELECT DISTINCT TargetType \ 162*fdd8201dSApple OSS Distributions FROM Files \ 163*fdd8201dSApple OSS Distributions INNER JOIN Manifests USING (manifestID) \ 164*fdd8201dSApple OSS Distributions INNER JOIN Targets USING (Target) \ 165*fdd8201dSApple OSS Distributions WHERE (KernelMachOArchitecture LIKE "armv7k" \ 166*fdd8201dSApple OSS Distributions AND fileType in ("KernelCache", "RestoreKernelCache"))') 167*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_ARM := $(DEVICEMAP_PRODUCTS_ARMV7) $(DEVICEMAP_PRODUCTS_ARMV7S) $(DEVICEMAP_PRODUCTS_ARMV7K) 168*fdd8201dSApple OSS Distributions 169*fdd8201dSApple OSS Distributions 170*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_ARM64 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ 171*fdd8201dSApple OSS Distributions -query 'SELECT DISTINCT TargetType \ 172*fdd8201dSApple OSS Distributions FROM Files \ 173*fdd8201dSApple OSS Distributions INNER JOIN Manifests USING (manifestID) \ 174*fdd8201dSApple OSS Distributions INNER JOIN Targets USING (Target) \ 175*fdd8201dSApple OSS Distributions WHERE (KernelMachOArchitecture LIKE "arm64" \ 176*fdd8201dSApple OSS Distributions AND fileType in ("KernelCache", "RestoreKernelCache"))') 177*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCTS_OSX_ARM64 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ 178*fdd8201dSApple OSS Distributions -query 'SELECT DISTINCT TargetType \ 179*fdd8201dSApple OSS Distributions FROM Files \ 180*fdd8201dSApple OSS Distributions INNER JOIN Manifests USING (manifestID) \ 181*fdd8201dSApple OSS Distributions INNER JOIN Targets USING (Target) \ 182*fdd8201dSApple OSS Distributions WHERE (KernelMachOArchitecture LIKE "arm64" \ 183*fdd8201dSApple OSS Distributions AND fileType in ("KernelCache", "RestoreKernelCache") \ 184*fdd8201dSApple OSS Distributions AND SDKPlatform == "macosx")') 185*fdd8201dSApple OSS Distributions 186*fdd8201dSApple OSS Distributions 187*fdd8201dSApple OSS Distributions# Generate a list of mappings of the form "n75:arm;t8002" based on the device map 188*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCT_SOC_MAPPINGS := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -query SELECT DISTINCT TargetType, KernelMachOArchitecture, KernelPlatform FROM Targets | awk -F\| '{ if ($$2 ~ /armv[0-9][a-z]?/) { print $$1 ":arm;" $$3 } else if ($$2 ~ /arm64[a-z]?/) { print $$1 ":arm64;" $$3 ";" $$4} else { print $$1 ":" $$2 ";" $$3 ";" $$4} }' ) 189*fdd8201dSApple OSS Distributions 190*fdd8201dSApple OSS Distributions# use embedded_device_map 191*fdd8201dSApple OSS Distributionsendif 192*fdd8201dSApple OSS Distributions 193*fdd8201dSApple OSS Distributions# Map a product like "n75" to "arm;t8002" 194*fdd8201dSApple OSS Distributions# $(1) is a product name in lower case 195*fdd8201dSApple OSS Distributionsfunction_lookup_product = $(call function_substitute_word_with_replacement, \ 196*fdd8201dSApple OSS Distributions $(1), \ 197*fdd8201dSApple OSS Distributions $(DEVICEMAP_PRODUCT_SOC_MAPPINGS), \ 198*fdd8201dSApple OSS Distributions unknown_arch_for_$(1);unknown_platform_for_$(1) \ 199*fdd8201dSApple OSS Distributions ) 200*fdd8201dSApple OSS Distributions 201*fdd8201dSApple OSS Distributionsifneq ($(PLATFORM),MacOSX) 202*fdd8201dSApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),) 203*fdd8201dSApple OSS Distributions# Generate a list of mappings for products that use a different platform for their kernel configuration than their true platform 204*fdd8201dSApple OSS Distributions# of the form "n71m:arm64;s8000;s8003". The 4th element is the true SoC platform, which will get an on-disk copy, while the 205*fdd8201dSApple OSS Distributions# kernel's recursive build system will build the 3rd element as the KernelPlatform 206*fdd8201dSApple OSS DistributionsDEVICEMAP_PRODUCT_SOC_ALIASES := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -query SELECT DISTINCT TargetType, KernelMachOArchitecture, KernelPlatform, Platform FROM Targets WHERE KernelPlatform "!=" Platform | awk -F\| '{ if ($$2 ~ /armv[0-9][a-z]?/) { print $$1 ":arm;" $$3 ";" $$4} else if ($$2 ~ /arm64[a-z]?/) { print $$1 ":arm64;" $$3 ";" $$4} else { print $$1 ":" $$2 ";" $$3 ";" $$4} }' ) 207*fdd8201dSApple OSS Distributions 208*fdd8201dSApple OSS Distributionsendif 209*fdd8201dSApple OSS Distributionsendif 210*fdd8201dSApple OSS Distributions 211*fdd8201dSApple OSS Distributionsfunction_lookup_product_alias = $(call function_substitute_word_with_replacement, \ 212*fdd8201dSApple OSS Distributions $(1), \ 213*fdd8201dSApple OSS Distributions $(DEVICEMAP_PRODUCT_SOC_ALIASES), \ 214*fdd8201dSApple OSS Distributions ) 215*fdd8201dSApple OSS Distributionsendif 216*fdd8201dSApple OSS Distributions 217*fdd8201dSApple OSS Distributionsifeq ($(PLATFORM),MacOSX) 218*fdd8201dSApple OSS Distributions 219*fdd8201dSApple OSS Distributions# Defaults for "make all_desktop" 220*fdd8201dSApple OSS Distributionsifeq ($(KERNEL_CONFIGS),DEFAULT) 221*fdd8201dSApple OSS DistributionsKERNEL_CONFIGS_DESKTOP := RELEASE DEVELOPMENT 222*fdd8201dSApple OSS Distributionselse 223*fdd8201dSApple OSS DistributionsKERNEL_CONFIGS_DESKTOP := $(KERNEL_CONFIGS) 224*fdd8201dSApple OSS Distributionsendif 225*fdd8201dSApple OSS Distributions 226*fdd8201dSApple OSS Distributionsendif 227*fdd8201dSApple OSS Distributions 228*fdd8201dSApple OSS Distributionsifndef TARGET_CONFIGS 229*fdd8201dSApple OSS Distributionsifneq ($(PRODUCT_CONFIGS),) 230*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS using KERNEL_CONFIGS and PRODUCT_CONFIGS 231*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(call function_lookup_product,$(my_product_config))),$(foreach my_kernel_config,$(KERNEL_CONFIGS),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 232*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(call function_lookup_product_alias,$(my_product_config))),$(foreach my_kernel_config,$(KERNEL_CONFIGS),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 233*fdd8201dSApple OSS Distributionselse ifneq ($(filter %_release_embedded,$(MAKECMDGOALS)),) 234*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS for RELEASE kernel configs and products in the device map 235*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,RELEASE,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 236*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,RELEASE,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 237*fdd8201dSApple OSS Distributionselse ifneq ($(filter %_development_embedded,$(MAKECMDGOALS)),) 238*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS for DEVELOPMENT kernel configs and products in the device map 239*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,DEVELOPMENT,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 240*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,DEVELOPMENT,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 241*fdd8201dSApple OSS Distributionselse ifneq ($(filter %_embedded,$(MAKECMDGOALS)),) 242*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs and products in the device map 243*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 244*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 245*fdd8201dSApple OSS Distributionselse ifeq (xnu_headers_driverkit,$(RC_ProjectName)) 246*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs for B&I 247*fdd8201dSApple OSS DistributionsTARGET_CONFIGS = DEVELOPMENT arm64 DEFAULT DEVELOPMENT X86_64 DEFAULT 248*fdd8201dSApple OSS Distributionselse ifneq ($(filter %_desktop,$(MAKECMDGOALS)),) 249*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs for B&I 250*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS_DESKTOP), $(foreach my_arch_config, $(ARCH_CONFIGS_DESKTOP), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config)))) 251*fdd8201dSApple OSS DistributionsTARGET_CONFIGS += $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_OSX_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 252*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_OSX_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config)))) 253*fdd8201dSApple OSS Distributionselse 254*fdd8201dSApple OSS Distributions# generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIGS (which defaults to "DEFAULT") 255*fdd8201dSApple OSS DistributionsTARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS), $(foreach my_arch_config, $(ARCH_CONFIGS), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config)))) 256*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES := 257*fdd8201dSApple OSS Distributionsendif 258*fdd8201dSApple OSS Distributionsendif 259*fdd8201dSApple OSS Distributions 260*fdd8201dSApple OSS Distributionsifeq ($(TARGET_CONFIGS),) 261*fdd8201dSApple OSS Distributions$(error No TARGET_CONFIGS specified) 262*fdd8201dSApple OSS Distributionsendif 263*fdd8201dSApple OSS Distributions 264*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z)) 265*fdd8201dSApple OSS DistributionsTARGET_CONFIGS_ALIASES_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS_ALIASES)" | $(TR) a-z A-Z)) 266*fdd8201dSApple OSS Distributions 267*fdd8201dSApple OSS Distributions# 268*fdd8201dSApple OSS Distributions# Build Configurations 269*fdd8201dSApple OSS Distributions# 270*fdd8201dSApple OSS Distributions# TARGET_CONFIGS is unwieldy for use in Makefiles. Convert them to 271*fdd8201dSApple OSS Distributions# "build configurations" which are tuples joined by "^". For 272*fdd8201dSApple OSS Distributions# example, "RELEASE I386 DEFAULT DEVELOPMENT ARM DEFAULT" becomes 273*fdd8201dSApple OSS Distributions# "RELEASE^I386^NONE DEVELOPMENT^ARM^T8002", which can be looped 274*fdd8201dSApple OSS Distributions# over trivially. PRIMARY_BUILD_CONFIGS is the first config 275*fdd8201dSApple OSS Distributions# for each architecture, used primarily for machine-dependent recursion. 276*fdd8201dSApple OSS Distributions# VARIANT_CONFIGS contains one build configuration for each combination 277*fdd8201dSApple OSS Distributions# of kernel architecture and configuration. It is used for variant 278*fdd8201dSApple OSS Distributions# installation recursion. 279*fdd8201dSApple OSS Distributions 280*fdd8201dSApple OSS DistributionsBUILD_CONFIGS = $(call function_create_build_configs, $(TARGET_CONFIGS_UC)) 281*fdd8201dSApple OSS Distributions 282*fdd8201dSApple OSS DistributionsPRIMARY_ARCHS = $(strip $(sort $(foreach build_config, $(BUILD_CONFIGS), $(call function_extract_arch_config_from_build_config, $(build_config))))) 283*fdd8201dSApple OSS DistributionsPRIMARY_BUILD_CONFIGS = $(strip $(foreach arch, $(PRIMARY_ARCHS), $(firstword $(foreach build_config, $(BUILD_CONFIGS), $(if $(filter $(arch),$(call function_extract_arch_config_from_build_config, $(build_config))), $(build_config), ))))) 284*fdd8201dSApple OSS DistributionsNON_PRIMARY_BUILD_CONFIGS = $(strip $(filter-out $(PRIMARY_BUILD_CONFIGS), $(BUILD_CONFIGS))) 285*fdd8201dSApple OSS DistributionsFIRST_BUILD_CONFIG = $(firstword $(BUILD_CONFIGS)) 286*fdd8201dSApple OSS Distributions 287*fdd8201dSApple OSS Distributions# Build list of all kernel configurations present in all build configs. 288*fdd8201dSApple OSS DistributionsPRIMARY_KERNEL_CONFIGS = $(strip $(sort $(foreach build_config, $(BUILD_CONFIGS), $(call function_extract_kernel_config_from_build_config, $(build_config))))) 289*fdd8201dSApple OSS Distributions 290*fdd8201dSApple OSS Distributions# Pick one build configuration for each kernel configuration. 291*fdd8201dSApple OSS Distributions# This will be used to populate System.kext variants in SYMROOT / DSTROOT. 292*fdd8201dSApple OSS DistributionsVARIANT_CONFIGS = $(strip \ 293*fdd8201dSApple OSS Distributions $(foreach kernel_config, $(PRIMARY_KERNEL_CONFIGS), \ 294*fdd8201dSApple OSS Distributions $(firstword $(call function_match_build_config_for_kernel_config, $(BUILD_CONFIGS), $(kernel_config))))) 295*fdd8201dSApple OSS Distributions 296*fdd8201dSApple OSS Distributionsifneq ($(TARGET_CONFIGS_ALIASES_UC),) 297*fdd8201dSApple OSS DistributionsALIAS_CONFIGS = $(call function_create_alias_configs, $(TARGET_CONFIGS_ALIASES_UC)) 298*fdd8201dSApple OSS Distributionselse 299*fdd8201dSApple OSS DistributionsALIAS_CONFIGS = 300*fdd8201dSApple OSS Distributionsendif 301*fdd8201dSApple OSS Distributions 302*fdd8201dSApple OSS Distributions# $(warning PRIMARY_ARCHS is $(PRIMARY_ARCHS)) 303*fdd8201dSApple OSS Distributions# $(warning TARGET_CONFIGS is $(TARGET_CONFIGS)) 304*fdd8201dSApple OSS Distributions# $(warning BUILD_CONFIGS is $(BUILD_CONFIGS)) 305*fdd8201dSApple OSS Distributions# $(warning PRIMARY_BUILD_CONFIGS is $(PRIMARY_BUILD_CONFIGS)) 306*fdd8201dSApple OSS Distributions# $(warning NON_PRIMARY_BUILD_CONFIGS is $(NON_PRIMARY_BUILD_CONFIGS)) 307*fdd8201dSApple OSS Distributions# $(warning TARGET_CONFIGS_ALIASES is $(TARGET_CONFIGS_ALIASES)) 308*fdd8201dSApple OSS Distributions# $(warning ALIAS_CONFIGS is $(ALIAS_CONFIGS)) 309*fdd8201dSApple OSS Distributions# $(warning PRIMARY_KERNEL_CONFIGS is $(PRIMARY_KERNEL_CONFIGS)) 310*fdd8201dSApple OSS Distributions# $(warning VARIANT_CONFIGS is $(VARIANT_CONFIGS)) 311*fdd8201dSApple OSS Distributions 312*fdd8201dSApple OSS DistributionsMEMORY_SIZE := $(shell /usr/sbin/sysctl -n hw.memsize) 313*fdd8201dSApple OSS Distributions 314*fdd8201dSApple OSS Distributions# Assume LTO scaling by default, unless it is being explicitly passed on the command-line 315*fdd8201dSApple OSS DistributionsLARGE_BUILD_FOOTPRINT := $(if $(BUILD_LTO),$(BUILD_LTO),1) 316*fdd8201dSApple OSS Distributions 317*fdd8201dSApple OSS Distributionsifeq ($(LARGE_BUILD_FOOTPRINT),1) 318*fdd8201dSApple OSS DistributionsRAM_PER_KERNEL_BUILD := 4294967296 319*fdd8201dSApple OSS Distributionselse 320*fdd8201dSApple OSS DistributionsRAM_PER_KERNEL_BUILD := 268435456 321*fdd8201dSApple OSS Distributionsendif 322*fdd8201dSApple OSS Distributions 323*fdd8201dSApple OSS DistributionsKERNEL_BUILDS_IN_PARALLEL := $(shell if [ $(MEMORY_SIZE) -le $$((1 * $(RAM_PER_KERNEL_BUILD))) ]; then echo 1; elif [ $(MEMORY_SIZE) -gt $$(($(SYSCTL_HW_PHYSICALCPU) * $(RAM_PER_KERNEL_BUILD))) ]; then echo $(SYSCTL_HW_PHYSICALCPU); else expr $(MEMORY_SIZE) / $(RAM_PER_KERNEL_BUILD); fi ) 324*fdd8201dSApple OSS Distributions# $(warning Building $(KERNEL_BUILDS_IN_PARALLEL) kernels in parallel) 325*fdd8201dSApple OSS Distributions 326*fdd8201dSApple OSS Distributions# 327*fdd8201dSApple OSS Distributions# TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template 328*fdd8201dSApple OSS Distributions# 329*fdd8201dSApple OSS Distributions# $(1) is the name of the makefile target to invoke for the each build config 330*fdd8201dSApple OSS Distributions# after setting up the parallel hierarchy in the TARGET directory 331*fdd8201dSApple OSS Distributions# $(2) is an optional suffix on the TARGET directory, which might even be 332*fdd8201dSApple OSS Distributions# "/.." 333*fdd8201dSApple OSS Distributions# $(3) are any dependencies for the bootstrap target 334*fdd8201dSApple OSS Distributions# $(4) are any dependencies that are expanded per-build config to another bootstrap target 335*fdd8201dSApple OSS Distributions# $(5) is how many build configurations to build in parallel 336*fdd8201dSApple OSS Distributions# $(6) is which build configs to build in parallel 337*fdd8201dSApple OSS Distributions# 338*fdd8201dSApple OSS Distributions# Since building many configurations in parallel may overwhelm the system, 339*fdd8201dSApple OSS Distributions# we try to throttle behavior into more managable S "stripes" of N/S 340*fdd8201dSApple OSS Distributions# configurations by generating sequential dependencies between configs 341*fdd8201dSApple OSS Distributions# in each stripe. That ensures that only S kernel builds are occurring 342*fdd8201dSApple OSS Distributions# at once at any point in time 343*fdd8201dSApple OSS Distributions 344*fdd8201dSApple OSS Distributionsdefine TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template 345*fdd8201dSApple OSS Distributions 346*fdd8201dSApple OSS Distributions# Create a list of synthesized targets for each build config 347*fdd8201dSApple OSS Distributions$(1)_bootstrap_target_list = $$(addprefix $(1)_bootstrap_,$(6)) 348*fdd8201dSApple OSS Distributions 349*fdd8201dSApple OSS Distributions.PHONY: $$($(1)_bootstrap_target_list) 350*fdd8201dSApple OSS Distributions 351*fdd8201dSApple OSS Distributions$(1)_generated_stripe_dependencies = $$(call _function_generate_stripe_groupings,$(1),$(5),$(call reverse,$(6))) 352*fdd8201dSApple OSS Distributionsifeq ($$(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 353*fdd8201dSApple OSS Distributions$$(warning Generate makefile fragment: $$($(1)_generated_stripe_dependencies)) 354*fdd8201dSApple OSS Distributionsendif 355*fdd8201dSApple OSS Distributions$$(eval $$($(1)_generated_stripe_dependencies)) 356*fdd8201dSApple OSS Distributions 357*fdd8201dSApple OSS Distributions$$($(1)_bootstrap_target_list): $(1)_bootstrap_% : $(1)_stripe_dep_for_% $$(addsuffix _bootstrap_%,$(4)) $(3) 358*fdd8201dSApple OSS Distributions $$(_v)$$(MKDIR) $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2) 359*fdd8201dSApple OSS Distributions $$(_v)$${MAKE} \ 360*fdd8201dSApple OSS Distributions -C $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2) \ 361*fdd8201dSApple OSS Distributions -f $${SRCROOT}/Makefile \ 362*fdd8201dSApple OSS Distributions CURRENT_KERNEL_CONFIG=$$(call function_extract_kernel_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \ 363*fdd8201dSApple OSS Distributions CURRENT_ARCH_CONFIG=$$(call function_extract_arch_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \ 364*fdd8201dSApple OSS Distributions CURRENT_MACHINE_CONFIG=$$(call function_extract_machine_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \ 365*fdd8201dSApple OSS Distributions CURRENT_BUILD_CONFIG=$$(patsubst $(1)_bootstrap_%,%,$$@) \ 366*fdd8201dSApple OSS Distributions PRIMARY_BUILD_CONFIGS="$(PRIMARY_BUILD_CONFIGS)" BUILD_CONFIGS="$(BUILD_CONFIGS)" \ 367*fdd8201dSApple OSS Distributions SOURCE=$${SRCROOT}/ \ 368*fdd8201dSApple OSS Distributions RELATIVE_SOURCE_PATH=. \ 369*fdd8201dSApple OSS Distributions TARGET=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)/ \ 370*fdd8201dSApple OSS Distributions OBJPATH=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@)) \ 371*fdd8201dSApple OSS Distributions $(1) 372*fdd8201dSApple OSS Distributions 373*fdd8201dSApple OSS Distributions.PHONY: $(1)_bootstrap 374*fdd8201dSApple OSS Distributions 375*fdd8201dSApple OSS Distributions$(1)_bootstrap: $$($(1)_bootstrap_target_list) 376*fdd8201dSApple OSS Distributionsendef 377*fdd8201dSApple OSS Distributions 378*fdd8201dSApple OSS Distributions# 379*fdd8201dSApple OSS Distributions# TOP_LEVEL_STRIPE_DEPENDENCY_template 380*fdd8201dSApple OSS Distributions# 381*fdd8201dSApple OSS Distributions# $(1) is the Makefile target we are building for 382*fdd8201dSApple OSS Distributions# $(2) is the build config that must build first 383*fdd8201dSApple OSS Distributions# $(3) is the build config that must build after $(2) 384*fdd8201dSApple OSS Distributions 385*fdd8201dSApple OSS Distributionsdefine TOP_LEVEL_STRIPE_DEPENDENCY_template 386*fdd8201dSApple OSS Distributions 387*fdd8201dSApple OSS Distributions.PHONY: $(1)_stripe_dep_for_$(3) 388*fdd8201dSApple OSS Distributions 389*fdd8201dSApple OSS Distributions $(1)_stripe_dep_for_$(3): $(if $(2),$(1)_bootstrap_$(2)) 390*fdd8201dSApple OSS Distributions 391*fdd8201dSApple OSS Distributionsendef 392*fdd8201dSApple OSS Distributions 393*fdd8201dSApple OSS Distributions# $(1) is the Makefile target we are building for 394*fdd8201dSApple OSS Distributions# $(2) is the stripe size 395*fdd8201dSApple OSS Distributions# $(3) is the list of the build configs in the current group 396*fdd8201dSApple OSS Distributions# $(4) is the list of remaining build configs 397*fdd8201dSApple OSS Distributions_function_generate_stripe_groupings_recursive = $(foreach stripe_index,$(call sequence,$(2)),$(if $(word $(stripe_index),$(4)),$(call TOP_LEVEL_STRIPE_DEPENDENCY_template,$(1),$(word $(stripe_index),$(3)),$(word $(stripe_index),$(4))))) $(if $(word $(call increment,$(2)),$(4)),$(call _function_generate_stripe_groupings_recursive,$(1),$(2),$(wordlist 1,$(2),$(4)),$(wordlist $(call increment,$(2)),$(words $(4)),$(4)))) 398*fdd8201dSApple OSS Distributions 399*fdd8201dSApple OSS Distributions# $(1) is the Makefile target we are building for 400*fdd8201dSApple OSS Distributions# $(2) is the stripe size 401*fdd8201dSApple OSS Distributions# $(3) is the list of the build configs 402*fdd8201dSApple OSS Distributions_function_generate_stripe_groupings = $(call _function_generate_stripe_groupings_recursive,$(1),$(2),,$(3)) 403*fdd8201dSApple OSS Distributions 404*fdd8201dSApple OSS Distributions# 405*fdd8201dSApple OSS Distributions# Setup pass for build system tools 406*fdd8201dSApple OSS Distributions# 407*fdd8201dSApple OSS Distributions 408*fdd8201dSApple OSS Distributionsgenerated_top_level_build_setup = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_setup,/..,,,1,$(FIRST_BUILD_CONFIG)) 409*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 410*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_setup)) 411*fdd8201dSApple OSS Distributionsendif 412*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_setup)) 413*fdd8201dSApple OSS Distributions 414*fdd8201dSApple OSS Distributions.PHONY: setup 415*fdd8201dSApple OSS Distributions 416*fdd8201dSApple OSS Distributions# invalidate current kernel in $(SYMROOT). Timestamp must be +1 from a previous kernel build 417*fdd8201dSApple OSS Distributionssetup: build_setup_bootstrap 418*fdd8201dSApple OSS Distributions $(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new 419*fdd8201dSApple OSS Distributions # -nt and -ot are evaluated differently by bash, dash, and zsh (and are not part of the POSIX specification). 420*fdd8201dSApple OSS Distributions # Explicitly specify what should happen when the right hand file doesn't exist. 421*fdd8201dSApple OSS Distributions $(_v)while [ \! $(OBJROOT)/.mach_kernel.timestamp.new -nt $(OBJROOT)/.mach_kernel.timestamp -a \( \! -e $(OBJROOT)/.mach_kernel.timestamp.new -o -e $(OBJROOT)/.mach_kernel.timestamp \) ]; do \ 422*fdd8201dSApple OSS Distributions $(SLEEP) 1; \ 423*fdd8201dSApple OSS Distributions $(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new; \ 424*fdd8201dSApple OSS Distributions done 425*fdd8201dSApple OSS Distributions $(_v)$(MV) $(OBJROOT)/.mach_kernel.timestamp.new $(OBJROOT)/.mach_kernel.timestamp 426*fdd8201dSApple OSS Distributions $(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp.new 427*fdd8201dSApple OSS Distributions $(_v)while [ $(OBJROOT)/.symbolset.timestamp.new -ot $(OBJROOT)/.symbolset.timestamp ]; do \ 428*fdd8201dSApple OSS Distributions $(SLEEP) 1; \ 429*fdd8201dSApple OSS Distributions $(TOUCH) $(OBJROOT)/.symbolset.timestamp.new; \ 430*fdd8201dSApple OSS Distributions done 431*fdd8201dSApple OSS Distributions $(_v)$(MV) $(OBJROOT)/.symbolset.timestamp.new $(OBJROOT)/.symbolset.timestamp 432*fdd8201dSApple OSS Distributions 433*fdd8201dSApple OSS Distributions# 434*fdd8201dSApple OSS Distributions# Install kernel header files 435*fdd8201dSApple OSS Distributions# 436*fdd8201dSApple OSS Distributions.PHONY: exporthdrs exporthdrs_mi exporthdrs_md 437*fdd8201dSApple OSS Distributions 438*fdd8201dSApple OSS Distributionsexporthdrs: exporthdrs_mi exporthdrs_md 439*fdd8201dSApple OSS Distributions 440*fdd8201dSApple OSS Distributions# 441*fdd8201dSApple OSS Distributions# Install machine independent kernel header files 442*fdd8201dSApple OSS Distributions# 443*fdd8201dSApple OSS Distributions 444*fdd8201dSApple OSS Distributionsgenerated_top_level_build_exporthdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_mi,,setup,,1,$(FIRST_BUILD_CONFIG)) 445*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 446*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_mi)) 447*fdd8201dSApple OSS Distributionsendif 448*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_exporthdrs_mi)) 449*fdd8201dSApple OSS Distributions 450*fdd8201dSApple OSS Distributionsexporthdrs_mi: build_exporthdrs_mi_bootstrap 451*fdd8201dSApple OSS Distributions 452*fdd8201dSApple OSS Distributions# 453*fdd8201dSApple OSS Distributions# Install machine dependent kernel header files 454*fdd8201dSApple OSS Distributions# 455*fdd8201dSApple OSS Distributions 456*fdd8201dSApple OSS Distributionsgenerated_top_level_build_exporthdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS)) 457*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 458*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_md)) 459*fdd8201dSApple OSS Distributionsendif 460*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_exporthdrs_md)) 461*fdd8201dSApple OSS Distributions 462*fdd8201dSApple OSS Distributionsexporthdrs_md: build_exporthdrs_md_bootstrap 463*fdd8201dSApple OSS Distributions 464*fdd8201dSApple OSS Distributions# 465*fdd8201dSApple OSS Distributions# Install kernel header files 466*fdd8201dSApple OSS Distributions# 467*fdd8201dSApple OSS Distributions 468*fdd8201dSApple OSS Distributions.PHONY: installhdrs installhdrs_mi installhdrs_md 469*fdd8201dSApple OSS Distributions 470*fdd8201dSApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),) 471*fdd8201dSApple OSS Distributionsinstallhdrs: 472*fdd8201dSApple OSS Distributions @: 473*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),) 474*fdd8201dSApple OSS Distributionsinstallhdrs: 475*fdd8201dSApple OSS Distributions @: 476*fdd8201dSApple OSS Distributionselse 477*fdd8201dSApple OSS Distributions 478*fdd8201dSApple OSS Distributionsinstallhdrs: installhdrs_mi installhdrs_md 479*fdd8201dSApple OSS Distributionsendif 480*fdd8201dSApple OSS Distributions 481*fdd8201dSApple OSS Distributions.PHONY: installhdrs_embedded installhdrs_release_embedded installhdrs_development_embedded installhdrs_desktop 482*fdd8201dSApple OSS Distributions 483*fdd8201dSApple OSS Distributionsinstallhdrs_embedded installhdrs_release_embedded installhdrs_desktop: installhdrs 484*fdd8201dSApple OSS Distributions 485*fdd8201dSApple OSS Distributionsinstallhdrs_development_embedded: 486*fdd8201dSApple OSS Distributions 487*fdd8201dSApple OSS Distributions# 488*fdd8201dSApple OSS Distributions# Install machine independent header files 489*fdd8201dSApple OSS Distributions# 490*fdd8201dSApple OSS Distributions 491*fdd8201dSApple OSS Distributionsgenerated_top_level_build_installhdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_mi,,setup,build_exporthdrs_mi,1,$(FIRST_BUILD_CONFIG)) 492*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 493*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_mi)) 494*fdd8201dSApple OSS Distributionsendif 495*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_installhdrs_mi)) 496*fdd8201dSApple OSS Distributions 497*fdd8201dSApple OSS Distributionsinstallhdrs_mi: build_installhdrs_mi_bootstrap 498*fdd8201dSApple OSS Distributions 499*fdd8201dSApple OSS Distributions# 500*fdd8201dSApple OSS Distributions# Install machine dependent kernel header files 501*fdd8201dSApple OSS Distributions# 502*fdd8201dSApple OSS Distributions 503*fdd8201dSApple OSS Distributionsgenerated_top_level_build_installhdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_md,,setup,build_exporthdrs_md,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS)) 504*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 505*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_md)) 506*fdd8201dSApple OSS Distributionsendif 507*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_installhdrs_md)) 508*fdd8201dSApple OSS Distributions 509*fdd8201dSApple OSS Distributionsinstallhdrs_md: build_installhdrs_md_bootstrap 510*fdd8201dSApple OSS Distributions 511*fdd8201dSApple OSS Distributions.PHONY: install_textfiles install_textfiles_mi install_textfiles_md 512*fdd8201dSApple OSS Distributions 513*fdd8201dSApple OSS Distributionsinstall_textfiles: install_textfiles_mi install_textfiles_md 514*fdd8201dSApple OSS Distributions 515*fdd8201dSApple OSS Distributions# 516*fdd8201dSApple OSS Distributions# Install machine independent text files (man pages, dtrace scripts, etc.) 517*fdd8201dSApple OSS Distributions# 518*fdd8201dSApple OSS Distributions 519*fdd8201dSApple OSS Distributionsgenerated_top_level_textfiles_install_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,textfiles_install_mi,,setup,,1,$(FIRST_BUILD_CONFIG)) 520*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 521*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_textfiles_install_mi)) 522*fdd8201dSApple OSS Distributionsendif 523*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_textfiles_install_mi)) 524*fdd8201dSApple OSS Distributions 525*fdd8201dSApple OSS Distributionsinstall_textfiles_mi: textfiles_install_mi_bootstrap 526*fdd8201dSApple OSS Distributions 527*fdd8201dSApple OSS Distributions# 528*fdd8201dSApple OSS Distributions# Install machine dependent text files (man pages, dtrace scripts, etc.) 529*fdd8201dSApple OSS Distributions# 530*fdd8201dSApple OSS Distributions 531*fdd8201dSApple OSS Distributionsgenerated_top_level_textfiles_install_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,textfiles_install_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS)) 532*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 533*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_textfiles_install_md)) 534*fdd8201dSApple OSS Distributionsendif 535*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_textfiles_install_md)) 536*fdd8201dSApple OSS Distributions 537*fdd8201dSApple OSS Distributionsinstall_textfiles_md: textfiles_install_md_bootstrap 538*fdd8201dSApple OSS Distributions 539*fdd8201dSApple OSS Distributions# 540*fdd8201dSApple OSS Distributions# Build all architectures for all Configuration/Architecture options 541*fdd8201dSApple OSS Distributions# 542*fdd8201dSApple OSS Distributions 543*fdd8201dSApple OSS Distributionsgenerated_top_level_build_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_all,,setup exporthdrs,,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS)) 544*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 545*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_all)) 546*fdd8201dSApple OSS Distributionsendif 547*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_all)) 548*fdd8201dSApple OSS Distributions 549*fdd8201dSApple OSS Distributions.PHONY: build 550*fdd8201dSApple OSS Distributions 551*fdd8201dSApple OSS Distributionsbuild: build_all_bootstrap 552*fdd8201dSApple OSS Distributions 553*fdd8201dSApple OSS Distributions# 554*fdd8201dSApple OSS Distributions# Post-process build results 555*fdd8201dSApple OSS Distributions# 556*fdd8201dSApple OSS Distributions 557*fdd8201dSApple OSS Distributionsgenerated_top_level_config_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_all,,setup,build_all,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS)) 558*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 559*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_all)) 560*fdd8201dSApple OSS Distributionsendif 561*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_config_all)) 562*fdd8201dSApple OSS Distributions 563*fdd8201dSApple OSS Distributions.PHONY: all config 564*fdd8201dSApple OSS Distributions 565*fdd8201dSApple OSS Distributionsall config: config_all_bootstrap 566*fdd8201dSApple OSS Distributions 567*fdd8201dSApple OSS Distributions.PHONY: all_embedded all_release_embedded all_development_embedded all_desktop 568*fdd8201dSApple OSS Distributions 569*fdd8201dSApple OSS Distributionsall_embedded all_release_embedded all_development_embedded all_desktop: all 570*fdd8201dSApple OSS Distributions 571*fdd8201dSApple OSS Distributions# 572*fdd8201dSApple OSS Distributions# Install kernel files 573*fdd8201dSApple OSS Distributions# 574*fdd8201dSApple OSS Distributions 575*fdd8201dSApple OSS Distributionsgenerated_top_level_build_install_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_primary,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS)) 576*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 577*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_install_primary)) 578*fdd8201dSApple OSS Distributionsendif 579*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_install_primary)) 580*fdd8201dSApple OSS Distributions 581*fdd8201dSApple OSS Distributions.PHONY: install_primary 582*fdd8201dSApple OSS Distributions 583*fdd8201dSApple OSS Distributionsinstall_primary: build_install_primary_bootstrap 584*fdd8201dSApple OSS Distributions 585*fdd8201dSApple OSS Distributionsgenerated_top_level_build_install_non_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_non_primary,,setup,config_all,$(KERNEL_BUILDS_IN_PARALLEL),$(NON_PRIMARY_BUILD_CONFIGS)) 586*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 587*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_install_non_primary)) 588*fdd8201dSApple OSS Distributionsendif 589*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_build_install_non_primary)) 590*fdd8201dSApple OSS Distributions 591*fdd8201dSApple OSS Distributions.PHONY: install_non_primary 592*fdd8201dSApple OSS Distributions 593*fdd8201dSApple OSS Distributionsinstall_non_primary: build_install_non_primary_bootstrap 594*fdd8201dSApple OSS Distributions 595*fdd8201dSApple OSS Distributionsgenerated_top_level_config_install_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install_primary,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS)) 596*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 597*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install_primary)) 598*fdd8201dSApple OSS Distributionsendif 599*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_config_install_primary)) 600*fdd8201dSApple OSS Distributions 601*fdd8201dSApple OSS Distributions.PHONY: install_config_primary 602*fdd8201dSApple OSS Distributions 603*fdd8201dSApple OSS Distributionsinstall_config_primary: config_install_primary_bootstrap 604*fdd8201dSApple OSS Distributions 605*fdd8201dSApple OSS Distributions# config_install_variant iterates through products from all BUILD_CONFIGS so depends on config_all having completed overall 606*fdd8201dSApple OSS Distributionsgenerated_top_level_config_install_variant = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install_variant,,config_all_bootstrap,,1,$(VARIANT_CONFIGS)) 607*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 608*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install_variant)) 609*fdd8201dSApple OSS Distributionsendif 610*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_config_install_variant)) 611*fdd8201dSApple OSS Distributions 612*fdd8201dSApple OSS Distributions.PHONY: install_config_variant 613*fdd8201dSApple OSS Distributions 614*fdd8201dSApple OSS Distributionsinstall_config_variant: config_install_variant_bootstrap 615*fdd8201dSApple OSS Distributions 616*fdd8201dSApple OSS Distributions# config_install iterates through products from all BUILD_CONFIGS so depends on config_all having completed overall 617*fdd8201dSApple OSS Distributionsgenerated_top_level_config_install = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install,,config_all_bootstrap,,1,$(FIRST_BUILD_CONFIG)) 618*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 619*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install)) 620*fdd8201dSApple OSS Distributionsendif 621*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_config_install)) 622*fdd8201dSApple OSS Distributions 623*fdd8201dSApple OSS Distributions.PHONY: install_config final_touch_config_timestamps 624*fdd8201dSApple OSS Distributions 625*fdd8201dSApple OSS Distributionsinstall_config: config_install_bootstrap install_config_primary install_config_variant final_touch_config_timestamps 626*fdd8201dSApple OSS Distributions 627*fdd8201dSApple OSS Distributions 628*fdd8201dSApple OSS Distributions# Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT 629*fdd8201dSApple OSS Distributionsfinal_touch_config_timestamps: config_install_bootstrap install_config_primary install_config_variant 630*fdd8201dSApple OSS Distributions $(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp 631*fdd8201dSApple OSS Distributions 632*fdd8201dSApple OSS Distributions# 633*fdd8201dSApple OSS Distributions# Aggregate install targets, which install everything appropriate for the current build alias/make target 634*fdd8201dSApple OSS Distributions# 635*fdd8201dSApple OSS Distributions 636*fdd8201dSApple OSS Distributions.PHONY: install 637*fdd8201dSApple OSS Distributions 638*fdd8201dSApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),) 639*fdd8201dSApple OSS Distributionsinstall: install_kernels 640*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),) 641*fdd8201dSApple OSS Distributionsinstall: install_config install_kernels 642*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_Sim),) 643*fdd8201dSApple OSS Distributionsinstall: installhdrs 644*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_host),) 645*fdd8201dSApple OSS Distributionsinstall: installhdrs 646*fdd8201dSApple OSS Distributionsexport INSTALLHDRS_SKIP_HOST=YES 647*fdd8201dSApple OSS Distributionsexport INSTALLHDRS_MODULEMAPS_SKIP_HOST=YES 648*fdd8201dSApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_driverkit),) 649*fdd8201dSApple OSS Distributionsinstall: installhdrs_desktop 650*fdd8201dSApple OSS Distributionselse 651*fdd8201dSApple OSS Distributions 652*fdd8201dSApple OSS Distributionsinstall: installhdrs install_textfiles install_config install_kernels install_aliases 653*fdd8201dSApple OSS Distributionsendif 654*fdd8201dSApple OSS Distributions 655*fdd8201dSApple OSS Distributions.PHONY: install_embedded install_release_embedded install_development_embedded install_desktop 656*fdd8201dSApple OSS Distributions 657*fdd8201dSApple OSS Distributions# By default, all kernel files, headers, text files, and pseudo-kexts are installed 658*fdd8201dSApple OSS Distributionsinstall_embedded install_release_embedded install_desktop: install 659*fdd8201dSApple OSS Distributions 660*fdd8201dSApple OSS Distributions# These special configs only install the kernel files 661*fdd8201dSApple OSS Distributionsinstall_development_embedded: install_kernels install_aliases 662*fdd8201dSApple OSS Distributions 663*fdd8201dSApple OSS Distributions.PHONY: install_kernels final_touch_kernel_timestamps install_aliases 664*fdd8201dSApple OSS Distributions 665*fdd8201dSApple OSS Distributionsinstall_kernels: build_install_primary_bootstrap build_install_non_primary_bootstrap final_touch_kernel_timestamps 666*fdd8201dSApple OSS Distributions 667*fdd8201dSApple OSS Distributions# Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT 668*fdd8201dSApple OSS Distributionsfinal_touch_kernel_timestamps: build_install_primary_bootstrap build_install_non_primary_bootstrap 669*fdd8201dSApple OSS Distributions $(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp 670*fdd8201dSApple OSS Distributions @echo "done building xnu" 671*fdd8201dSApple OSS Distributions 672*fdd8201dSApple OSS Distributions# Copy kernels that are aliases of another configuration 673*fdd8201dSApple OSS Distributionsgenerated_top_level_install_alias = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,install_alias,,install_kernels,,$(KERNEL_BUILDS_IN_PARALLEL),$(ALIAS_CONFIGS)) 674*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 675*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_install_alias)) 676*fdd8201dSApple OSS Distributionsendif 677*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_install_alias)) 678*fdd8201dSApple OSS Distributions 679*fdd8201dSApple OSS Distributionsinstall_aliases: install_alias_bootstrap 680*fdd8201dSApple OSS Distributions 681*fdd8201dSApple OSS Distributions# 682*fdd8201dSApple OSS Distributions# Install source tree 683*fdd8201dSApple OSS Distributions# 684*fdd8201dSApple OSS Distributions.PHONY: installsrc 685*fdd8201dSApple OSS Distributions 686*fdd8201dSApple OSS Distributionsinstallsrc: 687*fdd8201dSApple OSS Distributions @echo INSTALLSRC $(SRCROOT) 688*fdd8201dSApple OSS Distributions $(_v)$(MKDIR) $(SRCROOT) 689*fdd8201dSApple OSS Distributions $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT) 690*fdd8201dSApple OSS Distributions $(_v)$(CHMOD) -R go+rX $(SRCROOT) 691*fdd8201dSApple OSS Distributions 692*fdd8201dSApple OSS Distributions 693*fdd8201dSApple OSS Distributions# 694*fdd8201dSApple OSS Distributions# Clean up source tree 695*fdd8201dSApple OSS Distributions# 696*fdd8201dSApple OSS Distributions.PHONY: clean 697*fdd8201dSApple OSS Distributions 698*fdd8201dSApple OSS DistributionsCLEAN_RM_DIRS= $(OBJROOT) $(SYMROOT) $(DSTROOT) \ 699*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/test/BUILD \ 700*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/darwintests/build \ 701*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/testkext/build \ 702*fdd8201dSApple OSS Distributions $(SRCROOT)/libkdd/build \ 703*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/unit_tests/BUILD \ 704*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/execperf/BUILD \ 705*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/packetdrill/BUILD \ 706*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/perf_index/BUILD 707*fdd8201dSApple OSS Distributions 708*fdd8201dSApple OSS DistributionsCLEAN_ACTION_DIRS= $(SRCROOT)/tools/tests/MPMMTest \ 709*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/TLBcoherency \ 710*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/kqueue_tests \ 711*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/mktimer \ 712*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/zero-to-n \ 713*fdd8201dSApple OSS Distributions $(SRCROOT)/tools/tests/personas 714*fdd8201dSApple OSS Distributions 715*fdd8201dSApple OSS Distributionsclean: 716*fdd8201dSApple OSS Distributions @: 717*fdd8201dSApple OSS Distributions $(_v)rm -f cscope.* 2> /dev/null 718*fdd8201dSApple OSS Distributions $(_v)rm -f TAGS 2> /dev/null 719*fdd8201dSApple OSS Distributions $(_v)for cdir in $(CLEAN_RM_DIRS); do \ 720*fdd8201dSApple OSS Distributions if [ -d $${cdir} ] ; then \ 721*fdd8201dSApple OSS Distributions echo "Removing $${cdir}"; \ 722*fdd8201dSApple OSS Distributions rm -fr $${cdir} 2> /dev/null || true ; \ 723*fdd8201dSApple OSS Distributions fi ; \ 724*fdd8201dSApple OSS Distributions done 725*fdd8201dSApple OSS Distributions 726*fdd8201dSApple OSS Distributions $(_v)for mcdir in $(CLEAN_ACTION_DIRS); do \ 727*fdd8201dSApple OSS Distributions make -C $${mcdir} clean; \ 728*fdd8201dSApple OSS Distributions done 729*fdd8201dSApple OSS Distributions 730*fdd8201dSApple OSS Distributions 731*fdd8201dSApple OSS Distributions# 732*fdd8201dSApple OSS Distributions# Build source file list for cscope database and tags 733*fdd8201dSApple OSS Distributions# 734*fdd8201dSApple OSS Distributions.PHONY: cscope.files 735*fdd8201dSApple OSS Distributions 736*fdd8201dSApple OSS Distributionscscope.files: 737*fdd8201dSApple OSS Distributions @echo "Building file list for cscope and tags" 738*fdd8201dSApple OSS Distributions @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null 739*fdd8201dSApple OSS Distributions @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null 740*fdd8201dSApple OSS Distributions @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null 741*fdd8201dSApple OSS Distributions @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null 742*fdd8201dSApple OSS Distributions @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null 743*fdd8201dSApple OSS Distributions @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null 744*fdd8201dSApple OSS Distributions @cat $(OBJROOT)/cscope.genhdrs/* >> _cscope.files 2> /dev/null || true 745*fdd8201dSApple OSS Distributions @echo -k -q -c > cscope.files 2> /dev/null 746*fdd8201dSApple OSS Distributions @sort -u < _cscope.files >> cscope.files 2> /dev/null 747*fdd8201dSApple OSS Distributions @rm -f _cscope.files _cscope.files2 2> /dev/null 748*fdd8201dSApple OSS Distributions 749*fdd8201dSApple OSS Distributions# 750*fdd8201dSApple OSS Distributions# Build cscope database 751*fdd8201dSApple OSS Distributions# 752*fdd8201dSApple OSS Distributionscscope: cscope.files 753*fdd8201dSApple OSS Distributions @echo "Building cscope database" 754*fdd8201dSApple OSS Distributions @cscope -bvU 2> /dev/null 755*fdd8201dSApple OSS Distributions 756*fdd8201dSApple OSS Distributions# 757*fdd8201dSApple OSS Distributions# Build tags 758*fdd8201dSApple OSS Distributions# 759*fdd8201dSApple OSS Distributionstags: cscope.files 760*fdd8201dSApple OSS Distributions @echo "Building ctags" 761*fdd8201dSApple OSS Distributions @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \ 762*fdd8201dSApple OSS Distributions echo "Phantom files detected!" 2>&1 > /dev/null 763*fdd8201dSApple OSS Distributions @-[ -f TAGS ] || ${MAKE} -f $(firstword $(MAKEFILE_LIST)) TAGS 764*fdd8201dSApple OSS Distributions 765*fdd8201dSApple OSS DistributionsTAGS: cscope.files 766*fdd8201dSApple OSS Distributions @echo "Building etags" 767*fdd8201dSApple OSS Distributions @-cat cscope.files | etags -l auto -S - 2> /dev/null 768*fdd8201dSApple OSS Distributions @rm -f cscope.files 2> /dev/null 769*fdd8201dSApple OSS Distributions 770*fdd8201dSApple OSS Distributions 771*fdd8201dSApple OSS Distributions.PHONY: help 772*fdd8201dSApple OSS Distributions 773*fdd8201dSApple OSS Distributionshelp: 774*fdd8201dSApple OSS Distributions @cat README.md 775*fdd8201dSApple OSS Distributions 776*fdd8201dSApple OSS Distributions.PHONY: print_exports 777*fdd8201dSApple OSS Distributions 778*fdd8201dSApple OSS Distributionsprint_exports: 779*fdd8201dSApple OSS Distributions $(_v)printenv | sort 780*fdd8201dSApple OSS Distributions 781*fdd8201dSApple OSS Distributionsgenerated_top_level_print_exports = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,print_exports,,,,1,$(FIRST_BUILD_CONFIG)) 782*fdd8201dSApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) 783*fdd8201dSApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_print_exports)) 784*fdd8201dSApple OSS Distributionsendif 785*fdd8201dSApple OSS Distributions$(eval $(generated_top_level_print_exports)) 786*fdd8201dSApple OSS Distributions 787*fdd8201dSApple OSS Distributions.PHONY: print_exports_first_build_config 788*fdd8201dSApple OSS Distributions 789*fdd8201dSApple OSS Distributionsprint_exports_first_build_config: print_exports_bootstrap 790*fdd8201dSApple OSS Distributions 791*fdd8201dSApple OSS Distributions# vim: set ft=make: 792