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/makedefs/MakeInc.dir

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 # Install kernel header files
    3 #
    4 .PHONY: installhdrs
    5 
    6 ifeq ($(RC_ProjectName),Libsyscall)
    7 installhdrs:
    8         cd libsyscall ; \
    9                 sdk="$(SDKROOT)" ;                                                              \
   10                 if [ $${sdk} = / ] ; then                                               \
   11                         sdk="" ;                                                                        \
   12                 fi;                                                                                             \
   13                 xcrun -sdk "$(SDKROOT)" xcodebuild installhdrs  \
   14                         "SRCROOT=$(SRCROOT)/libsyscall"                                 \
   15                         "OBJROOT=$(OBJROOT)"                                            \
   16                         "SYMROOT=$(SYMROOT)"                                            \
   17                         "DSTROOT=$(DSTROOT)"                                            \
   18                         "SDKROOT=$${sdk}"
   19 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
   20 installhdrs:
   21         make -C libkern/kxld/ installhdrs
   22 else # xnu, xnu_debug, or xnu_headers_Sim
   23 installhdrs: exporthdrs installhdrs_mi installhdrs_md 
   24         @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"
   25         $(_v)kincpath=$(DSTROOT)/$(KINCDIR);                                    \
   26         krespath=$(DSTROOT)/$(KRESDIR);                                 \
   27         kframepath=$(DSTROOT)/$(KINCFRAME);                             \
   28         [ -d $$krespath ] || $(MKDIR) $$krespath;                       \
   29         [ -d $$kincpath ] || $(MKDIR) $$kincpath;                       \
   30         cd $(SRCROOT)/EXTERNAL_HEADERS;                                 \
   31                 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath;    \
   32                 $(NEWVERS) $${krespath}/Info.plist;     \
   33         cd $$kframepath/Versions;                                       \
   34             [ -L Current ] || $(LN) $(KINCVERS) Current;                \
   35         cd $$kframepath;                                                \
   36             [ -L Headers ] || $(LN) Versions/Current/Headers Headers;   \
   37             [ -L Resources ] || $(LN) Versions/Current/Resources Resources;     \
   38         [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR);       \
   39         cd $$kframepath; [ -L PrivateHeaders ] ||                       \
   40             $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
   41 ifeq ($(RC_ProjectName),xnu_headers_Sim)
   42         @echo "[ $(SRCROOT) ] make installhdrs installing System.framework"
   43         $(_v)spincpath=$(DSTROOT)/$(SPINCDIR);                          \
   44         sframepath=$(DSTROOT)/$(SINCFRAME);                             \
   45         [ -d $$spincpath ] || $(MKDIR) $$spincpath;                     \
   46         cd $$sframepath/Versions;                                       \
   47             [ -L Current ] || $(LN) $(SINCVERS) Current;                \
   48         cd $$sframepath; [ -L PrivateHeaders ] ||                       \
   49             $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
   50 endif
   51 ifeq (iPhoneOS,$(PLATFORM))
   52         $(_v)$(IPHONEOS_OPTIMIZE) $(DSTROOT)/$(KRESDIR)/Info.plist
   53 endif
   54 endif
   55 
   56 #
   57 # Install header files order
   58 #
   59 .ORDER: installhdrs_mi installhdrs_md
   60 .PHONY: installhdrs_mi installhdrs_md
   61 
   62 #
   63 # Install machine independent header files
   64 #
   65 installhdrs_mi:
   66         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));         \
   67         kernel_config=$(INSTALL_TYPE);                                  \
   68         machine_config=$(MACHINE_CONFIG);                               \
   69         arch_config=$(INSTALL_ARCH_DEFAULT);                            \
   70         if [ $${arch_config} = ARM ] ; then                             \
   71                 if [ $${machine_config} = DEFAULT ] ; then              \
   72                         machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);   \
   73                 fi;                                                     \
   74         fi;                                                             \
   75         if [ $${machine_config} = DEFAULT ] ; then                      \
   76                 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};       \
   77         else                                                            \
   78                 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path};    \
   79         fi;                                                             \
   80         [ -d $${installinc_dir} ] || $(MKDIR) $${installinc_dir};       \
   81         ${MAKE} ${MAKEJOBS} -C $${installinc_dir}                       \
   82                 KERNEL_CONFIG=$${kernel_config}                         \
   83                 ARCH_CONFIG=$${arch_config}                             \
   84                 MAKEFILES=${SOURCE}/Makefile                            \
   85                 SOURCE=${SOURCE}/                                       \
   86                 TARGET=$${installinc_dir}/                              \
   87                 build_installhdrs_mi;                                   \
   88 
   89 #
   90 # Install machine dependent kernel header files 
   91 #
   92 installhdrs_md:
   93         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));                 \
   94         kernel_config=$(INSTALL_TYPE);                                  \
   95         machine_config=$(MACHINE_CONFIG);               \
   96         for arch_config in $(INSTALL_ARCHS);                            \
   97         do                                                              \
   98         if [ $${arch_config} = ARM ] ; then     \
   99                 if [ $${machine_config} = DEFAULT ] ; then      \
  100                         machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);           \
  101                 fi;             \
  102         fi;             \
  103         if [ $${machine_config} = DEFAULT ] ; then      \
  104                 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};       \
  105         else            \
  106                 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path};    \
  107         fi;             \
  108         [ -d $${installinc_dir} ] || $(MKDIR) $${installinc_dir};       \
  109         ${MAKE} ${MAKEJOBS} -C $${installinc_dir}                       \
  110                 KERNEL_CONFIG=$${kernel_config}                         \
  111                 ARCH_CONFIG=$${arch_config}                             \
  112                 MAKEFILES=${SOURCE}/Makefile                            \
  113                 SOURCE=${SOURCE}/                                       \
  114                 TARGET=$${installinc_dir}/                              \
  115                 build_installhdrs_md;                                   \
  116         done;
  117 
  118 #
  119 # Install machine independent kernel header files 
  120 #
  121 do_installhdrs_mi:
  122 
  123 BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_installhdrs_mi_,$(INSTINC_SUBDIRS))
  124 
  125 .PHONY: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
  126 
  127 $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS):
  128         $(_v)installinc_subdir="$(patsubst build_installhdrs_mi_%,%,$@)";       \
  129         [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir};         \
  130         ${MAKE} -C $${installinc_subdir}                                        \
  131                 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile               \
  132                 SOURCE=$(SOURCE)$${installinc_subdir}/                          \
  133                 TARGET=$(TARGET)$${installinc_subdir}/                          \
  134                 build_installhdrs_mi;
  135 
  136 build_installhdrs_mi: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
  137         $(_v)${MAKE} do_installhdrs_mi;
  138 
  139 #
  140 # Install machine dependent kernel header files 
  141 #
  142 do_installhdrs_md:
  143 
  144 BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_installhdrs_md_,$($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))))
  145 
  146 .PHONY: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
  147 
  148 $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS):
  149         $(_v)installinc_subdir="$(patsubst build_installhdrs_md_%,%,$@)";       \
  150         [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir};         \
  151         ${MAKE} -C $${installinc_subdir}                                        \
  152                 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile               \
  153                 SOURCE=$(SOURCE)$${installinc_subdir}/                          \
  154                 TARGET=$(TARGET)$${installinc_subdir}/                          \
  155                 build_installhdrs_md;
  156 
  157 build_installhdrs_md: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
  158         $(_v)${MAKE} do_installhdrs_md;
  159 
  160 #
  161 # Install kernel header files
  162 #
  163 .PHONY: exporthdrs
  164 
  165 exporthdrs: exporthdrs_mi exporthdrs_md 
  166 
  167 #
  168 # Install header files order
  169 #
  170 .ORDER: exporthdrs_mi exporthdrs_md
  171 .PHONY: exporthdrs_mi exporthdrs_md
  172 
  173 #
  174 # Install machine independent header files
  175 #
  176 do_exporthdrs_mi:
  177 
  178 exporthdrs_mi:
  179         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));         \
  180         kernel_config=$(INSTALL_TYPE);                                  \
  181         machine_config=$(MACHINE_CONFIG);                               \
  182         arch_config=$(INSTALL_ARCH_DEFAULT);                            \
  183         if [ $${arch_config} = ARM ] ; then                             \
  184                 if [ $${machine_config} = DEFAULT ] ; then              \
  185                         machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);   \
  186                 fi;                                                     \
  187         fi;                                                             \
  188         if [ $${machine_config} = DEFAULT ] ; then                      \
  189                 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};        \
  190         else                                                            \
  191                 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path};     \
  192         fi;                                                             \
  193         [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir};         \
  194         ${MAKE} ${MAKEJOBS} -C $${exportinc_dir}                        \
  195                 KERNEL_CONFIG=$${kernel_config}                         \
  196                 ARCH_CONFIG=$${arch_config}                             \
  197                 MAKEFILES=${SOURCE}/Makefile                            \
  198                 SOURCE=${SOURCE}/                                       \
  199                 TARGET=$${exportinc_dir}/                               \
  200                 build_exporthdrs_mi;                                    \
  201 
  202 #
  203 # Install machine dependent kernel header files 
  204 #
  205 # Note - installation of machine dependent kernel header files only occurs for architecture
  206 # defined in INSTALL_TYPE.  We use skipit variable to skip over architectures that are not
  207 # equal to what is in the INSTALL_TYPE variable.
  208 # TARGET_CONFIGS_UC variable holds sets of three configuration options.  The first item in the
  209 # set is the kernel configuration.  The second item in the set is the architecture and the 
  210 # third item is the machine configuration.  There may be multiple sets to build.
  211 exporthdrs_md:
  212         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));                 \
  213         my_counter=1;           \
  214         for my_config in $(TARGET_CONFIGS_UC);                          \
  215         do              \
  216         if [ $${my_counter} -eq 1 ] ; then      \
  217                 skipit=0;                       \
  218                 my_counter=2;           \
  219                 kernel_config=$${my_config};            \
  220                 if [ $${kernel_config} = DEFAULT ] ; then       \
  221                         kernel_config=$(DEFAULT_KERNEL_CONFIG);         \
  222                 fi;             \
  223                 if [ $${kernel_config} != $(INSTALL_TYPE) ] ; then      \
  224                         skipit=1;       \
  225                 fi;             \
  226         elif [ $${my_counter} -eq 2 ] ; then    \
  227                 my_counter=3;           \
  228                 arch_config=$${my_config};              \
  229                 if [ $${arch_config} = DEFAULT ] ; then \
  230                         arch_config=`arch | $(TR) a-z A-Z`;             \
  231                 fi;             \
  232         else            \
  233                 my_counter=1;           \
  234                 machine_config=$${my_config};           \
  235                 if [ $${skipit} -eq 0 ] ; then  \
  236                         if [ $${arch_config} = ARM ] ; then     \
  237                                 if [ $${machine_config} = DEFAULT ] ; then      \
  238                                         machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);           \
  239                                 fi;             \
  240                         fi;             \
  241                         if [ $${machine_config} = DEFAULT ] ; then      \
  242                                 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};        \
  243                         else            \
  244                                 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path};     \
  245                         fi;             \
  246                         [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir};                                 \
  247                         ${MAKE} ${MAKEJOBS} -C $${exportinc_dir}                        \
  248                                 KERNEL_CONFIG=$${kernel_config}                         \
  249                                 ARCH_CONFIG=$${arch_config}                             \
  250                                 MAKEFILES=${SOURCE}/Makefile                            \
  251                                 SOURCE=${SOURCE}/                                       \
  252                                 TARGET=$${exportinc_dir}/                               \
  253                                 build_exporthdrs_md;                                    \
  254                 fi;             \
  255         fi;             \
  256         done;
  257 
  258 #
  259 # Install machine independent kernel header files 
  260 #
  261 do_exporthdrs_mi:
  262 
  263 BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_mi_,$(EXPINC_SUBDIRS))
  264 
  265 .PHONY: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
  266 
  267 $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS):
  268         $(_v)exportinc_subdir="$(patsubst build_exporthdrs_mi_%,%,$@)";         \
  269         [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir};           \
  270         ${MAKE} -C $${exportinc_subdir}                                         \
  271                 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile                \
  272                 SOURCE=$(SOURCE)$${exportinc_subdir}/                           \
  273                 TARGET=$(TARGET)$${exportinc_subdir}/                           \
  274                 build_exporthdrs_mi;
  275 
  276 build_exporthdrs_mi: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
  277         $(_v)${MAKE} do_exporthdrs_mi;
  278 
  279 #
  280 # Install machine dependent kernel header files 
  281 #
  282 do_exporthdrs_md:
  283 
  284 BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_md_,$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))))
  285 
  286 .PHONY: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
  287 
  288 $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS):
  289         $(_v)exportinc_subdir="$(patsubst build_exporthdrs_md_%,%,$@)";         \
  290         [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir};           \
  291         ${MAKE} -C $${exportinc_subdir}                                         \
  292                 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile                \
  293                 SOURCE=$(SOURCE)$${exportinc_subdir}/                           \
  294                 TARGET=$(TARGET)$${exportinc_subdir}/                           \
  295                 build_exporthdrs_md;
  296 
  297 build_exporthdrs_md: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
  298         $(_v)${MAKE} do_exporthdrs_md;
  299 
  300 #
  301 # Setup pass for  all architectures for all Configuration/Architecture options
  302 #
  303 .PHONY: setup
  304 
  305 setup:
  306         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));         \
  307         kernel_config=$(INSTALL_TYPE);                                  \
  308         arch_config=$(INSTALL_ARCH_DEFAULT);                            \
  309         setup_subdir=${OBJROOT}/$${rel_path};                           \
  310         [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir};           \
  311         ${MAKE} ${MAKEJOBS} -C $${setup_subdir}                         \
  312                 KERNEL_CONFIG=$${kernel_config}                         \
  313                 ARCH_CONFIG=$${arch_config}                             \
  314                 MAKEFILES=${SOURCE}/Makefile                            \
  315                 SOURCE=${SOURCE}/                                       \
  316                 TARGET=$${setup_subdir}/                                \
  317         build_setup;
  318 
  319 do_build_setup:
  320 
  321 BUILD_SETUP_SUBDIRS_TARGETS = $(addprefix build_setup_,$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))))
  322 
  323 .PHONY: $(BUILD_SETUP_SUBDIRS_TARGETS)
  324 
  325 $(BUILD_SETUP_SUBDIRS_TARGETS):
  326         $(_v)setup_subdir="$(patsubst build_setup_%,%,$@)";     \
  327         [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir};   \
  328         ${MAKE} -C $${setup_subdir}                             \
  329                 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile   \
  330                 SOURCE=${SOURCE}/$${setup_subdir}/              \
  331                 TARGET=${TARGET}/$${setup_subdir}/              \
  332                 build_setup;
  333 
  334 build_setup: $(BUILD_SETUP_SUBDIRS_TARGETS)
  335         $(_v)${MAKE} do_build_setup;
  336 
  337 
  338 #
  339 # Build all architectures for all Configuration/Architecture options
  340 #
  341 # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options.  The first 
  342 # item in the set is the kernel configuration.  The second item in the set is the architecture  
  343 # and the third item is the machine configuration.  There may be multiple sets to build.
  344 #
  345 .PHONY: all
  346 
  347 ifeq ($(RC_ProjectName),Libsyscall)
  348 all:
  349         cd libsyscall ; \
  350                 sdk="$(SDKROOT)" ;                                                              \
  351                 if [ $${sdk} = / ] ; then                                               \
  352                         sdk="" ;                                                                        \
  353                 fi;                                                                                             \
  354                 xcrun -sdk "$(SDKROOT)" xcodebuild install              \
  355                         "SRCROOT=$(SRCROOT)/libsyscall"                                 \
  356                         "OBJROOT=$(OBJROOT)"                                            \
  357                         "SYMROOT=$(SYMROOT)"                                            \
  358                         "DSTROOT=$(DSTROOT)"                                            \
  359                         "SDKROOT=$${sdk}"
  360 else ifeq ($(RC_ProjectName),libkxld)
  361 all:
  362         make -C libkern/kxld/ install
  363 else ifeq ($(RC_ProjectName),libkxld_host)
  364 all:
  365         make -C libkern/kxld/ install PRODUCT_TYPE=ARCHIVE
  366 else ifeq ($(RC_ProjectName),xnu_headers_Sim)
  367 all: exporthdrs
  368 else # xnu or xnu_debug
  369 ifeq ($(COMPONENT), .)
  370 all: exporthdrs setup
  371 else
  372 all:
  373 endif
  374         $(_v)my_counter=1;              \
  375         for my_config in $(TARGET_CONFIGS_UC);                          \
  376         do              \
  377         if [ $${my_counter} -eq 1 ] ; then      \
  378                 my_counter=2;           \
  379                 kernel_config=$${my_config};            \
  380                 if [ $${kernel_config} = DEFAULT ] ; then       \
  381                         kernel_config=$(DEFAULT_KERNEL_CONFIG);         \
  382                 fi;             \
  383         elif [ $${my_counter} -eq 2 ] ; then    \
  384                 my_counter=3;           \
  385                 arch_config=$${my_config};              \
  386                 if [ $${arch_config} = DEFAULT ] ; then \
  387                         arch_config=`arch | $(TR) a-z A-Z`;             \
  388                 fi;             \
  389         else            \
  390                 my_counter=1;           \
  391                 machine_config=$${my_config};           \
  392                 if [ $${arch_config} = ARM ] ; then     \
  393                         if [ $${machine_config} = DEFAULT ] ; then      \
  394                                 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);           \
  395                         fi;             \
  396                 fi;             \
  397                 if [ $${machine_config} = DEFAULT ] ; then      \
  398                         build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
  399                 else            \
  400                         build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
  401                 fi;             \
  402                 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir};                                   \
  403                         ${MAKE} ${MAKEJOBS} -C $${build_subdir}                         \
  404                                 KERNEL_CONFIG=$${kernel_config}                         \
  405                                 ARCH_CONFIG=$${arch_config}                             \
  406                                 MACHINE_CONFIG=$${machine_config}                       \
  407                                 MAKEFILES=${SOURCE}/Makefile                            \
  408                                 SOURCE=${SOURCE}/                                       \
  409                                 build_all;                                              \
  410         fi;             \
  411         done;
  412 endif
  413 
  414 #
  415 # Build all architectures for all Configuration/Architecture options
  416 #
  417 do_build_all:
  418 
  419 BUILD_ALL_SUBDIRS_TARGETS = $(addprefix build_all_,$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))))
  420 
  421 .PHONY: $(BUILD_ALL_SUBDIRS_TARGETS)
  422 
  423 $(BUILD_ALL_SUBDIRS_TARGETS):
  424         $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then  \
  425                 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
  426         else            \
  427                 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)";     \
  428         fi;             \
  429         comp_subdir="$(patsubst build_all_%,%,$@)";             \
  430         [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir};     \
  431         ${MAKE} -C $${comp_subdir}                              \
  432                 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile    \
  433                 SOURCE=${SOURCE}$${comp_subdir}/                \
  434                 TARGET=$${TARGET}                               \
  435                 build_all;
  436 
  437 build_all: $(BUILD_ALL_SUBDIRS_TARGETS)
  438         $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then  \
  439                 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
  440         else            \
  441                 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)";     \
  442         fi;             \
  443         ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;       \
  444         _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))";   \
  445         for comp_subdir in $${_TMP_comp_subdir};                        \
  446         do                                                              \
  447                 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir};                             \
  448                 ${MAKE} -C $${comp_subdir}                              \
  449                         MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile    \
  450                         SOURCE=${SOURCE}$${comp_subdir}/                \
  451                         TARGET=$${TARGET}                               \
  452                 build_all;                                              \
  453         done;                                                           
  454         
  455 
  456 #
  457 # Build all architectures for all Configuration/Architecture options
  458 #
  459 # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options.  The first 
  460 # item in the set is the kernel configuration.  The second item is the architecture  
  461 # and the third item is the machine configuration.  There may be multiple sets to build.
  462 #
  463 mach_kernel:
  464         $(_v)my_counter=1;              \
  465         for my_config in $(TARGET_CONFIGS_UC);                          \
  466         do              \
  467         if [ $${my_counter} -eq 1 ] ; then      \
  468                 my_counter=2;           \
  469                 kernel_config=$${my_config};            \
  470                 if [ $${kernel_config} = DEFAULT ] ; then       \
  471                         kernel_config=$(DEFAULT_KERNEL_CONFIG);         \
  472                 fi;             \
  473         elif [ $${my_counter} -eq 2 ] ; then    \
  474                 my_counter=3;           \
  475                 arch_config=$${my_config};              \
  476                 if [ $${arch_config} = DEFAULT ] ; then \
  477                         arch_config=`arch | $(TR) a-z A-Z`;             \
  478                 fi;             \
  479         else            \
  480                 my_counter=1;           \
  481                 machine_config=$${my_config};           \
  482                 if [ $${arch_config} = ARM ] ; then     \
  483                         if [ $${machine_config} = DEFAULT ] ; then      \
  484                                 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);           \
  485                         fi;             \
  486                 fi;             \
  487                 if [ $${machine_config} = DEFAULT ] ; then      \
  488                         build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config};      \
  489                 else            \
  490                         build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config};   \
  491                 fi;             \
  492                 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir};                                   \
  493                 ${MAKE} ${MAKEJOBS} -C $${build_subdir}                                 \
  494                         KERNEL_CONFIG=$${kernel_config}                         \
  495                         ARCH_CONFIG=$${arch_config}                             \
  496                         MACHINE_CONFIG=$${machine_config}                       \
  497                         MAKEFILES=${SOURCE}/Makefile                            \
  498                         SOURCE=${SOURCE}/                                       \
  499                         TARGET=$${build_subdir}/                                \
  500                         build_mach_kernel;                                      \
  501         fi;             \
  502         done;
  503 
  504 #
  505 # Build all architectures for all Configuration/Architecture options
  506 #
  507 do_build_mach_kernel:
  508 
  509 build_mach_kernel: 
  510         $(_v)${MAKE} do_build_mach_kernel;
  511 
  512 
  513 #
  514 #
  515 # Install dependencies order
  516 #
  517 .ORDER: installhdrs exporthdrs all
  518 
  519 #
  520 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
  521 # Install kernel header files based on RC_ARCHS
  522 #
  523 install: installhdrs all installman installmachinekernels
  524 ifeq ($(RC_ProjectName),Libsyscall)
  525 # nothing to do
  526 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
  527 # nothing to do, work performed in "all" action
  528 else ifeq ($(RC_ProjectName),xnu_headers_Sim)
  529 # nothing to do
  530 else # xnu or xnu_debug
  531         $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));                 \
  532         machine_config=$(MACHINE_CONFIG);               \
  533         for kernel_config in $(INSTALL_TYPE);                           \
  534         do                                                              \
  535         for arch_config in $(INSTALL_ARCHS);                            \
  536         do                                                              \
  537         if [ $${arch_config} = ARM ] ; then     \
  538                 if [ $${machine_config} = DEFAULT ] ; then      \
  539                         machine_config=$(DEFAULT_ARM_MACHINE_CONFIG);           \
  540                 fi;             \
  541         fi;             \
  542         if [ $${machine_config} = DEFAULT ] ; then      \
  543                 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};       \
  544         else            \
  545                 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path};    \
  546         fi;             \
  547         [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir};                                       \
  548         ${MAKE} ${MAKEJOBS} -C $${install_subdir}                       \
  549                 KERNEL_CONFIG=$${kernel_config}                         \
  550                 ARCH_CONFIG=$${arch_config}                             \
  551                 MACHINE_CONFIG=$${machine_config}                       \
  552                 MAKEFILES=${SOURCE}/Makefile                            \
  553                 SOURCE=${SOURCE}/                                       \
  554                 build_install;                                          \
  555         done;                                                           \
  556         done;
  557 ifeq ($(RC_ProjectName),xnu_debug)
  558         $(_v)$(MKDIR) $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  559         $(_v)$(MV) $(DSTROOT)/mach_kernel* $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  560         $(_v)$(CP) $(SYMROOT)/kgmacros $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  561         $(_v)$(CP) -r $(SYMROOT)/System.kext $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  562         $(_v)$(CP) -r $(SYMROOT)/mach_kernel.dSYM $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  563         $(_v)$(CP) $(SRCROOT)/config/README.DEBUG-kernel.txt $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
  564         $(_v)$(MV) $(DSTROOT)/System $(DSTROOT)/usr $(OBJROOT)/
  565 endif
  566 endif
  567 
  568 installmachinekernels:
  569         @echo "[ $(SOURCE) ] make installmachinekernels";                               \
  570         my_counter=1;           \
  571         for my_config in $(TARGET_CONFIGS_UC);                          \
  572         do              \
  573         if [ $${my_counter} -eq 1 ] ; then      \
  574                 my_counter=2;           \
  575                 kernel_config=$${my_config};            \
  576                 if [ $${kernel_config} = DEFAULT ] ; then       \
  577                         kernel_config=$(DEFAULT_KERNEL_CONFIG);         \
  578                 fi;             \
  579         elif [ $${my_counter} -eq 2 ] ; then    \
  580                 my_counter=3;           \
  581                 arch_config=$${my_config};              \
  582                 if [ $${arch_config} = DEFAULT ] ; then \
  583                         arch_config=`arch | $(TR) a-z A-Z`;             \
  584                 fi;             \
  585         else            \
  586                 my_counter=1;           \
  587                 machine_config=$${my_config};           \
  588                 if [ $${machine_config} != DEFAULT ] ; then     \
  589                         build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config};   \
  590                         install_kernel_file=mach.`printf "%s" "$${kernel_config}" | $(TR) A-Z a-z`.`printf "%s" "$${machine_config}" | $(TR) A-Z a-z`;  \
  591                         [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir};                                   \
  592                         ${MAKE} ${MAKEJOBS} -C $${build_subdir}                                 \
  593                                 INSTALL_KERNEL_FILE=$${install_kernel_file}             \
  594                                 KERNEL_CONFIG=$${kernel_config}                         \
  595                                 ARCH_CONFIG=$${arch_config}                             \
  596                                 MACHINE_CONFIG=$${machine_config}                       \
  597                                 MAKEFILES=${SOURCE}/Makefile                            \
  598                                 SOURCE=${SOURCE}/                                       \
  599                                 TARGET=$${build_subdir}/                                \
  600                                 do_build_install;                                       \
  601                 fi;             \
  602         fi;             \
  603         done;
  604 
  605 #
  606 # Install for all architectures for all Configuration/Architecture options
  607 #
  608 setup_build_install:
  609 
  610 do_build_install:
  611 
  612 BUILD_INSTALL_SUBDIRS_TARGETS = $(addprefix build_install_,$(INST_SUBDIRS))
  613 
  614 .PHONY: $(BUILD_INSTALL_SUBDIRS_TARGETS)
  615 
  616 $(BUILD_INSTALL_SUBDIRS_TARGETS):
  617         $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then  \
  618                 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
  619         else            \
  620                 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)";     \
  621         fi;             \
  622         ${MAKE} TARGET=$${TARGET} setup_build_install;                  \
  623         kernel_config=$(KERNEL_CONFIG);                                 \
  624         install_subdir="$(patsubst build_install_%,%,$@)";              \
  625         [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir};                               \
  626         ${MAKE} -C $${install_subdir}                           \
  627                 KERNEL_CONFIG=$${kernel_config}                 \
  628                 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
  629                 SOURCE=${SOURCE}$${install_subdir}/             \
  630                 TARGET=$${TARGET}                               \
  631                 build_install;
  632 
  633 build_install: $(BUILD_INSTALL_SUBDIRS_TARGETS)
  634         $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then  \
  635                 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
  636         else            \
  637                 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)";     \
  638         fi;             \
  639         ${MAKE} TARGET=$${TARGET} do_build_install;
  640 
  641 
  642 #
  643 # Install source tree
  644 #
  645 .PHONY: installsrc
  646 
  647 installsrc:
  648         $(_v)($(TAR) -c --mode go=r,+X --no-ignore-case --exclude .svn --exclude .git --exclude cscope.\* --exclude BUILD --exclude \*~ -f - .) | (cd $(SRCROOT) && $(TAR) --no-same-owner -xf -)
  649 
  650 
  651 #
  652 # Clean up source tree
  653 #
  654 .PHONY: clean
  655 
  656 clean:
  657 
  658 #
  659 # Build source file list for cscope database and tags
  660 #
  661 cscope.files:
  662         @echo "Building file list for cscope and tags"
  663         @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
  664         @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
  665         @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
  666         @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
  667         @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
  668         @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
  669         @echo -k -q -c > cscope.files 2> /dev/null
  670         @sort -u < _cscope.files >> cscope.files 2> /dev/null
  671         @rm -f _cscope.files _cscope.files2 2> /dev/null
  672 
  673 #
  674 # Build cscope database
  675 #
  676 cscope: cscope.files
  677         @echo "Building cscope database"
  678         @cscope -bvU 2> /dev/null
  679 
  680 #
  681 # Build tags
  682 #
  683 
  684 tags: cscope.files
  685         @echo "Building ctags"
  686         @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
  687                 echo "Phantom files detected!" 2>&1 > /dev/null
  688         @-[ -f TAGS ] || ${MAKE} TAGS
  689 
  690 TAGS: cscope.files
  691         @echo "Building etags"
  692         @-cat cscope.files | etags -l auto -S - 2> /dev/null
  693 
  694 #
  695 # Install Man Pages
  696 #
  697 .PHONY: installman
  698 
  699 installman:
  700 ifeq ($(RC_ProjectName),Libsyscall)
  701 # nothing to do
  702 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
  703 # nothing to do
  704 else ifeq ($(findstring xnu_,$(RC_ProjectName)),xnu_)
  705 installman:
  706 # nothing to do
  707 else # xnu
  708         @echo "[ $(SRCROOT) ] Installing man pages"
  709         $(_v)manpath=$(DSTROOT)/$(MANDIR);   \
  710         [ -d $$manpath ] || $(MKDIR) $$manpath;             \
  711         ${MAKE} ${MAKEJOBS} MAKEFILES=${SOURCE}/Makefile \
  712                 SOURCE=${SOURCE}/ \
  713                 TARGET=${DSTROOT}/ \
  714                 build_installman
  715         ${SRCROOT}/config/compress-man-pages.pl ${DSTROOT}/${MANDIR}
  716 endif
  717 
  718 do_installman:
  719 
  720 BUILD_INSTALLMAN_SUBDIRS_TARGETS = $(addprefix build_installman_,$(INSTMAN_SUBDIRS))
  721 
  722 .PHONY: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
  723 
  724 $(BUILD_INSTALLMAN_SUBDIRS_TARGETS):
  725         $(_v)installman_subdir="$(patsubst build_installman_%,%,$@)";   \
  726         ${MAKE} -C $${installman_subdir} -r                                     \
  727                 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile               \
  728                 SOURCE=$(SOURCE)$${installman_subdir}/                          \
  729                 TARGET=$(TARGET)$${installman_subdir}/                          \
  730                 build_installman; 
  731 
  732 build_installman: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
  733         $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
  734                 ${MAKE} do_installman; \
  735         fi
  736 
  737 # vim: set ft=make:

Cache object: 71851a306de47565da6a3c94e4b87ff4


[ 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.