< prev index next >

make/Init.gmk

Print this page


   1 #
   2 # Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 221   include $(SPEC)
 222 
 223   # Our helper functions.
 224   include $(TOPDIR)/make/InitSupport.gmk
 225 
 226   # Parse COMPARE_BUILD (for makefile development)
 227   $(eval $(call ParseCompareBuild))
 228 
 229   # If no LOG= was given on command line, but we have a non-standard default
 230   # value, use that instead and re-parse log level.
 231   ifeq ($(LOG), )
 232     ifneq ($(DEFAULT_LOG), )
 233       override LOG := $(DEFAULT_LOG)
 234       $(eval $(call ParseLogLevel))
 235     endif
 236   endif
 237 
 238   ifeq ($(LOG_NOFILE), true)
 239     # Disable build log if LOG=[level,]nofile was given
 240     override BUILD_LOG_PIPE :=
 241     override BUILD_LOG_PIPE_SIMPLE :=
 242   endif
 243 
 244   ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
 245     # We can't have a log file if we're about to remove it.
 246     override BUILD_LOG_PIPE :=
 247     override BUILD_LOG_PIPE_SIMPLE :=
 248   endif
 249 
 250   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
 251     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
 252   endif
 253 
 254   ##############################################################################
 255   # Init targets
 256   ##############################################################################
 257 
 258   print-modules:
 259         ( cd $(TOPDIR) && \
 260             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 261             NO_RECIPES=true print-modules )
 262 
 263   print-targets:
 264         ( cd $(TOPDIR) && \
 265             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 266             NO_RECIPES=true print-targets )
 267 
 268   print-tests:
 269         ( cd $(TOPDIR) && \
 270             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 271             NO_RECIPES=true print-tests )
 272 
 273   print-configuration:
 274           $(ECHO) $(CONFIGURE_COMMAND_LINE)
 275 
 276   reconfigure:
 277         ifneq ($(CONFIGURE_COMMAND_LINE), )
 278           $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
 279         else
 280           $(ECHO) "Re-running configure using default settings"
 281         endif
 282         ( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
 283             CUSTOM_ROOT="$(CUSTOM_ROOT)" \
 284             CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
 285             $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 286 
 287   ##############################################################################
 288   # The main target, for delegating into Main.gmk
 289   ##############################################################################
 290 
 291   MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
 292   # If building the default target, add what they are to the description.
 293   DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
 294   ifeq ($(DESCRIPTION_TARGETS), default)
 295     DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
 296   endif
 297   TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
 298       '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
 299 
 300   # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
 301   # We need to clear it of the init-specific variables. The user-specified
 302   # variables are explicitly propagated using $(USER_MAKE_VARS).
 303   main: MAKEOVERRIDES :=
 304 
 305   main: $(INIT_TARGETS)
 306         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 307           $(call RotateLogFiles)
 308           $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
 309           ifneq ($(SEQUENTIAL_TARGETS), )
 310             # Don't touch build output dir since we might be cleaning. That
 311             # means no log pipe.
 312             ( cd $(TOPDIR) && \
 313                 $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 314                 $(SEQUENTIAL_TARGETS) )
 315           endif
 316           ifneq ($(PARALLEL_TARGETS), )
 317             $(call PrepareFailureLogs)
 318             $(call StartGlobalTimer)
 319             $(call PrepareSmartJavac)
 320             # JOBS will only be empty for a bootcycle-images recursive call
 321             # or if specified via a make argument directly. In those cases
 322             # treat it as NOT using jobs at all.
 323             ( cd $(TOPDIR) && \
 324                 $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 325                     $(if $(JOBS), -j $(JOBS)) \
 326                     -f make/Main.gmk $(USER_MAKE_VARS) \
 327                     $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
 328                 ( exitcode=$$? && \
 329                 $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
 330                     $(BUILD_LOG_PIPE_SIMPLE) && \
 331                 cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 332                     HAS_SPEC=true on-failure ; \
 333                 exit $$exitcode ) )
 334             $(call CleanupSmartJavac)
 335             $(call StopGlobalTimer)
 336             $(call ReportBuildTimes)
 337           endif
 338           if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
 339             exit 1 ; \
 340           fi
 341           $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
 342           $(call ReportProfileTimes)
 343         endif
 344 
 345     on-failure:
 346         $(call CleanupSmartJavac)
 347         $(call StopGlobalTimer)
 348         $(call ReportBuildTimes)
 349         $(call PrintFailureReports)
 350         $(call PrintBuildLogFailures)
 351         $(call ReportProfileTimes)
 352         $(PRINTF) "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
 353         ifneq ($(COMPARE_BUILD), )
 354           $(call CleanupCompareBuild)
 355         endif
 356 
 357     # Support targets for COMPARE_BUILD, used for makefile development
 358     pre-compare-build:
 359         $(call WaitForSmartJavacFinish)
 360         $(call PrepareCompareBuild)
 361 
   1 #
   2 # Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 221   include $(SPEC)
 222 
 223   # Our helper functions.
 224   include $(TOPDIR)/make/InitSupport.gmk
 225 
 226   # Parse COMPARE_BUILD (for makefile development)
 227   $(eval $(call ParseCompareBuild))
 228 
 229   # If no LOG= was given on command line, but we have a non-standard default
 230   # value, use that instead and re-parse log level.
 231   ifeq ($(LOG), )
 232     ifneq ($(DEFAULT_LOG), )
 233       override LOG := $(DEFAULT_LOG)
 234       $(eval $(call ParseLogLevel))
 235     endif
 236   endif
 237 
 238   ifeq ($(LOG_NOFILE), true)
 239     # Disable build log if LOG=[level,]nofile was given
 240     override BUILD_LOG_PIPE :=

 241   endif
 242 
 243   ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
 244     # We can't have a log file if we're about to remove it.
 245     override BUILD_LOG_PIPE :=

 246   endif
 247 
 248   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
 249     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
 250   endif
 251 
 252   ##############################################################################
 253   # Init targets
 254   ##############################################################################
 255 
 256   print-modules:
 257         ( cd $(TOPDIR) && \
 258             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 259             NO_RECIPES=true print-modules )
 260 
 261   print-targets:
 262         ( cd $(TOPDIR) && \
 263             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 264             NO_RECIPES=true print-targets )
 265 
 266   print-tests:
 267         ( cd $(TOPDIR) && \
 268             $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 269             NO_RECIPES=true print-tests )
 270 
 271   print-configuration:
 272           $(ECHO) $(CONFIGURE_COMMAND_LINE)
 273 
 274   reconfigure:
 275         ifneq ($(CONFIGURE_COMMAND_LINE), )
 276           $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
 277         else
 278           $(ECHO) "Re-running configure using default settings"
 279         endif
 280         ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
 281             CUSTOM_ROOT="$(CUSTOM_ROOT)" \
 282             CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
 283             $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 284 
 285   ##############################################################################
 286   # The main target, for delegating into Main.gmk
 287   ##############################################################################
 288 
 289   MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
 290   # If building the default target, add what they are to the description.
 291   DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
 292   ifeq ($(DESCRIPTION_TARGETS), default)
 293     DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
 294   endif
 295   TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
 296       '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
 297 
 298   # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
 299   # We need to clear it of the init-specific variables. The user-specified
 300   # variables are explicitly propagated using $(USER_MAKE_VARS).
 301   main: MAKEOVERRIDES :=
 302 
 303   main: $(INIT_TARGETS)
 304         ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
 305           $(call RotateLogFiles)
 306           $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
 307           ifneq ($(SEQUENTIAL_TARGETS), )
 308             # Don't touch build output dir since we might be cleaning. That
 309             # means no log pipe.
 310             ( cd $(TOPDIR) && \
 311                 $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
 312                 $(SEQUENTIAL_TARGETS) )
 313           endif
 314           ifneq ($(PARALLEL_TARGETS), )
 315             $(call PrepareFailureLogs)
 316             $(call StartGlobalTimer)
 317             $(call PrepareSmartJavac)
 318             # JOBS will only be empty for a bootcycle-images recursive call
 319             # or if specified via a make argument directly. In those cases
 320             # treat it as NOT using jobs at all.
 321             ( cd $(TOPDIR) && \
 322                 $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
 323                     $(if $(JOBS), -j $(JOBS)) \
 324                     -f make/Main.gmk $(USER_MAKE_VARS) \
 325                     $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
 326                 ( exitcode=$$? && \
 327                 $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
 328                     $(BUILD_LOG_PIPE) && \
 329                 cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
 330                     HAS_SPEC=true on-failure ; \
 331                 exit $$exitcode ) )
 332             $(call CleanupSmartJavac)
 333             $(call StopGlobalTimer)
 334             $(call ReportBuildTimes)
 335           endif
 336           if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
 337             exit 1 ; \
 338           fi
 339           $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
 340           $(call ReportProfileTimes)
 341         endif
 342 
 343     on-failure:
 344         $(call CleanupSmartJavac)
 345         $(call StopGlobalTimer)
 346         $(call ReportBuildTimes)
 347         $(call PrintFailureReports)
 348         $(call PrintBuildLogFailures)
 349         $(call ReportProfileTimes)
 350         $(PRINTF) "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
 351         ifneq ($(COMPARE_BUILD), )
 352           $(call CleanupCompareBuild)
 353         endif
 354 
 355     # Support targets for COMPARE_BUILD, used for makefile development
 356     pre-compare-build:
 357         $(call WaitForSmartJavacFinish)
 358         $(call PrepareCompareBuild)
 359 
< prev index next >