< prev index next >

make/Init.gmk

Print this page




 167         endif
 168 
 169     MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \
 170         USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
 171         LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
 172         INIT_TARGETS="$(INIT_TARGETS)" \
 173         SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
 174         PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
 175 
 176     # Now the init and main targets will be called, once for each SPEC. The
 177     # recipe will be run once for every target specified, but we only want to
 178     # execute the recipe a single time, hence the TARGET_DONE with a dummy
 179     # command if true.
 180     # The COMPARE_BUILD part implements special support for makefile development.
 181     $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
 182         @$(if $(TARGET_DONE), \
 183           true \
 184         , \
 185           ( cd $(topdir) && \
 186           $(foreach spec, $(SPECS), \

 187             $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
 188                 SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
 189                 main && \
 190             $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
 191                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
 192                     SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 193                     COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \

 194                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
 195                     SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
 196                     COMPARE_BUILD="$(COMPARE_BUILD)" main && \
 197                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
 198                     SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 199                     COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \
 200             ) \
 201           ) true ) \
 202           $(eval TARGET_DONE=true) \
 203         )
 204 
 205     .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
 206 
 207   endif # $(ONLY_GLOBAL_TARGETS)!=true
 208 
 209 else # HAS_SPEC=true
 210 
 211   ##############################################################################
 212   # Now we have a spec. This part provides the "main" target that acts as a
 213   # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
 214   # file.
 215   ##############################################################################
 216 
 217   include $(SPEC)
 218 
 219   # Our helper functions.
 220   include $(TOPDIR)/make/InitSupport.gmk
 221 
 222   # Verify that the spec file we included seems okay.
 223   $(eval $(call CheckSpecSanity))
 224 
 225   # Parse COMPARE_BUILD (for makefile development)
 226   $(eval $(call ParseCompareBuild))
 227 
 228   ifeq ($(LOG_NOFILE), true)
 229     # Disable log wrapper if LOG=[level,]nofile was given
 230     override BUILD_LOG_WRAPPER :=
 231   endif
 232 
 233   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
 234     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
 235   endif
 236 
 237   ##############################################################################
 238   # Init targets
 239   ##############################################################################
 240 
 241   print-modules:
 242         ( cd $(TOPDIR) && \
 243             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 244             NO_RECIPES=true print-modules )
 245 
 246   print-targets:
 247         ( cd $(TOPDIR) && \
 248             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 249             NO_RECIPES=true print-targets )
 250 


 260         ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
 261             $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 262 
 263   ##############################################################################
 264   # The main target, for delegating into Main.gmk
 265   ##############################################################################
 266 
 267   MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
 268   TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
 269       '$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)'
 270 
 271   # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
 272   # We need to clear it of the init-specific variables. The user-specified
 273   # variables are explicitely propagated using $(USER_MAKE_VARS).
 274   main: MAKEOVERRIDES :=
 275 
 276   main: $(INIT_TARGETS)
 277         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 278           $(call RotateLogFiles)
 279           $(call PrepareFailureLogs)
 280           $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
 281           ifneq ($(SEQUENTIAL_TARGETS), )
 282             # Don't touch build output dir since we might be cleaning. That
 283             # means no log wrapper.
 284             ( cd $(TOPDIR) && \
 285                 $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 286                 $(SEQUENTIAL_TARGETS) )
 287           endif
 288           ifneq ($(PARALLEL_TARGETS), )
 289             $(call StartGlobalTimer)
 290             $(call PrepareSmartJavac)
 291             ( cd $(TOPDIR) && \
 292                 $(BUILD_LOG_WRAPPER) $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 293                     -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
 294                     $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \
 295                 ( exitcode=$$? && $(BUILD_LOG_WRAPPER) \
 296                 $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \

 297                 cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 298                     HAS_SPEC=true on-failure ; \
 299                 exit $$exitcode ) )
 300             $(call CleanupSmartJavac)
 301             $(call StopGlobalTimer)
 302             $(call ReportBuildTimes)
 303           endif
 304           $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
 305         endif
 306 
 307     on-failure:
 308         $(call PrintFailureReports)
 309         $(call PrintBuildLogFailures)
 310         $(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n"
 311         ifneq ($(COMPARE_BUILD), )
 312           $(call CleanupCompareBuild)
 313         endif
 314 
 315     # Support targets for COMPARE_BUILD, used for makefile development
 316     pre-compare-build:
 317         $(call PrepareCompareBuild)
 318 
 319     post-compare-build:
 320         $(call CleanupCompareBuild)
 321         $(call CompareBuildDoComparison)
 322 
 323   .PHONY: print-targets print-modules reconfigure main on-failure
 324 endif


 167         endif
 168 
 169     MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \
 170         USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
 171         LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
 172         INIT_TARGETS="$(INIT_TARGETS)" \
 173         SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
 174         PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
 175 
 176     # Now the init and main targets will be called, once for each SPEC. The
 177     # recipe will be run once for every target specified, but we only want to
 178     # execute the recipe a single time, hence the TARGET_DONE with a dummy
 179     # command if true.
 180     # The COMPARE_BUILD part implements special support for makefile development.
 181     $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
 182         @$(if $(TARGET_DONE), \
 183           true \
 184         , \
 185           ( cd $(topdir) && \
 186           $(foreach spec, $(SPECS), \
 187             $(call GenerateModuleDeps, $(spec)) && \
 188             $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
 189                 SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
 190                 main && \
 191             $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
 192                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
 193                     SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 194                     COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \
 195                 $(call GenerateModuleDeps, $(spec)) && \
 196                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
 197                     SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
 198                     COMPARE_BUILD="$(COMPARE_BUILD)" main && \
 199                 $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
 200                     SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
 201                     COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \
 202             ) \
 203           ) true ) \
 204           $(eval TARGET_DONE=true) \
 205         )
 206 
 207     .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
 208 
 209   endif # $(ONLY_GLOBAL_TARGETS)!=true
 210 
 211 else # HAS_SPEC=true
 212 
 213   ##############################################################################
 214   # Now we have a spec. This part provides the "main" target that acts as a
 215   # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
 216   # file.
 217   ##############################################################################
 218 
 219   include $(SPEC)
 220 
 221   # Our helper functions.
 222   include $(TOPDIR)/make/InitSupport.gmk
 223 
 224   # Verify that the spec file we included seems okay.
 225   $(eval $(call CheckSpecSanity))
 226 
 227   # Parse COMPARE_BUILD (for makefile development)
 228   $(eval $(call ParseCompareBuild))
 229 
 230   ifeq ($(LOG_NOFILE), true)
 231     # Disable build log if LOG=[level,]nofile was given
 232     override BUILD_LOG_PIPE :=
 233   endif
 234 
 235   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
 236     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
 237   endif
 238 
 239   ##############################################################################
 240   # Init targets
 241   ##############################################################################
 242 
 243   print-modules:
 244         ( cd $(TOPDIR) && \
 245             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 246             NO_RECIPES=true print-modules )
 247 
 248   print-targets:
 249         ( cd $(TOPDIR) && \
 250             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 251             NO_RECIPES=true print-targets )
 252 


 262         ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
 263             $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 264 
 265   ##############################################################################
 266   # The main target, for delegating into Main.gmk
 267   ##############################################################################
 268 
 269   MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
 270   TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
 271       '$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)'
 272 
 273   # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
 274   # We need to clear it of the init-specific variables. The user-specified
 275   # variables are explicitely propagated using $(USER_MAKE_VARS).
 276   main: MAKEOVERRIDES :=
 277 
 278   main: $(INIT_TARGETS)
 279         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 280           $(call RotateLogFiles)
 281           $(call PrepareFailureLogs)
 282           $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
 283           ifneq ($(SEQUENTIAL_TARGETS), )
 284             # Don't touch build output dir since we might be cleaning. That
 285             # means no log pipe.
 286             ( cd $(TOPDIR) && \
 287                 $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 288                 $(SEQUENTIAL_TARGETS) )
 289           endif
 290           ifneq ($(PARALLEL_TARGETS), )
 291             $(call StartGlobalTimer)
 292             $(call PrepareSmartJavac)
 293             ( cd $(TOPDIR) && \
 294                 $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 295                     -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
 296                     $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
 297                 ( exitcode=$$? && \
 298                 $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
 299                     $(BUILD_LOG_PIPE) && \
 300                 cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 301                     HAS_SPEC=true on-failure ; \
 302                 exit $$exitcode ) )
 303             $(call CleanupSmartJavac)
 304             $(call StopGlobalTimer)
 305             $(call ReportBuildTimes)
 306           endif
 307           $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
 308         endif
 309 
 310     on-failure:
 311         $(call PrintFailureReports)
 312         $(call PrintBuildLogFailures)
 313         $(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n"
 314         ifneq ($(COMPARE_BUILD), )
 315           $(call CleanupCompareBuild)
 316         endif
 317 
 318     # Support targets for COMPARE_BUILD, used for makefile development
 319     pre-compare-build:
 320         $(call PrepareCompareBuild)
 321 
 322     post-compare-build:
 323         $(call CleanupCompareBuild)
 324         $(call CompareBuildDoComparison)
 325 
 326   .PHONY: print-targets print-modules reconfigure main on-failure
 327 endif
< prev index next >