]> git.saurik.com Git - apple/xnu.git/blobdiff - Makefile
xnu-4903.221.2.tar.gz
[apple/xnu.git] / Makefile
index 7fbedaceba696afbb7d5181e920fd920459ad773..31de51ae8358fb8ee3b1b35d7c52f4b991736181 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
 #
-# Copyright (C) 1999-2013 Apple Inc. All rights reserved.
+# Copyright (C) 1999-2016 Apple Inc. All rights reserved.
 #
-
 ifndef VERSDIR
 export VERSDIR := $(shell /bin/pwd)
 endif
@@ -39,12 +38,15 @@ endif
 
 default: install
 
+# default to OS X
+SDKROOT ?= macosx.internal
+
 installhdrs install:
        cd libsyscall ; \
                xcodebuild $@ $(TARGET) \
                        "SRCROOT=$(SRCROOT)/libsyscall"                                 \
-                       "OBJROOT=$(OBJROOT)"                                            \
-                       "SYMROOT=$(SYMROOT)"                                            \
+                       "OBJROOT=$(OBJROOT)"                                            \
+                       "SYMROOT=$(SYMROOT)"                                            \
                        "DSTROOT=$(DSTROOT)"                                            \
                        "SDKROOT=$(SDKROOT)"
 
@@ -87,10 +89,10 @@ default: install
 
 installhdrs install:
        cd libkern/kmod ; \
-               xcodebuild $@   \
+               xcodebuild $@   \
                        "SRCROOT=$(SRCROOT)/libkern/kmod"                               \
-                       "OBJROOT=$(OBJROOT)"                                            \
-                       "SYMROOT=$(SYMROOT)"                                            \
+                       "OBJROOT=$(OBJROOT)"                                            \
+                       "SYMROOT=$(SYMROOT)"                                            \
                        "DSTROOT=$(DSTROOT)"                                            \
                        "SDKROOT=$(SDKROOT)"
 
@@ -99,13 +101,21 @@ clean:
 installsrc:
        pax -rw . $(SRCROOT)
 
-else ifeq ($(RC_ProjectName),xnu_quick_test)
+else ifeq ($(RC_ProjectName),xnu_tests)
+
+export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu)
+export SYSCTL_HW_LOGICALCPU  := $(shell /usr/sbin/sysctl -n hw.logicalcpu)
+ifeq ($(SYSCTL_HW_PHYSICALCPU),$(SYSCTL_HW_LOGICALCPU))
+MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_PHYSICALCPU) + 1)
+else
+MAKEJOBS := --jobs=$(SYSCTL_HW_LOGICALCPU)
+endif
 
 default: install
 
 installhdrs:
 
-install: xnu_quick_test
+install: xnu_tests
 
 clean:
 
@@ -138,26 +148,26 @@ else
 MAKEJOBS := --jobs=$(SYSCTL_HW_LOGICALCPU)
 endif
 
-TOP_TARGETS =                                                          \
-       clean                                                           \
-       installsrc                                                      \
-       exporthdrs                                                      \
+TOP_TARGETS =                                                          \
+       clean                                                           \
+       installsrc                                                      \
+       exporthdrs                                                      \
        all all_desktop all_embedded                                    \
-       all_release_embedded all_development_embedded                   \
-       installhdrs installhdrs_desktop installhdrs_embedded            \
-       installhdrs_release_embedded installhdrs_development_embedded   \
-       install install_desktop install_embedded                        \
-       install_release_embedded install_development_embedded           \
-       installopensource                                               \
+       all_release_embedded all_development_embedded                   \
+       installhdrs installhdrs_desktop installhdrs_embedded            \
+       installhdrs_release_embedded installhdrs_development_embedded   \
+       install install_desktop install_embedded                        \
+       install_release_embedded install_development_embedded           \
+       installopensource                                               \
        cscope tags TAGS reindent                                       \
        help
 
 DEFAULT_TARGET = all
 
 # Targets for internal build system debugging
-TOP_TARGETS +=                                                 \
+TOP_TARGETS +=                                         \
        print_exports print_exports_first_build_config  \
-       setup                                           \
+       setup                                           \
        build                                           \
        config                                          \
        install_textfiles                               \
@@ -186,16 +196,17 @@ include $(MakeInc_cmd)
 include $(MakeInc_def)
 
 ALL_SUBDIRS = \
+       security \
        bsd  \
        iokit \
        osfmk \
        pexpert \
        libkern \
        libsa \
-       security \
-       config
+       config \
+       san
 
-CONFIG_SUBDIRS = config tools
+CONFIG_SUBDIRS = config tools san
 
 INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS
 INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS)
@@ -209,7 +220,7 @@ EXPINC_SUBDIRS_X86_64H = $(EXPINC_SUBDIRS)
 EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS)
 EXPINC_SUBDIRS_ARM64 = $(EXPINC_SUBDIRS)
 
-SETUP_SUBDIRS = SETUP
+SETUP_SUBDIRS = SETUP osfmk san
 
 COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS)
 COMP_SUBDIRS_X86_64H = $(ALL_SUBDIRS)
@@ -227,28 +238,42 @@ endif # CURRENT_BUILD_CONFIG
 
 endif # all other RC_ProjectName
 
-installhdrs_libkdd install_libkdd:
+installapi_libkdd installhdrs_libkdd install_libkdd:
        cd libkdd; \
-               xcodebuild $(subst _libkdd,,$@)         \
+               xcodebuild -target Default $(subst _libkdd,,$@) \
                        "SRCROOT=$(SRCROOT)/libkdd"             \
-                       "OBJROOT=$(OBJROOT)"                    \
-                       "SYMROOT=$(SYMROOT)"                    \
+                       "OBJROOT=$(OBJROOT)"                    \
+                       "SYMROOT=$(SYMROOT)"                    \
                        "DSTROOT=$(DSTROOT)"                    \
                        "SDKROOT=$(SDKROOT)"
 
 
-# "xnu_quick_test" and "testbots" are targets that can be invoked via a standalone
-# "make xnu_quick_test" or via buildit/XBS with the RC_ProjectName=xnu_quick_test.
+installapi_libkdd_tests installhdrs_libkdd_tests install_libkdd_tests:
+       cd libkdd; \
+               xcodebuild -target tests $(subst _libkdd_tests,,$@)     \
+                       "SRCROOT=$(SRCROOT)/libkdd"             \
+                       "OBJROOT=$(OBJROOT)"                    \
+                       "SYMROOT=$(SYMROOT)"                    \
+                       "DSTROOT=$(DSTROOT)"                    \
+                       "SDKROOT=$(SDKROOT)"
+
+
+installapi_libkdd_host installhdrs_libkdd_host install_libkdd_host:
+       cd libkdd; \
+               xcodebuild -configuration ReleaseHost -target kdd.framework $(subst _libkdd_host,,$@)   \
+                       "SRCROOT=$(SRCROOT)/libkdd"             \
+                       "OBJROOT=$(OBJROOT)"                    \
+                       "SYMROOT=$(SYMROOT)"                    \
+                       "DSTROOT=$(DSTROOT)"                    \
+                       "SDKROOT=$(SDKROOT)"
+
+
+# "xnu_tests" and "testbots" are targets that can be invoked via a standalone
+# "make xnu_tests" or via buildit/XBS with the RC_ProjectName=xnu_tests.
 # Define the target here in the outermost scope of the initial Makefile
 
-xnu_quick_test:
-       $(MAKE) -C $(SRCROOT)/tools/tests                                       \
+xnu_tests:
+       $(MAKE) -C $(SRCROOT)/tools/tests       $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
                SRCROOT=$(SRCROOT)/tools/tests
-
-# This target is defined to compile and run xnu_quick_test under testbots
-testbots:
-       $(MAKE) -C $(SRCROOT)/tools/tests/xnu_quick_test                        \
-               SRCROOT=$(SRCROOT)/tools/tests/xnu_quick_test                   \
-               MORECFLAGS="-DRUN_UNDER_TESTBOTS=1"                             \
-               MAKE=$(MAKE)                                                    \
-               testbots
+       $(MAKE) -C $(SRCROOT)/tests     $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) \
+               SRCROOT=$(SRCROOT)/tests