X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3e170ce000f1506b7b5d2c5c7faec85ceabb573d..eb6b6ca394357805f2bdba989abae309f718b4d8:/makedefs/MakeInc.top diff --git a/makedefs/MakeInc.top b/makedefs/MakeInc.top index df7886010..dd1070e64 100644 --- a/makedefs/MakeInc.top +++ b/makedefs/MakeInc.top @@ -1,11 +1,11 @@ # -*- mode: makefile;-*- # -# Copyright (C) 2010-2014 Apple Inc. All rights reserved. +# Copyright (C) 2010-2016 Apple Inc. All rights reserved. # # MakeInc.top is the top-level makefile for the xnu # build system. All the main XBS targets # (like "installhdrs") are defined here, as -# well as globals that can be overridden on +# well as globals that can be overridden on # the command-line by the user. # # This makefile's main purpose is to bootstrap @@ -20,9 +20,9 @@ # single-architecture build is responsible for # inserting its build products into the final # multi-architecture output files. To avoid -# races, these aggregating stages for +# races, these aggregating stages for # "primary" build configs are done in serial. -# +# export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd @@ -43,22 +43,25 @@ else override DEFAULT_ARCH_CONFIG := X86_64 endif - # Accept either explicit ARCH_CONFIGS or XBS-style RC_ARCHS ifndef ARCH_CONFIGS ifdef RC_ARCHS -ARCH_CONFIGS := $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z | $(TR) " " "\n" | sort -u | $(TR) "\n" " ") +ARCH_CONFIGS := $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z | $(TR) " " "\n" | sort -u | $(TR) "\n" " ") else ARCH_CONFIGS := DEFAULT endif endif # -# Kernel Configuration options +# Kernel Configuration options # +DEFAULT_PRODUCT_CONFIGS := + ifeq ($(RC_ProjectName),xnu_debug) override DEFAULT_KERNEL_CONFIG := DEBUG +else ifeq ($(RC_ProjectName),xnu_kasan) +override KERNEL_CONFIGS := KASAN else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) override DEFAULT_KERNEL_CONFIG := DEVELOPMENT else ifeq ($(PLATFORM),MacOSX) @@ -72,25 +75,31 @@ ifndef KERNEL_CONFIGS KERNEL_CONFIGS := DEFAULT endif +# If PRODUCT_CONFIGS is specified it should override default +ifndef PRODUCT_CONFIGS +PRODUCT_CONFIGS := $(DEFAULT_PRODUCT_CONFIGS) +endif + # -# Machine Configuration options +# Machine Configuration options # override DEFAULT_I386_MACHINE_CONFIG := NONE override DEFAULT_X86_64_MACHINE_CONFIG := NONE override DEFAULT_X86_64H_MACHINE_CONFIG := NONE - +override DEFAULT_ARM_MACHINE_CONFIG := T8002 +override DEFAULT_ARM64_MACHINE_CONFIG := T7000 # This is typically never specified (TARGET_CONFIGS is used) ifndef MACHINE_CONFIGS -MACHINE_CONFIGS := DEFAULT +MACHINE_CONFIGS := DEFAULT endif # -# Target configuration options. NOTE - target configurations will +# Target configuration options. NOTE - target configurations will # override ARCH_CONFIGS and KERNEL_CONFIGS and MACHINE_CONFIGS. # -# Target configs come in groups of three parameters. The first is the +# Target configs come in groups of three parameters. The first is the # kernel configuration, the second is the architecture configuration, # and the third is the machine configuration. You may pass in as # many groups of configurations as you wish. Each item passed in is @@ -100,12 +109,82 @@ endif # TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS" # Parameters may be in upper or lower case (they are converted to upper). # -# "default" parameter is a special case. It means use the default value for +# "default" parameter is a special case. It means use the default value for # that parameter. Here are the default values for each configuration: # # default kernel configuration = DEFAULT_KERNEL_CONFIG # default architecture configuration = system architecture where you are running make. +ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),) + +# Defaults for "make all_embedded" +ifeq ($(KERNEL_CONFIGS),DEFAULT) +KERNEL_CONFIGS_EMBEDDED := RELEASE DEVELOPMENT +else +KERNEL_CONFIGS_EMBEDDED := $(KERNEL_CONFIGS) +endif + +ifeq ($(ARCH_CONFIGS),DEFAULT) +ARCH_CONFIGS_EMBEDDED := ARM ARM64 +else +ARCH_CONFIGS_EMBEDDED := $(strip $(shell echo $(ARCH_CONFIGS) | $(TR) a-z A-Z)) +endif + +# Find supported products from the device map +DEVICEMAP_PRODUCTS_ARMV7 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ + -query 'SELECT DISTINCT TargetType \ + FROM Files \ + INNER JOIN Manifests USING (manifestID) \ + INNER JOIN Targets USING (Target) \ + WHERE (KernelMachOArchitecture LIKE "armv7" \ + AND fileType in ("KernelCache", "RestoreKernelCache"))') +DEVICEMAP_PRODUCTS_ARMV7S := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ + -query 'SELECT DISTINCT TargetType \ + FROM Files \ + INNER JOIN Manifests USING (manifestID) \ + INNER JOIN Targets USING (Target) \ + WHERE (KernelMachOArchitecture LIKE "armv7s" \ + AND fileType in ("KernelCache", "RestoreKernelCache"))') +DEVICEMAP_PRODUCTS_ARMV7K := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ + -query 'SELECT DISTINCT TargetType \ + FROM Files \ + INNER JOIN Manifests USING (manifestID) \ + INNER JOIN Targets USING (Target) \ + WHERE (KernelMachOArchitecture LIKE "armv7k" \ + AND fileType in ("KernelCache", "RestoreKernelCache"))') +DEVICEMAP_PRODUCTS_ARM := $(DEVICEMAP_PRODUCTS_ARMV7) $(DEVICEMAP_PRODUCTS_ARMV7S) $(DEVICEMAP_PRODUCTS_ARMV7K) + + +DEVICEMAP_PRODUCTS_ARM64 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) \ + -query 'SELECT DISTINCT TargetType \ + FROM Files \ + INNER JOIN Manifests USING (manifestID) \ + INNER JOIN Targets USING (Target) \ + WHERE (KernelMachOArchitecture LIKE "arm64" \ + AND fileType in ("KernelCache", "RestoreKernelCache"))') + + +# Generate a list of mappings of the form "n75:arm;t8002" based on the device map +DEVICEMAP_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} }' ) + +# Map a product like "n75" to "arm;t8002" +# $(1) is a product name in lower case +function_lookup_product = $(call function_substitute_word_with_replacement, \ + $(1), \ + $(DEVICEMAP_PRODUCT_SOC_MAPPINGS), \ + unknown_arch_for_$(1);unknown_platform_for_$(1) \ + ) + +# Generate a list of mappings for products that use a different platform for their kernel configuration than their true platform +# of the form "n71m:arm64;s8000;s8003". The 4th element is the true SoC platform, which will get an on-disk copy, while the +# kernel's recursive build system will build the 3rd element as the KernelPlatform +DEVICEMAP_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} }' ) + +function_lookup_product_alias = $(call function_substitute_word_with_replacement, \ + $(1), \ + $(DEVICEMAP_PRODUCT_SOC_ALIASES), \ + ) +endif ifeq ($(PLATFORM),MacOSX) @@ -121,22 +200,28 @@ endif ifndef TARGET_CONFIGS ifneq ($(PRODUCT_CONFIGS),) # generate TARGET_CONFIGS using KERNEL_CONFIGS and PRODUCT_CONFIGS -TARGET_CONFIGS := $(foreach my_kernel_config,$(KERNEL_CONFIGS),$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config))))) +TARGET_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)))) +TARGET_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)))) else ifneq ($(filter %_release_embedded,$(MAKECMDGOALS)),) # generate TARGET_CONFIGS for RELEASE kernel configs and products in the device map -TARGET_CONFIGS := $(foreach my_kernel_config,RELEASE,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config)))))) +TARGET_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)))) +TARGET_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)))) else ifneq ($(filter %_development_embedded,$(MAKECMDGOALS)),) # generate TARGET_CONFIGS for DEVELOPMENT kernel configs and products in the device map -TARGET_CONFIGS := $(foreach my_kernel_config,DEVELOPMENT,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config)))))) +TARGET_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)))) +TARGET_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)))) else ifneq ($(filter %_embedded,$(MAKECMDGOALS)),) # generate TARGET_CONFIGS for all kernel configs and products in the device map -TARGET_CONFIGS := $(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config)))))) +TARGET_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)))) +TARGET_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)))) else ifneq ($(filter %_desktop,$(MAKECMDGOALS)),) # generate TARGET_CONFIGS for all kernel configs for B&I TARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS_DESKTOP), $(foreach my_arch_config, $(ARCH_CONFIGS), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config)))) +TARGET_CONFIGS_ALIASES := else # generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIGS (which defaults to "DEFAULT") TARGET_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)))) +TARGET_CONFIGS_ALIASES := endif endif @@ -145,6 +230,7 @@ $(error No TARGET_CONFIGS specified) endif TARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z)) +TARGET_CONFIGS_ALIASES_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS_ALIASES)" | $(TR) a-z A-Z)) # # Build Configurations @@ -152,7 +238,7 @@ TARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z # TARGET_CONFIGS is unwieldy for use in Makefiles. Convert them to # "build configurations" which are tuples joined by "^". For # example, "RELEASE I386 DEFAULT DEVELOPMENT ARM DEFAULT" becomes -# "RELEASE^I386^NONE DEVELOPMENT^ARM^S5L8920X", which can be looped +# "RELEASE^I386^NONE DEVELOPMENT^ARM^T8002", which can be looped # over trivially. PRIMARY_BUILD_CONFIGS is the first config # for each architecture, used primarily for machine-dependent recursion. @@ -163,11 +249,19 @@ PRIMARY_BUILD_CONFIGS = $(strip $(foreach arch, $(PRIMARY_ARCHS), $(firstword $( NON_PRIMARY_BUILD_CONFIGS = $(strip $(filter-out $(PRIMARY_BUILD_CONFIGS), $(BUILD_CONFIGS))) FIRST_BUILD_CONFIG = $(firstword $(BUILD_CONFIGS)) +ifneq ($(TARGET_CONFIGS_ALIASES_UC),) +ALIAS_CONFIGS = $(call function_create_alias_configs, $(TARGET_CONFIGS_ALIASES_UC)) +else +ALIAS_CONFIGS = +endif + # $(warning PRIMARY_ARCHS is $(PRIMARY_ARCHS)) # $(warning TARGET_CONFIGS is $(TARGET_CONFIGS)) # $(warning BUILD_CONFIGS is $(BUILD_CONFIGS)) # $(warning PRIMARY_BUILD_CONFIGS is $(PRIMARY_BUILD_CONFIGS)) # $(warning NON_PRIMARY_BUILD_CONFIGS is $(NON_PRIMARY_BUILD_CONFIGS)) +# $(warning TARGET_CONFIGS_ALIASES is $(TARGET_CONFIGS_ALIASES)) +# $(warning ALIAS_CONFIGS is $(ALIAS_CONFIGS)) MEMORY_SIZE := $(shell /usr/sbin/sysctl -n hw.memsize) @@ -175,7 +269,7 @@ MEMORY_SIZE := $(shell /usr/sbin/sysctl -n hw.memsize) LARGE_BUILD_FOOTPRINT := $(if $(BUILD_LTO),$(BUILD_LTO),1) ifeq ($(LARGE_BUILD_FOOTPRINT),1) -RAM_PER_KERNEL_BUILD := 8589934592 +RAM_PER_KERNEL_BUILD := 4294967296 else RAM_PER_KERNEL_BUILD := 268435456 endif @@ -214,10 +308,9 @@ $$(warning Generate makefile fragment: $$($(1)_generated_stripe_dependencies)) endif $$(eval $$($(1)_generated_stripe_dependencies)) - $$($(1)_bootstrap_target_list): $(1)_bootstrap_% : $(1)_stripe_dep_for_% $$(addsuffix _bootstrap_%,$(4)) $(3) $$(_v)$$(MKDIR) $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2) - $$(_v)$${MAKE} \ + $$(_v)$${MAKE} \ -C $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2) \ -f $${SRCROOT}/Makefile \ CURRENT_KERNEL_CONFIG=$$(call function_extract_kernel_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \ @@ -257,7 +350,6 @@ endef # $(4) is the list of remaining build configs _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)))) - # $(1) is the Makefile target we are building for # $(2) is the stripe size # $(3) is the list of the build configs @@ -295,7 +387,7 @@ setup: build_setup_bootstrap # .PHONY: exporthdrs exporthdrs_mi exporthdrs_md -exporthdrs: exporthdrs_mi exporthdrs_md +exporthdrs: exporthdrs_mi exporthdrs_md # # Install machine independent kernel header files @@ -310,7 +402,7 @@ $(eval $(generated_top_level_build_exporthdrs_mi)) exporthdrs_mi: build_exporthdrs_mi_bootstrap # -# Install machine dependent kernel header files +# Install machine dependent kernel header files # generated_top_level_build_exporthdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS)) @@ -328,6 +420,9 @@ exporthdrs_md: build_exporthdrs_md_bootstrap .PHONY: installhdrs installhdrs_mi installhdrs_md ifeq ($(RC_ProjectName),xnu_debug) +installhdrs: + @: +else ifeq ($(RC_ProjectName),xnu_kasan) installhdrs: @: else @@ -354,7 +449,7 @@ $(eval $(generated_top_level_build_installhdrs_mi)) installhdrs_mi: build_installhdrs_mi_bootstrap # -# Install machine dependent kernel header files +# Install machine dependent kernel header files # generated_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)) @@ -457,11 +552,18 @@ final_touch_config_timestamps: config_install_bootstrap ifeq ($(RC_ProjectName),xnu_debug) install: install_kernels +else ifeq ($(RC_ProjectName),xnu_kasan) +install: install_config install_kernels else ifeq ($(RC_ProjectName),xnu_headers_Sim) install: installhdrs +else ifeq ($(RC_ProjectName),xnu_headers_host) +install: installhdrs +export INSTALLHDRS_SKIP_HOST=YES +else ifeq ($(RC_ProjectName),xnu_headers_driverkit) +install: installhdrs_desktop else -install: installhdrs install_textfiles install_config install_kernels +install: installhdrs install_textfiles install_config install_kernels install_aliases checkstyle endif .PHONY: install_embedded install_release_embedded install_development_embedded install_desktop @@ -470,9 +572,9 @@ endif install_embedded install_release_embedded install_desktop: install # These special configs only install the kernel files -install_development_embedded: install_kernels +install_development_embedded: install_kernels install_aliases -.PHONY: install_kernels final_touch_kernel_timestamps +.PHONY: install_kernels final_touch_kernel_timestamps install_aliases install_kernels: build_install_primary_bootstrap build_install_non_primary_bootstrap final_touch_kernel_timestamps @@ -480,6 +582,15 @@ install_kernels: build_install_primary_bootstrap build_install_non_primary_boots final_touch_kernel_timestamps: build_install_primary_bootstrap build_install_non_primary_bootstrap $(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp +# Copy kernels that are aliases of another configuration +generated_top_level_install_alias = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,install_alias,,install_kernels,,$(KERNEL_BUILDS_IN_PARALLEL),$(ALIAS_CONFIGS)) +ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) +$(warning Generate makefile fragment: $(generated_top_level_install_alias)) +endif +$(eval $(generated_top_level_install_alias)) + +install_aliases: install_alias_bootstrap + # # Install source tree # @@ -497,11 +608,37 @@ installsrc: # .PHONY: clean +CLEAN_RM_DIRS= $(OBJROOT) $(SYMROOT) $(DSTROOT) \ + $(SRCROOT)/tools/test/BUILD \ + $(SRCROOT)/tools/tests/darwintests/build \ + $(SRCROOT)/tools/tests/testkext/build \ + $(SRCROOT)/libkdd/build \ + $(SRCROOT)/tools/tests/unit_tests/BUILD \ + $(SRCROOT)/tools/tests/execperf/BUILD \ + $(SRCROOT)/tools/tests/packetdrill/BUILD \ + $(SRCROOT)/tools/tests/perf_index/BUILD + +CLEAN_ACTION_DIRS= $(SRCROOT)/tools/tests/MPMMTest \ + $(SRCROOT)/tools/tests/TLBcoherency \ + $(SRCROOT)/tools/tests/kqueue_tests \ + $(SRCROOT)/tools/tests/mktimer \ + $(SRCROOT)/tools/tests/zero-to-n \ + $(SRCROOT)/tools/tests/personas + clean: @: - @rm -f cscope.* 2> /dev/null - @rm -f $(OBJROOT)/cscope.genhdrs/* 2> /dev/null || true - @rm -f TAGS 2> /dev/null + $(_v)rm -f cscope.* 2> /dev/null + $(_v)rm -f TAGS 2> /dev/null + $(_v)for cdir in $(CLEAN_RM_DIRS); do \ + if [ -d $${cdir} ] ; then \ + echo "Removing $${cdir}"; \ + rm -fr $${cdir} 2> /dev/null || true ; \ + fi ; \ + done + + $(_v)for mcdir in $(CLEAN_ACTION_DIRS); do \ + make -C $${mcdir} clean; \ + done # @@ -544,24 +681,30 @@ TAGS: cscope.files @rm -f cscope.files 2> /dev/null # -# Re-indent source code using xnu clang-format style +# Check or reformat source code for official xnu code style # -.PHONY: reindent +.PHONY: checkstyle restyle check_uncrustify uncrustify + +# User-friendly aliases for those who prefer to remember the name of the tool. +check_uncrustify: checkstyle +uncrustify: restyle -reindent: - $(_v)$(SRCROOT)/tools/reindent.sh +checkstyle: + ${_V}$(SRCROOT)/tools/uncrustify.sh + +restyle: + ${_V}$(SRCROOT)/tools/uncrustify.sh -f .PHONY: help help: - @cat README + @cat README.md .PHONY: print_exports print_exports: $(_v)printenv | sort - generated_top_level_print_exports = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,print_exports,,,,1,$(FIRST_BUILD_CONFIG)) ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES) $(warning Generate makefile fragment: $(generated_top_level_print_exports))