common/makefiles/Jprt.gmk

changeset 594
2e12a508d7ae
parent 578
6e822b534678
child 587
5a5e97f9ac0a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/makefiles/Jprt.gmk	Sun Jan 20 23:35:25 2013 -0800
     1.3 @@ -0,0 +1,199 @@
     1.4 +#
     1.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +# This file is included by the root NewerMakefile and contains targets 
    1.30 +# and utilities needed by JPRT.
    1.31 +
    1.32 +# Utilities used in this Makefile. Most of this makefile executes without
    1.33 +# the context of a spec file from configure.
    1.34 +CAT=cat
    1.35 +CMP=cmp
    1.36 +CP=cp
    1.37 +ECHO=echo
    1.38 +MKDIR=mkdir
    1.39 +PRINTF=printf
    1.40 +PWD=pwd
    1.41 +# Insure we have a path that looks like it came from pwd
    1.42 +#   (This is mostly for Windows sake and drive letters)
    1.43 +define UnixPath # path
    1.44 +$(shell (cd "$1" && $(PWD)))
    1.45 +endef
    1.46 +
    1.47 +BUILD_DIR_ROOT:=$(root_dir)/build
    1.48 +
    1.49 +# Appears to be an open build
    1.50 +OPEN_BUILD := \
    1.51 +$(shell \
    1.52 +  if [    -d $(root_dir)/jdk/src/closed      \
    1.53 +       -o -d $(root_dir)/jdk/make/closed     \
    1.54 +       -o -d $(root_dir)/jdk/test/closed     \
    1.55 +       -o -d $(root_dir)/hotspot/src/closed  \
    1.56 +       -o -d $(root_dir)/hotspot/make/closed \
    1.57 +       -o -d $(root_dir)/hotspot/test/closed ] ; then \
    1.58 +    echo "false"; \
    1.59 +  else \
    1.60 +    echo "true"; \
    1.61 +  fi \
    1.62 + )
    1.63 +ifdef OPENJDK
    1.64 +  OPEN_BUILD=true
    1.65 +endif
    1.66 +
    1.67 +###########################################################################
    1.68 +# To help in adoption of the new configure&&make build process, a bridge
    1.69 +#   build will use the old settings to run configure and do the build.
    1.70 +
    1.71 +# Build with the configure bridge. After running configure, restart make
    1.72 +# to parse the new spec file.
    1.73 +BRIDGE_TARGETS := all
    1.74 +bridgeBuild: bridge2configure
    1.75 +	@cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS)
    1.76 +
    1.77 +# Bridge from old Makefile ALT settings to configure options
    1.78 +bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
    1.79 +	bash ./configure $(strip $(shell $(CAT) $<))
    1.80 +
    1.81 +# Create a file with configure options created from old Makefile mechanisms.
    1.82 +$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
    1.83 +	$(RM) $@
    1.84 +	$(CP) $< $@
    1.85 +
    1.86 +# Use this file to only change when obvious things have changed
    1.87 +$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
    1.88 +	$(RM) $@.tmp
    1.89 +	$(MKDIR) -p $(BUILD_DIR_ROOT)
    1.90 +	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
    1.91 +ifdef ARCH_DATA_MODEL
    1.92 +	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
    1.93 +endif
    1.94 +ifeq ($(ARCH_DATA_MODEL),32)
    1.95 +	@$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
    1.96 +endif
    1.97 +ifdef ALT_PARALLEL_COMPILE_JOBS
    1.98 +	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
    1.99 +endif
   1.100 +ifdef ALT_BOOTDIR
   1.101 +	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
   1.102 +endif
   1.103 +ifdef ALT_CUPS_HEADERS_PATH
   1.104 +	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
   1.105 +endif
   1.106 +ifdef ALT_FREETYPE_HEADERS_PATH
   1.107 +	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
   1.108 +endif
   1.109 +ifeq ($(OPEN_BUILD),true)
   1.110 +	@$(ECHO) " --enable-openjdk-only " >> $@.tmp
   1.111 +else
   1.112 +  # Todo: move to closed?
   1.113 +  ifdef ALT_MOZILLA_HEADERS_PATH
   1.114 +	@$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
   1.115 +  endif
   1.116 +  ifdef ALT_JUNIT_DIR
   1.117 +	@$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
   1.118 +  endif
   1.119 +  ifdef ANT_HOME
   1.120 +	@$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
   1.121 +  endif
   1.122 +  ifdef ALT_JAVAFX_ZIP_DIR
   1.123 +	@$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
   1.124 +  endif
   1.125 +  ifdef ALT_WIXDIR
   1.126 +	@$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
   1.127 +  endif
   1.128 +  ifdef ALT_CCSS_SIGNING_DIR
   1.129 +	@$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
   1.130 +  endif
   1.131 +  ifdef ALT_SLASH_JAVA
   1.132 +	@$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
   1.133 +  endif
   1.134 +endif
   1.135 +	@if [ -f $@ ] ; then \
   1.136 +          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
   1.137 +            $(CP) $@.tmp $@ ; \
   1.138 +          fi ; \
   1.139 +        else \
   1.140 +          $(CP) $@.tmp $@ ; \
   1.141 +        fi
   1.142 +	$(RM) $@.tmp
   1.143 +
   1.144 +PHONY_LIST += bridge2configure bridgeBuild
   1.145 +
   1.146 +###########################################################################
   1.147 +# JPRT targets
   1.148 +
   1.149 +ifndef JPRT_ARCHIVE_BUNDLE
   1.150 +  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
   1.151 +endif
   1.152 +
   1.153 +# These targets execute in a SPEC free context, before calling bridgeBuild
   1.154 +# to generate the SPEC.
   1.155 +jprt_build_product: DEBUG_LEVEL=release
   1.156 +jprt_build_product: BUILD_DIRNAME=*-release
   1.157 +jprt_build_product: jprt_build_generic
   1.158 +
   1.159 +jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
   1.160 +jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
   1.161 +jprt_build_fastdebug: jprt_build_generic
   1.162 +
   1.163 +jprt_build_debug: DEBUG_LEVEL=slowdebug
   1.164 +jprt_build_debug: BUILD_DIRNAME=*-debug
   1.165 +jprt_build_debug: jprt_build_generic
   1.166 +
   1.167 +jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
   1.168 +jprt_build_generic: bridgeBuild
   1.169 +
   1.170 +# This target must be called in the context of a SPEC file
   1.171 +jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
   1.172 +	@$(call CheckIfMakeAtEnd)
   1.173 +
   1.174 +# This target must be called in the context of a SPEC file
   1.175 +$(JPRT_ARCHIVE_BUNDLE): bundles
   1.176 +	$(MKDIR) -p $(@D)
   1.177 +	$(RM) $@
   1.178 +	$(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@
   1.179 +
   1.180 +# This target must be called in the context of a SPEC file
   1.181 +bundles: all
   1.182 +	@$(call TargetEnter)
   1.183 +	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
   1.184 +ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
   1.185 +	$(CD) $(JDK_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
   1.186 +	$(CD) $(JRE_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
   1.187 +else
   1.188 +	$(CD) $(JDK_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
   1.189 +	$(CD) $(JRE_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
   1.190 +endif
   1.191 +	@$(call TargetExit)
   1.192 +
   1.193 +# Keep track of phony targets
   1.194 +PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   1.195 +              jprt_build_generic bundles jprt_bundle
   1.196 +
   1.197 +###########################################################################
   1.198 +# Phony targets
   1.199 +.PHONY: $(PHONY_LIST)
   1.200 +
   1.201 +# Force target
   1.202 +FRC:

mercurial