ohair@478: # ohair@478: # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. ohair@478: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@478: # ohair@478: # This code is free software; you can redistribute it and/or modify it ohair@478: # under the terms of the GNU General Public License version 2 only, as ohair@478: # published by the Free Software Foundation. Oracle designates this ohair@478: # particular file as subject to the "Classpath" exception as provided ohair@478: # by Oracle in the LICENSE file that accompanied this code. ohair@478: # ohair@478: # This code is distributed in the hope that it will be useful, but WITHOUT ohair@478: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@478: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@478: # version 2 for more details (a copy is included in the LICENSE file that ohair@478: # accompanied this code). ohair@478: # ohair@478: # You should have received a copy of the GNU General Public License version ohair@478: # 2 along with this work; if not, write to the Free Software Foundation, ohair@478: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@478: # ohair@478: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@478: # or visit www.oracle.com if you need additional information or have any ohair@478: # questions. ohair@478: # ohair@478: ohair@478: # Utilities used in this Makefile ohair@478: BASENAME=basename ohair@478: CAT=cat ohair@478: CD=cd ohair@478: CMP=cmp ohair@478: CP=cp ohair@478: ECHO=echo ohair@478: MKDIR=mkdir ohair@494: PRINTF=printf ohair@478: PWD=pwd ohair@494: TAR=tar ohair@478: ifeq ($(PLATFORM),windows) ohair@478: ZIP=zip ohair@478: else ohair@478: # store symbolic links as the link ohair@478: ZIP=zip -y ohair@478: endif ohair@478: # Insure we have a path that looks like it came from pwd ohair@478: # (This is mostly for Windows sake and drive letters) ohair@478: define UnixPath # path ohair@478: $(shell (cd "$1" && $(PWD))) ohair@478: endef ohair@478: ohair@478: # Current root directory ohair@478: CURRENT_DIRECTORY := $(shell $(PWD)) ohair@478: ohair@478: # Build directory root ohair@478: BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build ohair@478: ohair@478: # All configured Makefiles to run ohair@478: ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile) ohair@478: ohair@478: # All bundles to create ohair@478: ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image) ohair@478: ohair@478: # Build all the standard 'all', 'images', and 'clean' targets ohair@478: all images clean: checks ohair@478: @if [ "$(ALL_MAKEFILES)" = "" ] ; then \ ohair@478: $(ECHO) "ERROR: No configurations to build"; exit 1; \ ohair@478: fi ohair@478: @for bdir in $(dir $(ALL_MAKEFILES)) ; do \ ohair@494: $(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \ ohair@494: $(CD) $${bdir} && $(MAKE) $@ ; \ ohair@478: done ohair@478: ohair@494: # TBD: Deploy input ohair@494: $(BUILD_DIR_ROOT)/.deploy_input: ohair@494: @if [ "$(ALL_MAKEFILES)" = "" ] ; then \ ohair@494: $(ECHO) "ERROR: No configurations to build"; exit 1; \ ohair@494: fi ohair@494: @for bdir in $(dir $(ALL_MAKEFILES)) ; do \ ohair@494: if [ deploy/make/Makefile ] ; then \ ohair@494: echo "Attempting deploy build." ; \ ohair@494: ( \ ohair@494: $(RM) -r $${bdir}/deploy_input ; \ ohair@494: $(MKDIR) -p $${bdir}/deploy_input ; \ ohair@494: ( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \ ohair@494: | ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \ ohair@494: ) ; \ ohair@494: fi; \ ohair@494: done ohair@494: touch $@ ohair@494: ohair@494: # TBD: Deploy images ohair@494: deploy: $(BUILD_DIR_ROOT)/.deploy_input ohair@494: @if [ "$(ALL_MAKEFILES)" = "" ] ; then \ ohair@494: $(ECHO) "ERROR: No configurations to build"; exit 1; \ ohair@494: fi ohair@494: @for bdir in $(dir $(ALL_MAKEFILES)) ; do \ ohair@494: if [ deploy/make/Makefile ] ; then \ ohair@494: echo "Attempting deploy build." ; \ ohair@494: ( \ ohair@494: $(CD) deploy/make && \ ohair@494: $(MAKE) \ ohair@494: ABS_OUTPUTDIR=$${bdir}/deploy_input \ ohair@494: OUTPUTDIR=$${bdir}/deploy_input \ ohair@494: ) ; \ ohair@494: fi; \ ohair@494: done ohair@494: ohair@494: # TBD: Install bundles ohair@494: install: ohair@494: ohair@478: # Bundle creation ohair@478: bundles: ohair@478: @if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \ ohair@478: $(ECHO) "ERROR: No images to bundle"; exit 1; \ ohair@478: fi ohair@478: @for i in $(ALL_IMAGE_DIRS) ; do \ ohair@478: $(MKDIR) -p $${i}/../../bundles && \ ohair@478: $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \ ohair@478: $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ." && \ ohair@478: $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \ ohair@478: done ohair@478: ohair@478: # Clobber all the built files ohair@478: clobber:: ohair@478: $(RM) -r $(BUILD_DIR_ROOT) ohair@478: ohair@478: # Make various checks to insure the build will be successful ohair@478: # Possibilities: ohair@478: # * Check that if any closed repo is provided, they all must be. ohair@478: # * Check that all open repos exist, at least until we are ready for some ohair@478: # kind of partial build. ohair@478: checks: ohair@478: @$(ECHO) "No checks yet" ohair@478: ohair@494: # Keep track of user targets ohair@494: USER_TARGETS += all deploy install images clean clobber checks ohair@478: ohair@478: ########################################################################### ohair@478: # To help in adoption of the new configure&&make build process, a bridge ohair@478: # build will use the old settings to run configure and do the build. ohair@478: ohair@478: # Build with the configure bridge ohair@478: bridgeBuild: bridge2configure images ohair@478: ohair@478: # Bridge from old Makefile ALT settings to configure options ohair@494: bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts ohair@494: bash ./configure $(strip $(shell $(CAT) $<)) ohair@478: ohair@478: # Create a file with configure options created from old Makefile mechanisms. ohair@494: $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest ohair@478: $(RM) $@ ohair@478: $(CP) $< $@ ohair@478: ohair@478: # Use this file to only change when obvious things have changed ohair@494: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC ohair@478: $(RM) $@.tmp ohair@494: $(MKDIR) -p $(BUILD_DIR_ROOT) ohair@478: @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp ohair@478: ifdef ARCH_DATA_MODEL ohair@478: @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp ohair@478: endif ohair@478: ifdef ALT_PARALLEL_COMPILE_JOBS ohair@478: @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp ohair@478: endif ohair@478: ifdef ALT_BOOTDIR ohair@478: @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp ohair@478: endif ohair@478: ifdef ALT_CUPS_HEADERS_PATH ohair@478: @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp ohair@478: endif ohair@478: ifdef ALT_FREETYPE_HEADERS_PATH ohair@478: @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp ohair@478: endif ohair@478: @if [ -f $@ ] ; then \ ohair@478: if ! $(CMP) $@ $@.tmp > /dev/null ; then \ ohair@478: $(CP) $@.tmp $@ ; \ ohair@478: fi ; \ ohair@478: else \ ohair@478: $(CP) $@.tmp $@ ; \ ohair@478: fi ohair@478: $(RM) $@.tmp ohair@478: ohair@478: # Clobber all the built files ohair@478: clobber:: bridge2clobber ohair@478: bridge2clobber:: ohair@494: $(RM) $(BUILD_DIR_ROOT)/.bridge2* ohair@494: $(RM) $(BUILD_DIR_ROOT)/.deploy_input ohair@478: ohair@478: # Keep track of phony targets ohair@478: PHONY_LIST += bridge2configure bridgeBuild bridge2clobber ohair@478: ohair@478: ########################################################################### ohair@494: # Sanity checks (history target) ohair@494: # ohair@494: ohair@494: sanity: checks ohair@494: ohair@494: # Keep track of user targets ohair@494: USER_TARGETS += sanity ohair@494: ohair@494: ########################################################################### ohair@478: # Javadocs ohair@478: # ohair@478: ohair@478: javadocs: ohair@478: cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk ohair@478: ohair@494: # Keep track of user targets ohair@494: USER_TARGETS += javadocs ohair@478: ohair@478: ########################################################################### ohair@478: # JPRT targets ohair@478: ohair@478: ifndef JPRT_ARCHIVE_BUNDLE ohair@478: JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip ohair@478: endif ohair@478: ohair@478: jprt_build_product: DEBUG_LEVEL=release ohair@478: jprt_build_product: BUILD_DIRNAME=*-release ohair@478: jprt_build_product: jprt_build_generic ohair@478: ohair@478: jprt_build_fastdebug: DEBUG_LEVEL=fastdebug ohair@478: jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug ohair@478: jprt_build_fastdebug: jprt_build_generic ohair@478: ohair@478: jprt_build_debug: DEBUG_LEVEL=slowdebug ohair@478: jprt_build_debug: BUILD_DIRNAME=*-debug ohair@478: jprt_build_debug: jprt_build_generic ohair@478: ohair@478: jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE) ohair@478: ohair@478: $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles ohair@478: $(MKDIR) -p $(@D) ohair@478: $(RM) $@ ohair@478: $(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@ ohair@478: ohair@478: # Keep track of phony targets ohair@478: PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \ ohair@478: jprt_build_generic ohair@478: ohair@478: ########################################################################### ohair@494: # Help target ohair@494: ohair@494: HELP_FORMAT=%12s%s\n ohair@494: ohair@494: help: ohair@494: @$(PRINTF) "# JDK Makefile\n" ohair@494: @$(PRINTF) "#\n" ohair@494: @$(PRINTF) "# Usage: make [Target]\n" ohair@494: @$(PRINTF) "#\n" ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "Target " "Description" ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "------ " "-----------" ohair@494: @for i in $(USER_TARGETS) ; do \ ohair@494: $(MAKE) help_$${i} ; \ ohair@494: done ohair@494: @$(PRINTF) "#\n" ohair@494: ohair@494: help_all: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Build the entire jdk but not the images" ohair@494: help_images: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Create the jdk images for the builds" ohair@494: help_deploy: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Create the jdk deploy images from the jdk images" ohair@494: help_install: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Create the jdk install bundles from the deploy images" ohair@494: help_clean: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Clean and prepare for a fresh build from scratch" ohair@494: help_clobber: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Clean and also purge any hidden derived data" ohair@494: help_checks: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Perform various checks to make sure we can build" ohair@494: help_sanity: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Same as 'make checks'" ohair@494: help_javadocs: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Build the javadocs" ohair@494: help_help: ohair@494: @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \ ohair@494: "Print out the help messages" ohair@494: ohair@494: # Keep track of user targets ohair@494: USER_TARGETS += help ohair@494: ohair@494: ########################################################################### ohair@478: # Phony targets ohair@494: .PHONY: $(PHONY_LIST) $(USER_TARGETS) ohair@478: ohair@478: # Force target ohair@478: FRC: