The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/Makefile

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #
    2 # Copyright (C) 1999-2020 Apple Inc. All rights reserved.
    3 #
    4 ifndef VERSDIR
    5 export VERSDIR := $(shell /bin/pwd)
    6 endif
    7 
    8 ifndef SRCROOT
    9 export SRCROOT := $(shell /bin/pwd)
   10 endif
   11 ifndef OBJROOT
   12 export OBJROOT = $(SRCROOT)/BUILD/obj
   13 endif
   14 ifndef DSTROOT
   15 export DSTROOT = $(SRCROOT)/BUILD/dst
   16 endif
   17 ifndef SYMROOT
   18 export SYMROOT = $(SRCROOT)/BUILD/sym
   19 endif
   20 ifndef MallocNanoZone
   21 export MallocNanoZone := 1
   22 endif
   23 
   24 # Avoid make default rules, make becomes faster
   25 MAKEFLAGS+=r
   26 
   27 export MakeInc_top=${VERSDIR}/makedefs/MakeInc.top
   28 export MakeInc_kernel=${VERSDIR}/makedefs/MakeInc.kernel
   29 export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
   30 export MakeInc_def=${VERSDIR}/makedefs/MakeInc.def
   31 export MakeInc_rule=${VERSDIR}/makedefs/MakeInc.rule
   32 export MakeInc_dir=${VERSDIR}/makedefs/MakeInc.dir
   33 
   34 .DEFAULT_GOAL := default
   35 
   36 export PATCH_PREFIX ?= change-under-test_
   37 export PATCH_GLOB ?= $(PATCH_PREFIX)*.diff
   38 
   39 
   40 skip:
   41         @echo "Skipping $(RC_ProjectName)"
   42 
   43 .PHONY: skip
   44 
   45 #
   46 # Dispatch non-xnu build aliases to their own build
   47 # systems. All xnu variants start with MakeInc_top.
   48 #
   49 
   50 ifneq ($(findstring Libsyscall,$(RC_ProjectName)),)
   51 
   52 include $(MakeInc_cmd)
   53 include $(MakeInc_def)
   54 include $(MakeInc_rule)
   55 
   56 ifeq ($(RC_ProjectName),Libsyscall_headers_Sim)
   57 TARGET=-target Libsyscall_headers_Sim
   58 endif
   59 
   60 ifeq ($(RC_ProjectName),Libsyscall_driverkit)
   61 TARGET=-target Libsyscall_driverkit
   62 endif
   63 
   64 # default to OS X
   65 SDKROOT ?= macosx.internal
   66 
   67 default: install
   68 
   69 Libsyscall_driverkit: install
   70 
   71 .PHONY: Libsyscall_driverkit
   72 
   73 installhdrs install::
   74         cd libsyscall ; \
   75                 xcodebuild $@ $(TARGET) \
   76                         $(MAKEOVERRIDES)        \
   77                         "SRCROOT=$(SRCROOT)/libsyscall"                                 \
   78                         "OBJROOT=$(OBJROOT)"                                            \
   79                         "SYMROOT=$(SYMROOT)"                                            \
   80                         "DSTROOT=$(DSTROOT)"                                            \
   81                         "SDKROOT=$(SDKROOT)"
   82 
   83 installhdrs install:: do_unifdef_headers
   84 
   85 $(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(INCDIR),$(SINCFRAME_UNIFDEF)))
   86 $(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(LCLDIR),$(SPINCFRAME_UNIFDEF)))
   87 ifeq ($(DRIVERKIT),1)
   88 $(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(DRIVERKITINCDIR),$(DKINCFRAME_UNIFDEF)))
   89 $(eval $(call LIBSYSCALL_DO_UNIFDEF_HEADERS_RULE_template,$(DSTROOT)/$(DRIVERKITLCLDIR),$(DKPINCFRAME_UNIFDEF)))
   90 endif
   91 
   92 clean:
   93 
   94 installsrc:
   95         pax -rw . $(SRCROOT)
   96 
   97 else ifneq ($(findstring libkxld_host,$(RC_ProjectName)),)
   98 
   99 include $(MakeInc_cmd)
  100 
  101 default: install
  102 
  103 installhdrs install clean:
  104          $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE
  105 
  106 installsrc:
  107         $(_v)$(MKDIR) $(SRCROOT)
  108         $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
  109         $(_v)$(CHMOD) -R go+rX $(SRCROOT)
  110 
  111 else ifneq ($(findstring libkxld,$(RC_ProjectName)),)
  112 
  113 include $(MakeInc_cmd)
  114 
  115 default: install
  116 
  117 installhdrs install clean:
  118          $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all
  119 
  120 installsrc:
  121         $(_v)$(MKDIR) $(SRCROOT)
  122         $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
  123         $(_v)$(CHMOD) -R go+rX $(SRCROOT)
  124 
  125 else ifneq ($(findstring libkmod,$(RC_ProjectName)),)
  126 
  127 default: install
  128 
  129 installhdrs install:
  130         cd libkern/kmod ; \
  131                 xcodebuild $@   \
  132                         $(MAKEOVERRIDES)        \
  133                         "SRCROOT=$(SRCROOT)/libkern/kmod"                               \
  134                         "OBJROOT=$(OBJROOT)"                                            \
  135                         "SYMROOT=$(SYMROOT)"                                            \
  136                         "DSTROOT=$(DSTROOT)"                                            \
  137                         "SDKROOT=$(SDKROOT)"
  138 
  139 clean:
  140 
  141 installsrc:
  142         pax -rw . $(SRCROOT)
  143 
  144 else ifneq ($(findstring xnu_tests,$(RC_ProjectName)),)
  145 
  146 export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
  147 export SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
  148 MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
  149 
  150 default: install
  151 
  152 installhdrs:
  153 
  154 install: xnu_tests
  155 
  156 clean:
  157 
  158 installsrc:
  159         pax -rw . $(SRCROOT)
  160 
  161 else ifeq ($(RC_ProjectName),xnu_tests_driverkit)
  162 
  163 export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
  164 export SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
  165 MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
  166 
  167 default: install
  168 
  169 installhdrs:
  170 
  171 install: xnu_tests_driverkit
  172 
  173 clean:
  174 
  175 installsrc:
  176         pax -rw . $(SRCROOT)
  177 
  178 else # all other RC_ProjectName
  179 
  180 ifndef CURRENT_BUILD_CONFIG
  181 
  182 # avoid having to include MakeInc.cmd
  183 ifeq ($(RC_XBS),YES)
  184 _v =
  185 else ifeq ($(VERBOSE),YES)
  186 _v =
  187 else
  188 _v = @
  189 endif
  190 
  191 #
  192 # Setup for parallel sub-makes, taking into account physical and logical
  193 # CPUs. If the system does not support SMT, use N+1.
  194 # If MAKEJOBS or -jN is passed on the make line, that takes precedence.
  195 #
  196 export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
  197 export SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
  198 MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_LOGICALCPU) + 1)
  199 
  200 TOP_TARGETS = \
  201         clean \
  202         installsrc \
  203         exporthdrs \
  204         all all_desktop all_embedded \
  205         all_release_embedded all_development_embedded \
  206         installhdrs installhdrs_desktop installhdrs_embedded \
  207         installhdrs_release_embedded installhdrs_development_embedded \
  208         install install_desktop install_embedded \
  209         install_release_embedded install_development_embedded \
  210         install_kernels \
  211         cscope tags TAGS \
  212         help
  213 
  214 DEFAULT_TARGET = all
  215 
  216 # Targets for internal build system debugging
  217 TOP_TARGETS += \
  218         print_exports print_exports_first_build_config \
  219         setup \
  220         build \
  221         config \
  222         install_textfiles \
  223         install_config
  224 
  225 ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
  226 MAKEARGS += -B
  227 DEFAULT_TARGET := build
  228 endif
  229 
  230 .PHONY: $(TOP_TARGETS)
  231 
  232 default: $(DEFAULT_TARGET)
  233 
  234 ifneq ($(REMOTEBUILD),)
  235 $(TOP_TARGETS):
  236         $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(if $(filter --,$(MAKEFLAGS)),-,)$(MAKEFLAGS)
  237 else
  238 $(TOP_TARGETS):
  239         $(_v)$(MAKE) $(MAKEARGS) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@
  240 endif
  241 
  242 else # CURRENT_BUILD_CONFIG
  243 
  244 include $(MakeInc_cmd)
  245 include $(MakeInc_def)
  246 
  247 ALL_SUBDIRS = \
  248         security \
  249         bsd  \
  250         iokit \
  251         osfmk \
  252         pexpert \
  253         libkern \
  254         libsa \
  255         config \
  256         san
  257 
  258 CONFIG_SUBDIRS = config tools san
  259 # Hack to handle san external dependency on config_all allsymbols target
  260 config_all_recurse_into_san: config_all_recurse_into_config
  261 
  262 INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS
  263 INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS)
  264 INSTINC_SUBDIRS_X86_64H = $(INSTINC_SUBDIRS)
  265 INSTINC_SUBDIRS_ARM = $(INSTINC_SUBDIRS)
  266 INSTINC_SUBDIRS_ARM64 = $(INSTINC_SUBDIRS)
  267 
  268 EXPINC_SUBDIRS = $(ALL_SUBDIRS)
  269 EXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS)
  270 EXPINC_SUBDIRS_X86_64H = $(EXPINC_SUBDIRS)
  271 EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS)
  272 EXPINC_SUBDIRS_ARM64 = $(EXPINC_SUBDIRS)
  273 
  274 SETUP_SUBDIRS = SETUP san bsd
  275 
  276 COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS)
  277 COMP_SUBDIRS_X86_64H = $(ALL_SUBDIRS)
  278 COMP_SUBDIRS_ARM = $(ALL_SUBDIRS)
  279 COMP_SUBDIRS_ARM64 = $(ALL_SUBDIRS)
  280 
  281 INSTTEXTFILES_SUBDIRS = \
  282         bsd
  283 INSTTEXTFILES_SUBDIRS_X86_64 = $(INSTTEXTFILES_SUBDIRS)
  284 INSTTEXTFILES_SUBDIRS_X86_64H = $(INSTTEXTFILES_SUBDIRS)
  285 INSTTEXTFILES_SUBDIRS_ARM = $(INSTTEXTFILES_SUBDIRS)
  286 INSTTEXTFILES_SUBDIRS_ARM64 = $(INSTTEXTFILES_SUBDIRS)
  287 
  288 include $(MakeInc_kernel)
  289 include $(MakeInc_rule)
  290 include $(MakeInc_dir)
  291 
  292 endif # CURRENT_BUILD_CONFIG
  293 
  294 endif # all other RC_ProjectName
  295 
  296 installapi_libkdd installhdrs_libkdd install_libkdd:
  297         cd libkdd; \
  298                 xcodebuild -target Default $(subst _libkdd,,$@) \
  299                         $(MAKEOVERRIDES)        \
  300                         "SRCROOT=$(SRCROOT)/libkdd"             \
  301                         "OBJROOT=$(OBJROOT)"                    \
  302                         "SYMROOT=$(SYMROOT)"                    \
  303                         "DSTROOT=$(DSTROOT)"                    \
  304                         "SDKROOT=$(SDKROOT)"
  305 
  306 
  307 installapi_libkdd_tests installhdrs_libkdd_tests install_libkdd_tests:
  308         cd libkdd; \
  309                 xcodebuild -target tests $(subst _libkdd_tests,,$@)     \
  310                         $(MAKEOVERRIDES)        \
  311                         "SRCROOT=$(SRCROOT)/libkdd"             \
  312                         "OBJROOT=$(OBJROOT)"                    \
  313                         "SYMROOT=$(SYMROOT)"                    \
  314                         "DSTROOT=$(DSTROOT)"                    \
  315                         "SDKROOT=$(SDKROOT)"
  316 
  317 
  318 installapi_libkdd_host installhdrs_libkdd_host install_libkdd_host:
  319         cd libkdd; \
  320                 xcodebuild -configuration ReleaseHost -target kdd.framework $(subst _libkdd_host,,$@)   \
  321                         $(MAKEOVERRIDES)        \
  322                         "SRCROOT=$(SRCROOT)/libkdd"             \
  323                         "OBJROOT=$(OBJROOT)"                    \
  324                         "SYMROOT=$(SYMROOT)"                    \
  325                         "DSTROOT=$(DSTROOT)"                    \
  326                         "SDKROOT=$(SDKROOT)"
  327 
  328 
  329 # "xnu_tests" and "testbots" are targets that can be invoked via a standalone
  330 # "make xnu_tests" or via buildit/XBS with the RC_ProjectName=xnu_tests.
  331 # Define the target here in the outermost scope of the initial Makefile
  332 
  333 xnu_tests:
  334         $(MAKE) -C $(SRCROOT)/tools/tests       $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
  335                 SRCROOT=$(SRCROOT)/tools/tests
  336         $(MAKE) -C $(SRCROOT)/tests     $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
  337                 SRCROOT=$(SRCROOT)/tests
  338 
  339 xnu_tests_driverkit:
  340         $(MAKE) -C $(SRCROOT)/tests/driverkit $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
  341                 SRCROOT=$(SRCROOT)/tests/driverkit
  342 
  343 
  344 include $(MakeInc_cmd)
  345 
  346 #
  347 # The "analyze" target defined below invokes Clang Static Analyzer
  348 # with a predefined set of checks and options for the project.
  349 #
  350 
  351 # By default, analysis results are available in BUILD/StaticAnalyzer.
  352 # Set this variable in your make invocation to use a different directory.
  353 # Note that these results are only deleted when the build directory
  354 # is cleaned. They aren't deleted every time the analyzer is re-run,
  355 # but they are deleted after "make clean".
  356 STATIC_ANALYZER_OUTPUT_DIR ?= $(SRCROOT)/BUILD/StaticAnalyzer
  357 
  358 # By default, the default make target is analyzed. You can analyze
  359 # other targets by setting this variable in your make invocation.
  360 STATIC_ANALYZER_TARGET ?=
  361 
  362 # You can pass additional flags to scan-build by setting this variable
  363 # in your make invocation. For example, you can enable additional checks.
  364 STATIC_ANALYZER_EXTRA_FLAGS ?=
  365 
  366 analyze:
  367 # This is where the reports are going to be available.
  368 # Old reports are deleted on make clean only.
  369         $(_v)$(MKDIR) $(STATIC_ANALYZER_OUTPUT_DIR)
  370 
  371 # Recursively build the requested target under scan-build.
  372 # Exclude checks that weren't deemed to be security critical,
  373 # like null pointer dereferences.
  374         $(_v)$(XCRUN) $(SCAN_BUILD) -o $(STATIC_ANALYZER_OUTPUT_DIR) \
  375                 -disable-checker deadcode.DeadStores \
  376                 -disable-checker core.NullDereference \
  377                 -disable-checker core.DivideZero \
  378                 --exclude BUILD \
  379                 $(STATIC_ANALYZER_EXTRA_FLAGS) \
  380                 $(MAKE) $(STATIC_ANALYZER_TARGET) QUIET=1 2>&1 | $(GREP) "^scan-build:"
  381 
  382 .PHONY: analyze

Cache object: 54934f43b77867fcccb1788c357ef15d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.