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@478: PWD=pwd ohair@478: SH=sh 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@478: $(ECHO) "$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@" ; \ ohair@478: $(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@ ; \ ohair@478: done ohair@478: 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@478: # Keep track of phony targets ohair@478: PHONY_LIST += all 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@478: bridge2configure: .bridge2configureOpts ohair@478: $(CD) common/makefiles && sh ../autoconf/configure $(strip $(shell $(CAT) $<)) ohair@478: ohair@478: # Create a file with configure options created from old Makefile mechanisms. ohair@478: .bridge2configureOpts: .bridge2configureOptsLatest ohair@478: $(RM) $@ ohair@478: $(CP) $< $@ ohair@478: ohair@478: # In case make was invoked from a specific path ohair@478: _MAKE_COMMAND_PATH:=$(firstword $(MAKE)) ohair@478: ifneq ($(dir $(_MAKE_COMMAND_PATH)),./) ohair@478: # This could be removed someday if JPRT was fixed and we could assume that ohair@478: # the path to make was always in PATH. ohair@478: MAKE_BINDIR:=$(call UnixPath,$(dir $(_MAKE_COMMAND_PATH))) ohair@478: NEWPATH:=$(MAKE_BINDIR):${PATH} ohair@478: PATH:=$(NEWPATH) ohair@478: export PATH ohair@478: MAKE_COMMAND=$(MAKE_BINDIR)/$(notdir $(_MAKE_COMMAND_PATH)) ohair@478: else ohair@478: MAKE_COMMAND=$(_MAKE_COMMAND_PATH) ohair@478: endif ohair@478: ohair@478: # Use this file to only change when obvious things have changed ohair@478: .bridge2configureOptsLatest: FRC ohair@478: $(RM) $@.tmp ohair@478: @$(ECHO) " MAKE=$(MAKE_COMMAND) " >> $@.tmp 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@478: $(RM) .bridge2* ohair@478: ohair@478: # Keep track of phony targets ohair@478: PHONY_LIST += bridge2configure bridgeBuild bridge2clobber ohair@478: ohair@478: ########################################################################### ohair@478: # Javadocs ohair@478: # ohair@478: ohair@478: javadocs: ohair@478: cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk ohair@478: ohair@478: # Keep track of phony targets ohair@478: PHONY_LIST += 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: EXTRA_MAKE_ARGS=LOG=nofile,info 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@478: # Phony targets ohair@478: .PHONY: $(PHONY_LIST) ohair@478: ohair@478: # Force target ohair@478: FRC: ohair@478: