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