8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile

Fri, 28 Dec 2012 09:51:15 +0100

author
erikj
date
Fri, 28 Dec 2012 09:51:15 +0100
changeset 559
ef6adbf511cc
parent 558
d5f3a6f60d51
child 560
2d9bb72b4e34

8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
Reviewed-by: ohair, tbell

NewMakefile.gmk file | annotate | diff | comparison | revisions
common/autoconf/Makefile.in file | annotate | diff | comparison | revisions
common/autoconf/generated-configure.sh file | annotate | diff | comparison | revisions
common/makefiles/Jprt.gmk file | annotate | diff | comparison | revisions
common/makefiles/Main.gmk file | annotate | diff | comparison | revisions
common/makefiles/MakeHelpers.gmk file | annotate | diff | comparison | revisions
common/makefiles/Makefile file | annotate | diff | comparison | revisions
     1.1 --- a/NewMakefile.gmk	Thu Dec 27 20:55:53 2012 +0100
     1.2 +++ b/NewMakefile.gmk	Fri Dec 28 09:51:15 2012 +0100
     1.3 @@ -23,273 +23,107 @@
     1.4  # questions.
     1.5  #
     1.6  
     1.7 -# Utilities used in this Makefile
     1.8 -BASENAME=basename
     1.9 -CAT=cat
    1.10 -CD=cd
    1.11 -CMP=cmp
    1.12 -CP=cp
    1.13 -ECHO=echo
    1.14 -MKDIR=mkdir
    1.15 -PRINTF=printf
    1.16 -PWD=pwd
    1.17 -TAR=tar
    1.18 -ifeq ($(PLATFORM),windows)
    1.19 -  ZIP=zip
    1.20 -else
    1.21 -  # store symbolic links as the link
    1.22 -  ZIP=zip -y
    1.23 -endif
    1.24 -# Insure we have a path that looks like it came from pwd
    1.25 -#   (This is mostly for Windows sake and drive letters)
    1.26 -define UnixPath # path
    1.27 -$(shell (cd "$1" && $(PWD)))
    1.28 -endef
    1.29 +# This must be the first rule
    1.30 +default:
    1.31  
    1.32 -# Current root directory
    1.33 -CURRENT_DIRECTORY := $(shell $(PWD))
    1.34 +# Inclusion of this pseudo-target will cause make to execute this file
    1.35 +# serially, regardless of -j. Recursively called makefiles will not be
    1.36 +# affected, however. This is required for correct dependency management.
    1.37 +.NOTPARALLEL:
    1.38  
    1.39 -# Build directory root
    1.40 -BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build
    1.41 +# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
    1.42 +# /usr/ccs/bin/make lacks basically every other flow control mechanism.
    1.43 +TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
    1.44  
    1.45 -# All configured Makefiles to run
    1.46 -ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile)
    1.47 -
    1.48 -# All bundles to create
    1.49 -ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image)
    1.50 -
    1.51 -# Build all the standard 'all', 'images', and 'clean' targets
    1.52 -all images clean: checks
    1.53 -	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    1.54 -	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    1.55 -	fi
    1.56 -	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    1.57 -	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \
    1.58 -	  $(CD) $${bdir} && $(MAKE) $@ ; \
    1.59 -	done
    1.60 -
    1.61 -# TBD: Deploy input
    1.62 -$(BUILD_DIR_ROOT)/.deploy_input:
    1.63 -	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    1.64 -	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    1.65 -	fi
    1.66 -	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    1.67 -	  if [ deploy/make/Makefile ] ; then \
    1.68 -	    echo "Attempting deploy build." ; \
    1.69 -	    ( \
    1.70 -	      $(RM) -r $${bdir}/deploy_input ; \
    1.71 -	      $(MKDIR) -p $${bdir}/deploy_input ; \
    1.72 -	      ( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \
    1.73 -	        | ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \
    1.74 -	    ) ; \
    1.75 -	  fi; \
    1.76 -	done
    1.77 -	touch $@
    1.78 -
    1.79 -# TBD: Deploy images
    1.80 -deploy: $(BUILD_DIR_ROOT)/.deploy_input
    1.81 -	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    1.82 -	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    1.83 -	fi
    1.84 -	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    1.85 -	  if [ deploy/make/Makefile ] ; then \
    1.86 -	    echo "Attempting deploy build." ; \
    1.87 -	    ( \
    1.88 -	      $(CD) deploy/make && \
    1.89 -	      $(MAKE) \
    1.90 -	        ABS_OUTPUTDIR=$${bdir}/deploy_input \
    1.91 -	        OUTPUTDIR=$${bdir}/deploy_input \
    1.92 -	    ) ; \
    1.93 -	  fi; \
    1.94 -	done
    1.95 -
    1.96 -# TBD: Install bundles
    1.97 -install:
    1.98 -
    1.99 -# Bundle creation
   1.100 -bundles:
   1.101 -	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
   1.102 -	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
   1.103 -	fi
   1.104 -	@for i in $(ALL_IMAGE_DIRS) ; do \
   1.105 -          $(MKDIR) -p $${i}/../../bundles && \
   1.106 -          $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \
   1.107 -	  $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ."  && \
   1.108 -	  $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \
   1.109 -	done
   1.110 -
   1.111 -# Clobber all the built files
   1.112 -clobber::
   1.113 -	$(RM) -r $(BUILD_DIR_ROOT)
   1.114 -
   1.115 -# Make various checks to insure the build will be successful
   1.116 -#   Possibilities:
   1.117 -#     * Check that if any closed repo is provided, they all must be.
   1.118 -#     * Check that all open repos exist, at least until we are ready for some
   1.119 -#       kind of partial build.
   1.120 -checks:
   1.121 -	@$(ECHO) "No checks yet"
   1.122 -
   1.123 -# Keep track of user targets
   1.124 -USER_TARGETS += all deploy install images clean clobber checks
   1.125 -
   1.126 -###########################################################################
   1.127 -# To help in adoption of the new configure&&make build process, a bridge
   1.128 -#   build will use the old settings to run configure and do the build.
   1.129 -
   1.130 -# Build with the configure bridge
   1.131 -bridgeBuild: bridge2configure images
   1.132 -
   1.133 -# Bridge from old Makefile ALT settings to configure options
   1.134 -bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
   1.135 -	bash ./configure $(strip $(shell $(CAT) $<))
   1.136 -
   1.137 -# Create a file with configure options created from old Makefile mechanisms.
   1.138 -$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
   1.139 -	$(RM) $@
   1.140 -	$(CP) $< $@
   1.141 -
   1.142 -# Use this file to only change when obvious things have changed
   1.143 -$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
   1.144 -	$(RM) $@.tmp
   1.145 -	$(MKDIR) -p $(BUILD_DIR_ROOT)
   1.146 -	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
   1.147 -ifdef ARCH_DATA_MODEL
   1.148 -	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
   1.149 -endif
   1.150 -ifdef ALT_PARALLEL_COMPILE_JOBS
   1.151 -	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
   1.152 -endif
   1.153 -ifdef ALT_BOOTDIR
   1.154 -	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
   1.155 -endif
   1.156 -ifdef ALT_CUPS_HEADERS_PATH
   1.157 -	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
   1.158 -endif
   1.159 -ifdef ALT_FREETYPE_HEADERS_PATH
   1.160 -	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
   1.161 -endif
   1.162 -	@if [ -f $@ ] ; then \
   1.163 -          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
   1.164 -            $(CP) $@.tmp $@ ; \
   1.165 -          fi ; \
   1.166 -        else \
   1.167 -          $(CP) $@.tmp $@ ; \
   1.168 -        fi
   1.169 -	$(RM) $@.tmp
   1.170 -
   1.171 -# Clobber all the built files
   1.172 -clobber:: bridge2clobber
   1.173 -bridge2clobber::
   1.174 -	$(RM) $(BUILD_DIR_ROOT)/.bridge2*
   1.175 -	$(RM) $(BUILD_DIR_ROOT)/.deploy_input
   1.176 -
   1.177 -# Keep track of phony targets
   1.178 -PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
   1.179 -
   1.180 -###########################################################################
   1.181 -# Sanity checks (history target)
   1.182 -#
   1.183 -
   1.184 -sanity: checks
   1.185 -
   1.186 -# Keep track of user targets
   1.187 -USER_TARGETS += sanity
   1.188 -
   1.189 -###########################################################################
   1.190 -# Javadocs
   1.191 -#
   1.192 -
   1.193 -javadocs:
   1.194 -	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
   1.195 -
   1.196 -# Keep track of user targets
   1.197 -USER_TARGETS += javadocs
   1.198 -
   1.199 -###########################################################################
   1.200 -# JPRT targets
   1.201 -
   1.202 -ifndef JPRT_ARCHIVE_BUNDLE
   1.203 -  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
   1.204 +# Assume we have GNU make, but check version.
   1.205 +ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
   1.206 +    ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
   1.207 +        $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
   1.208 +    endif
   1.209  endif
   1.210  
   1.211 -jprt_build_product: DEBUG_LEVEL=release
   1.212 -jprt_build_product: BUILD_DIRNAME=*-release
   1.213 -jprt_build_product: jprt_build_generic
   1.214 +# Locate this Makefile
   1.215 +ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
   1.216 +    makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
   1.217 +else
   1.218 +    makefile_path:=$(lastword $(MAKEFILE_LIST))
   1.219 +endif
   1.220 +root_dir:=$(dir $(makefile_path))
   1.221  
   1.222 -jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
   1.223 -jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
   1.224 -jprt_build_fastdebug: jprt_build_generic
   1.225 +include $(root_dir)/common/makefiles/Jprt.gmk
   1.226  
   1.227 -jprt_build_debug: DEBUG_LEVEL=slowdebug
   1.228 -jprt_build_debug: BUILD_DIRNAME=*-debug
   1.229 -jprt_build_debug: jprt_build_generic
   1.230 +# ... and then we can include our helper functions
   1.231 +include $(root_dir)/common/makefiles/MakeHelpers.gmk
   1.232  
   1.233 -jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
   1.234 +$(eval $(call ParseLogLevel))
   1.235 +$(eval $(call ParseConfAndSpec))
   1.236  
   1.237 -$(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
   1.238 -	$(MKDIR) -p $(@D)
   1.239 -	$(RM) $@
   1.240 -	$(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@
   1.241 +# Now determine if we have zero, one or several configurations to build.
   1.242 +ifeq ($(SPEC),)
   1.243 +    # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
   1.244 +else
   1.245 +    ifeq ($(words $(SPEC)),1)
   1.246 +        # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
   1.247 +        include $(root_dir)/common/makefiles/Main.gmk
   1.248 +    else
   1.249 +        # We are building multiple configurations.
   1.250 +        # First, find out the valid targets
   1.251 +        # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
   1.252 +        # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
   1.253 +        all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
   1.254 +            $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \
   1.255 +            grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
   1.256  
   1.257 -# Keep track of phony targets
   1.258 -PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   1.259 -              jprt_build_generic
   1.260 +$(all_phony_targets):
   1.261 +	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
   1.262  
   1.263 -###########################################################################
   1.264 -# Help target
   1.265 +    endif
   1.266 +endif
   1.267  
   1.268 -HELP_FORMAT=%12s%s\n
   1.269 +# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
   1.270 +# If you addd more global targets, please update the variable global_targets in MakeHelpers.
   1.271  
   1.272  help:
   1.273 -	@$(PRINTF) "# JDK Makefile\n"
   1.274 -	@$(PRINTF) "#\n"
   1.275 -	@$(PRINTF) "# Usage: make [Target]\n"
   1.276 -	@$(PRINTF) "#\n"
   1.277 -	@$(PRINTF) "#   $(HELP_FORMAT)" "Target   " "Description"
   1.278 -	@$(PRINTF) "#   $(HELP_FORMAT)" "------   " "-----------"
   1.279 -	@for i in $(USER_TARGETS) ; do \
   1.280 -	  $(MAKE) help_$${i} ; \
   1.281 -	done
   1.282 -	@$(PRINTF) "#\n"
   1.283 +	$(info )
   1.284 +	$(info OpenJDK Makefile help)
   1.285 +	$(info =====================)
   1.286 +	$(info )
   1.287 +	$(info Common make targets)
   1.288 +	$(info .  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,)
   1.289 +	$(info .                         # corba and jdk)
   1.290 +	$(info .  make all               # Compile everything, all repos and images)
   1.291 +	$(info .  make images            # Create complete j2sdk and j2re images)
   1.292 +	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
   1.293 +	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
   1.294 +	$(info .  make install           # Install the generated images locally)
   1.295 +	$(info .  make clean             # Remove all files generated by make, but not those)
   1.296 +	$(info .                         # generated by configure)
   1.297 +	$(info .  make dist-clean        # Remove all files, including configuration)
   1.298 +	$(info .  make help              # Give some help on using make)
   1.299 +	$(info .  make test              # Run tests, default is all tests (see TEST below))
   1.300 +	$(info )
   1.301 +	$(info Targets for specific components)
   1.302 +	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
   1.303 +	$(info .  make <component>       # Build <component> and everything it depends on. )
   1.304 +	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
   1.305 +	$(info .                         # is faster but can result in incorrect build results!)
   1.306 +	$(info .  make clean-<component> # Remove files generated by make for <component>)
   1.307 +	$(info )
   1.308 +	$(info Useful make variables)
   1.309 +	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
   1.310 +	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
   1.311 +	$(info .                         # <substring>)
   1.312 +	$(info )
   1.313 +	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
   1.314 +	$(info .                         # Available log levels are:)
   1.315 +	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
   1.316 +	$(info .                         # To see executed command lines, use LOG=debug)
   1.317 +	$(info )
   1.318 +	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
   1.319 +	$(info .                         # Note that -jN does not work as expected!)
   1.320 +	$(info )
   1.321 +	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
   1.322 +	$(info .                         # make test TEST="jdk_lang jdk_net")
   1.323 +	$(info )
   1.324  
   1.325 -help_all:
   1.326 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.327 -	"Build the entire jdk but not the images"
   1.328 -help_images:
   1.329 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.330 -	"Create the jdk images for the builds"
   1.331 -help_deploy:
   1.332 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.333 -	"Create the jdk deploy images from the jdk images"
   1.334 -help_install:
   1.335 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.336 -	"Create the jdk install bundles from the deploy images"
   1.337 -help_clean:
   1.338 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.339 -	"Clean and prepare for a fresh build from scratch"
   1.340 -help_clobber:
   1.341 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.342 -	"Clean and also purge any hidden derived data"
   1.343 -help_checks:
   1.344 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.345 -	"Perform various checks to make sure we can build"
   1.346 -help_sanity:
   1.347 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.348 -	"Same as 'make checks'"
   1.349 -help_javadocs:
   1.350 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.351 -	"Build the javadocs"
   1.352 -help_help:
   1.353 -	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
   1.354 -	"Print out the help messages"
   1.355 -
   1.356 -# Keep track of user targets
   1.357 -USER_TARGETS += help
   1.358 -
   1.359 -###########################################################################
   1.360 -# Phony targets
   1.361 -.PHONY: $(PHONY_LIST) $(USER_TARGETS)
   1.362 -
   1.363 -# Force target
   1.364 -FRC:
   1.365 +.PHONY: help
     2.1 --- a/common/autoconf/Makefile.in	Thu Dec 27 20:55:53 2012 +0100
     2.2 +++ b/common/autoconf/Makefile.in	Fri Dec 28 09:51:15 2012 +0100
     2.3 @@ -24,4 +24,4 @@
     2.4  # This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
     2.5  # GENERATED FILE, DO NOT EDIT
     2.6  SPEC:=@OUTPUT_ROOT@/spec.gmk
     2.7 -include @SRC_ROOT@/common/makefiles/Makefile
     2.8 +include @SRC_ROOT@/NewMakefile.gmk
     3.1 --- a/common/autoconf/generated-configure.sh	Thu Dec 27 20:55:53 2012 +0100
     3.2 +++ b/common/autoconf/generated-configure.sh	Fri Dec 28 09:51:15 2012 +0100
     3.3 @@ -3679,7 +3679,7 @@
     3.4  #CUSTOM_AUTOCONF_INCLUDE
     3.5  
     3.6  # Do not change or remove the following line, it is needed for consistency checks:
     3.7 -DATE_WHEN_GENERATED=1356635654
     3.8 +DATE_WHEN_GENERATED=1356638459
     3.9  
    3.10  ###############################################################################
    3.11  #
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/common/makefiles/Jprt.gmk	Fri Dec 28 09:51:15 2012 +0100
     4.3 @@ -0,0 +1,165 @@
     4.4 +#
     4.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     4.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 +#
     4.8 +# This code is free software; you can redistribute it and/or modify it
     4.9 +# under the terms of the GNU General Public License version 2 only, as
    4.10 +# published by the Free Software Foundation.  Oracle designates this
    4.11 +# particular file as subject to the "Classpath" exception as provided
    4.12 +# by Oracle in the LICENSE file that accompanied this code.
    4.13 +#
    4.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 +# version 2 for more details (a copy is included in the LICENSE file that
    4.18 +# accompanied this code).
    4.19 +#
    4.20 +# You should have received a copy of the GNU General Public License version
    4.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    4.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 +#
    4.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.25 +# or visit www.oracle.com if you need additional information or have any
    4.26 +# questions.
    4.27 +#
    4.28 +
    4.29 +# This file is included by the root NewerMakefile and contains targets 
    4.30 +# and utilities needed by JPRT.
    4.31 +
    4.32 +# Utilities used in this Makefile
    4.33 +CAT=cat
    4.34 +CMP=cmp
    4.35 +CP=cp
    4.36 +ECHO=echo
    4.37 +MKDIR=mkdir
    4.38 +PRINTF=printf
    4.39 +PWD=pwd
    4.40 +# Insure we have a path that looks like it came from pwd
    4.41 +#   (This is mostly for Windows sake and drive letters)
    4.42 +define UnixPath # path
    4.43 +$(shell (cd "$1" && $(PWD)))
    4.44 +endef
    4.45 +
    4.46 +BUILD_DIR_ROOT:=$(root_dir)/build
    4.47 +
    4.48 +###########################################################################
    4.49 +# To help in adoption of the new configure&&make build process, a bridge
    4.50 +#   build will use the old settings to run configure and do the build.
    4.51 +
    4.52 +# Build with the configure bridge. After running configure, restart make
    4.53 +# to parse the new spec file.
    4.54 +BRIDGE_TARGETS := all
    4.55 +bridgeBuild: bridge2configure
    4.56 +	@cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS)
    4.57 +
    4.58 +# Bridge from old Makefile ALT settings to configure options
    4.59 +bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
    4.60 +	bash ./configure $(strip $(shell $(CAT) $<))
    4.61 +
    4.62 +# Create a file with configure options created from old Makefile mechanisms.
    4.63 +$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
    4.64 +	$(RM) $@
    4.65 +	$(CP) $< $@
    4.66 +
    4.67 +# Use this file to only change when obvious things have changed
    4.68 +$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
    4.69 +	$(RM) $@.tmp
    4.70 +	$(MKDIR) -p $(BUILD_DIR_ROOT)
    4.71 +	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
    4.72 +ifdef ARCH_DATA_MODEL
    4.73 +	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
    4.74 +endif
    4.75 +ifeq ($(ARCH_DATA_MODEL),32)
    4.76 +	@$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
    4.77 +endif
    4.78 +ifdef ALT_PARALLEL_COMPILE_JOBS
    4.79 +	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
    4.80 +endif
    4.81 +ifdef ALT_BOOTDIR
    4.82 +	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
    4.83 +endif
    4.84 +ifdef ALT_CUPS_HEADERS_PATH
    4.85 +	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
    4.86 +endif
    4.87 +ifdef ALT_FREETYPE_HEADERS_PATH
    4.88 +	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
    4.89 +endif
    4.90 +ifdef OPENJDK
    4.91 +	@$(ECHO) " --enable-openjdk-only " >> $@.tmp
    4.92 +endif
    4.93 +# Todo: move to closed?
    4.94 +ifdef ALT_MOZILLA_HEADERS_PATH
    4.95 +	@$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
    4.96 +endif
    4.97 +ifdef ALT_JUNIT_DIR
    4.98 +	@$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
    4.99 +endif
   4.100 +ifdef ANT_HOME
   4.101 +	@$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
   4.102 +endif
   4.103 +ifdef ALT_SLASH_JAVA
   4.104 +	@$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
   4.105 +endif
   4.106 +	@if [ -f $@ ] ; then \
   4.107 +          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
   4.108 +            $(CP) $@.tmp $@ ; \
   4.109 +          fi ; \
   4.110 +        else \
   4.111 +          $(CP) $@.tmp $@ ; \
   4.112 +        fi
   4.113 +	$(RM) $@.tmp
   4.114 +
   4.115 +PHONY_LIST += bridge2configure bridgeBuild
   4.116 +
   4.117 +###########################################################################
   4.118 +# JPRT targets
   4.119 +
   4.120 +ifndef JPRT_ARCHIVE_BUNDLE
   4.121 +  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
   4.122 +endif
   4.123 +
   4.124 +# These targets execute in a SPEC free context, before calling bridgeBuild
   4.125 +# to generate the SPEC.
   4.126 +jprt_build_product: DEBUG_LEVEL=release
   4.127 +jprt_build_product: BUILD_DIRNAME=*-release
   4.128 +jprt_build_product: jprt_build_generic
   4.129 +
   4.130 +jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
   4.131 +jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
   4.132 +jprt_build_fastdebug: jprt_build_generic
   4.133 +
   4.134 +jprt_build_debug: DEBUG_LEVEL=slowdebug
   4.135 +jprt_build_debug: BUILD_DIRNAME=*-debug
   4.136 +jprt_build_debug: jprt_build_generic
   4.137 +
   4.138 +jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
   4.139 +jprt_build_generic: bridgeBuild
   4.140 +
   4.141 +# This target must be called in the context of a SPEC file
   4.142 +jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
   4.143 +	@$(call CheckIfMakeAtEnd)
   4.144 +
   4.145 +# This target must be called in the context of a SPEC file
   4.146 +$(JPRT_ARCHIVE_BUNDLE): bundles
   4.147 +	$(MKDIR) -p $(@D)
   4.148 +	$(RM) $@
   4.149 +	$(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@
   4.150 +
   4.151 +# This target must be called in the context of a SPEC file
   4.152 +bundles: all
   4.153 +	@$(call TargetEnter)
   4.154 +	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
   4.155 +	$(CD) $(IMAGES_OUTPUTDIR)/j2sdk-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
   4.156 +	$(CD) $(IMAGES_OUTPUTDIR)/j2re-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
   4.157 +	@$(call TargetExit)
   4.158 +
   4.159 +# Keep track of phony targets
   4.160 +PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   4.161 +              jprt_build_generic bundles jprt_bundle
   4.162 +
   4.163 +###########################################################################
   4.164 +# Phony targets
   4.165 +.PHONY: $(PHONY_LIST)
   4.166 +
   4.167 +# Force target
   4.168 +FRC:
     5.1 --- a/common/makefiles/Main.gmk	Thu Dec 27 20:55:53 2012 +0100
     5.2 +++ b/common/makefiles/Main.gmk	Fri Dec 28 09:51:15 2012 +0100
     5.3 @@ -65,7 +65,11 @@
     5.4  
     5.5  ### Main targets
     5.6  
     5.7 -all: jdk
     5.8 +default: jdk
     5.9 +	@$(call CheckIfMakeAtEnd)
    5.10 +
    5.11 +all: images docs
    5.12 +	@$(call CheckIfMakeAtEnd)
    5.13  
    5.14  start-make:
    5.15  	@$(call AtMakeStart)
    5.16 @@ -126,12 +130,6 @@
    5.17  	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
    5.18  	@$(call TargetExit)
    5.19  
    5.20 -bundles: images bundles-only
    5.21 -bundles-only: start-make
    5.22 -	@$(call TargetEnter)
    5.23 -	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk bundles)
    5.24 -	@$(call TargetExit)
    5.25 -
    5.26  install: images install-only
    5.27  install-only: start-make
    5.28  	@$(call TargetEnter)
     6.1 --- a/common/makefiles/MakeHelpers.gmk	Thu Dec 27 20:55:53 2012 +0100
     6.2 +++ b/common/makefiles/MakeHelpers.gmk	Fri Dec 28 09:51:15 2012 +0100
     6.3 @@ -50,7 +50,7 @@
     6.4  
     6.5  # Global targets are possible to run either with or without a SPEC. The prototypical
     6.6  # global target is "help". 
     6.7 -global_targets=help configure
     6.8 +global_targets=help jprt% bridgeBuild
     6.9  
    6.10  ##############################
    6.11  # Functions
    6.12 @@ -112,7 +112,7 @@
    6.13  
    6.14  # Do not indent this function, this will add whitespace at the start which the caller won't handle
    6.15  define GetRealTarget
    6.16 -$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all))
    6.17 +$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),default))
    6.18  endef
    6.19  
    6.20  # Do not indent this function, this will add whitespace at the start which the caller won't handle
    6.21 @@ -126,10 +126,7 @@
    6.22      # Check if the current target is the last goal
    6.23      $(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
    6.24      # If the target is 'foo-only', check if our goal was stated as 'foo'
    6.25 -    $(if $(filter $(patsubst %-only,%,$@),$(call LastGoal)),$(call AtMakeEnd))
    6.26 -    # If no goal is given, 'all' is default, but the last target executed for all is 'jdk-only'. Check for that, too.
    6.27 -    # At most one of the tests can be true.
    6.28 -    $(if $(subst all,,$(call LastGoal)),,$(if $(filter $@,jdk-only),$(call AtMakeEnd)))
    6.29 +    $(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd))
    6.30  endef
    6.31  
    6.32  # Hook to be called when starting to execute a top-level target
     7.1 --- a/common/makefiles/Makefile	Thu Dec 27 20:55:53 2012 +0100
     7.2 +++ b/common/makefiles/Makefile	Fri Dec 28 09:51:15 2012 +0100
     7.3 @@ -23,109 +23,4 @@
     7.4  # questions.
     7.5  #
     7.6  
     7.7 -# This must be the first rule
     7.8 -all:
     7.9 -
    7.10 -# Inclusion of this pseudo-target will cause make to execute this file
    7.11 -# serially, regardless of -j. Recursively called makefiles will not be
    7.12 -# affected, however. This is required for correct dependency management.
    7.13 -.NOTPARALLEL:
    7.14 -
    7.15 -# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
    7.16 -# /usr/ccs/bin/make lacks basically every other flow control mechanism.
    7.17 -TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
    7.18 -
    7.19 -# Assume we have GNU make, but check version.
    7.20 -ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
    7.21 -    ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
    7.22 -        $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
    7.23 -    endif
    7.24 -endif
    7.25 -
    7.26 -# Locate this Makefile
    7.27 -ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
    7.28 -    makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
    7.29 -else
    7.30 -    makefile_path:=$(lastword $(MAKEFILE_LIST))
    7.31 -endif
    7.32 -root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
    7.33 -
    7.34 -# ... and then we can include our helper functions
    7.35 -include $(dir $(makefile_path))/MakeHelpers.gmk
    7.36 -
    7.37 -$(eval $(call ParseLogLevel))
    7.38 -$(eval $(call ParseConfAndSpec))
    7.39 -
    7.40 -# Now determine if we have zero, one or several configurations to build.
    7.41 -ifeq ($(SPEC),)
    7.42 -    # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
    7.43 -else
    7.44 -    ifeq ($(words $(SPEC)),1)
    7.45 -        # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
    7.46 -        include $(dir $(makefile_path))/Main.gmk
    7.47 -    else
    7.48 -        # We are building multiple configurations.
    7.49 -        # First, find out the valid targets
    7.50 -        # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
    7.51 -        # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
    7.52 -        all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
    7.53 -            $(MAKE) -p -q -f  $(makefile_path) SPEC=$(firstword $(SPEC)) | \
    7.54 -            grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
    7.55 -
    7.56 -$(all_phony_targets):
    7.57 -	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
    7.58 -
    7.59 -    endif
    7.60 -endif
    7.61 -
    7.62 -# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
    7.63 -# If you addd more global targets, please update the variable global_targets in MakeHelpers.
    7.64 -
    7.65 -help:
    7.66 -	$(info )
    7.67 -	$(info OpenJDK Makefile help)
    7.68 -	$(info =====================)
    7.69 -	$(info )
    7.70 -	$(info Common make targets)
    7.71 -	$(info .  make [all]             # Compile all code but do not create images)
    7.72 -	$(info .  make images            # Create complete j2sdk and j2re images)
    7.73 -	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
    7.74 -	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
    7.75 -	$(info .  make install           # Install the generated images locally)
    7.76 -	$(info .  make clean             # Remove all files generated by make, but not those)
    7.77 -	$(info .                         # generated by configure)
    7.78 -	$(info .  make dist-clean        # Remove all files, including configuration)
    7.79 -	$(info .  make help              # Give some help on using make)
    7.80 -	$(info .  make test              # Run tests, default is all tests (see TEST below))
    7.81 -	$(info )
    7.82 -	$(info Targets for specific components)
    7.83 -	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
    7.84 -	$(info .  make <component>       # Build <component> and everything it depends on. )
    7.85 -	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
    7.86 -	$(info .                         # is faster but can result in incorrect build results!)
    7.87 -	$(info .  make clean-<component> # Remove files generated by make for <component>)
    7.88 -	$(info )
    7.89 -	$(info Useful make variables)
    7.90 -	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
    7.91 -	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
    7.92 -	$(info .                         # <substring>)
    7.93 -	$(info )
    7.94 -	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
    7.95 -	$(info .                         # Available log levels are:)
    7.96 -	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
    7.97 -	$(info .                         # To see executed command lines, use LOG=debug)
    7.98 -	$(info )
    7.99 -	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
   7.100 -	$(info .                         # Note that -jN does not work as expected!)
   7.101 -	$(info )
   7.102 -	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
   7.103 -	$(info .                         # make test TEST="jdk_lang jdk_net")
   7.104 -	$(info )
   7.105 -
   7.106 -configure:
   7.107 -	@$(SHELL) $(root_dir)/configure $(CONFIGURE_ARGS)
   7.108 -	@echo ====================================================
   7.109 -	@echo "Note: This is a non-recommended way of running configure."
   7.110 -	@echo "Instead, run 'sh configure' in the top-level directory"
   7.111 -
   7.112 -.PHONY: help configure
   7.113 +include ../../NewMakefile.gmk

mercurial