1 # 2 # Copyright (c) 2012, 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 23 # questions. 24 # 25 26 # This file is included by the root NewerMakefile and contains targets 27 # and utilities needed by JPRT. 28 29 # Utilities used in this Makefile 30 CAT=cat 31 CMP=cmp 32 CP=cp 33 ECHO=echo 34 MKDIR=mkdir 35 PRINTF=printf 36 PWD=pwd 37 # Insure we have a path that looks like it came from pwd 38 # (This is mostly for Windows sake and drive letters) 39 define UnixPath # path 40 $(shell (cd "$1" && $(PWD))) 41 endef 42 43 BUILD_DIR_ROOT:=$(root_dir)/build 44 45 ########################################################################### 46 # To help in adoption of the new configure&&make build process, a bridge 47 # build will use the old settings to run configure and do the build. 48 49 # Build with the configure bridge. After running configure, restart make 50 # to parse the new spec file. 51 BRIDGE_TARGETS := all 52 bridgeBuild: bridge2configure 53 @cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS) 54 55 # Bridge from old Makefile ALT settings to configure options 56 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts 57 bash ./configure $(strip $(shell $(CAT) $<)) 58 59 # Create a file with configure options created from old Makefile mechanisms. 60 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest 61 $(RM) $@ 62 $(CP) $< $@ 63 64 # Use this file to only change when obvious things have changed 65 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC 66 $(RM) $@.tmp 67 $(MKDIR) -p $(BUILD_DIR_ROOT) 68 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp 69 ifdef ARCH_DATA_MODEL 70 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp 71 endif 72 ifeq ($(ARCH_DATA_MODEL),32) 73 @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp 74 endif 75 ifdef ALT_PARALLEL_COMPILE_JOBS 76 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp 77 endif 78 ifdef ALT_BOOTDIR 79 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp 80 endif 81 ifdef ALT_CUPS_HEADERS_PATH 82 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp 83 endif 84 ifdef ALT_FREETYPE_HEADERS_PATH 85 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp 86 endif 87 ifdef OPENJDK 88 @$(ECHO) " --enable-openjdk-only " >> $@.tmp 89 endif 90 # Todo: move to closed? 91 ifdef ALT_MOZILLA_HEADERS_PATH 92 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp 93 endif 94 ifdef ALT_JUNIT_DIR 95 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp 96 endif 97 ifdef ANT_HOME 98 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp 99 endif 100 ifdef ALT_JAVAFX_ZIP_DIR 101 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp 102 endif 103 ifdef ALT_WIXDIR 104 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp 105 endif 106 ifdef ALT_SLASH_JAVA 107 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp 108 endif 109 @if [ -f $@ ] ; then \ 110 if ! $(CMP) $@ $@.tmp > /dev/null ; then \ 111 $(CP) $@.tmp $@ ; \ 112 fi ; \ 113 else \ 114 $(CP) $@.tmp $@ ; \ 115 fi 116 $(RM) $@.tmp 117 118 PHONY_LIST += bridge2configure bridgeBuild 119 120 ########################################################################### 121 # JPRT targets 122 123 ifndef JPRT_ARCHIVE_BUNDLE 124 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip 125 endif 126 127 # These targets execute in a SPEC free context, before calling bridgeBuild 128 # to generate the SPEC. 129 jprt_build_product: DEBUG_LEVEL=release 130 jprt_build_product: BUILD_DIRNAME=*-release 131 jprt_build_product: jprt_build_generic 132 133 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug 134 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug 135 jprt_build_fastdebug: jprt_build_generic 136 137 jprt_build_debug: DEBUG_LEVEL=slowdebug 138 jprt_build_debug: BUILD_DIRNAME=*-debug 139 jprt_build_debug: jprt_build_generic 140 141 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle 142 jprt_build_generic: bridgeBuild 143 144 # This target must be called in the context of a SPEC file 145 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) 146 @$(call CheckIfMakeAtEnd) 147 148 # This target must be called in the context of a SPEC file 149 $(JPRT_ARCHIVE_BUNDLE): bundles 150 $(MKDIR) -p $(@D) 151 $(RM) $@ 152 $(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@ 153 154 # This target must be called in the context of a SPEC file 155 bundles: all 156 @$(call TargetEnter) 157 $(MKDIR) -p $(BUILD_OUTPUT)/bundles 158 $(CD) $(IMAGES_OUTPUTDIR)/j2sdk-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip . 159 $(CD) $(IMAGES_OUTPUTDIR)/j2re-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip . 160 @$(call TargetExit) 161 162 # Keep track of phony targets 163 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \ 164 jprt_build_generic bundles jprt_bundle 165 166 ########################################################################### 167 # Phony targets 168 .PHONY: $(PHONY_LIST) 169 170 # Force target 171 FRC: