Thu, 04 Apr 2019 17:56:29 +0800
Merge
aoqi@0 | 1 | # |
aoqi@0 | 2 | # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | # |
aoqi@0 | 5 | # This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | # under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | # published by the Free Software Foundation. |
aoqi@0 | 8 | # |
aoqi@0 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | # accompanied this code). |
aoqi@0 | 14 | # |
aoqi@0 | 15 | # You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | # |
aoqi@0 | 19 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | # or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | # questions. |
aoqi@0 | 22 | # |
aoqi@0 | 23 | # |
aoqi@0 | 24 | |
aoqi@0 | 25 | set -e |
aoqi@0 | 26 | |
aoqi@0 | 27 | # Note that we currently do not have a way to set HotSpotMksHome in |
aoqi@0 | 28 | # the batch build, but so far this has not seemed to be a problem. The |
aoqi@0 | 29 | # reason this environment variable is necessary is that it seems that |
aoqi@0 | 30 | # Windows truncates very long PATHs when executing shells like MKS's |
aoqi@0 | 31 | # sh, and it has been found that sometimes `which sh` fails. |
aoqi@0 | 32 | |
aoqi@0 | 33 | if [ "x$HotSpotMksHome" != "x" ]; then |
aoqi@0 | 34 | TOOL_DIR="$HotSpotMksHome" |
aoqi@0 | 35 | else |
aoqi@0 | 36 | # HotSpotMksHome is not set so use the directory that contains "sh". |
aoqi@0 | 37 | # This works with both MKS and Cygwin. |
aoqi@0 | 38 | SH=`which sh` |
aoqi@0 | 39 | TOOL_DIR=`dirname "$SH"` |
aoqi@0 | 40 | fi |
aoqi@0 | 41 | |
aoqi@0 | 42 | DIRNAME="$TOOL_DIR/dirname" |
aoqi@0 | 43 | FIND="$TOOL_DIR/find" |
aoqi@0 | 44 | |
aoqi@0 | 45 | TYPE=$1 |
aoqi@0 | 46 | Platform_arch=$2 |
aoqi@0 | 47 | Platform_arch_model=$3 |
aoqi@0 | 48 | Platform_os_family=windows |
aoqi@0 | 49 | Platform_os_arch=windows_$Platform_arch |
aoqi@0 | 50 | |
aoqi@0 | 51 | WorkSpace=$4 |
aoqi@0 | 52 | GENERATED=$5 |
aoqi@0 | 53 | |
aoqi@0 | 54 | COMMONSRC_REL=src |
aoqi@0 | 55 | ALTSRC_REL=src/closed # Change this to pick up alt sources from somewhere else |
aoqi@0 | 56 | |
aoqi@0 | 57 | COMMONSRC=${WorkSpace}/${COMMONSRC_REL} |
aoqi@0 | 58 | ALTSRC=${WorkSpace}/${ALTSRC_REL} |
aoqi@0 | 59 | |
aoqi@0 | 60 | BASE_PATHS="`if [ -d ${ALTSRC}/share/vm ]; then $FIND ${ALTSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \); fi`" |
aoqi@0 | 61 | BASE_PATHS="${BASE_PATHS} ` $FIND ${COMMONSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)`" |
aoqi@0 | 62 | |
aoqi@0 | 63 | for sd in \ |
aoqi@0 | 64 | share/vm/gc_implementation/shared \ |
aoqi@0 | 65 | os/${Platform_os_family}/vm \ |
aoqi@0 | 66 | cpu/${Platform_arch}/vm \ |
aoqi@0 | 67 | os_cpu/${Platform_os_arch}/vm; do |
aoqi@0 | 68 | if [ -d "${ALTSRC}/${sd}" ]; then |
aoqi@0 | 69 | BASE_PATHS="${BASE_PATHS} ${ALTSRC}/${sd}" |
aoqi@0 | 70 | fi |
aoqi@0 | 71 | BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/${sd}" |
aoqi@0 | 72 | done |
aoqi@0 | 73 | |
aoqi@0 | 74 | BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles ${GENERATED}/tracefiles" |
aoqi@0 | 75 | |
aoqi@0 | 76 | if [ -d "${ALTSRC}/share/vm/jfr/buffers" ]; then |
aoqi@0 | 77 | BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/buffers" |
aoqi@0 | 78 | fi |
aoqi@0 | 79 | |
aoqi@0 | 80 | BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/share/vm/prims/wbtestmethods" |
aoqi@0 | 81 | |
aoqi@0 | 82 | # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS. |
aoqi@0 | 83 | if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then |
aoqi@0 | 84 | BASE_PATHS="${BASE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" |
aoqi@0 | 85 | fi |
aoqi@0 | 86 | BASE_PATHS="${BASE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" |
aoqi@0 | 87 | |
aoqi@0 | 88 | if [ -d "${ALTSRC}/share/vm/c1" ]; then |
aoqi@0 | 89 | COMPILER1_PATHS="${ALTSRC}/share/vm/c1" |
aoqi@0 | 90 | fi |
aoqi@0 | 91 | COMPILER1_PATHS="${COMPILER1_PATHS} ${COMMONSRC}/share/vm/c1" |
aoqi@0 | 92 | |
aoqi@0 | 93 | if [ -d "${ALTSRC}/share/vm/opto" ]; then |
aoqi@0 | 94 | COMPILER2_PATHS="${ALTSRC}/share/vm/opto" |
aoqi@0 | 95 | fi |
aoqi@0 | 96 | COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/opto" |
aoqi@0 | 97 | if [ -d "${ALTSRC}/share/vm/libadt" ]; then |
aoqi@0 | 98 | COMPILER2_PATHS="${COMPILER2_PATHS} ${ALTSRC}/share/vm/libadt" |
aoqi@0 | 99 | fi |
aoqi@0 | 100 | COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/libadt" |
aoqi@0 | 101 | COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles" |
aoqi@0 | 102 | |
aoqi@0 | 103 | # Include dirs per type. |
aoqi@0 | 104 | case "${TYPE}" in |
aoqi@0 | 105 | "compiler1") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS}" ;; |
aoqi@0 | 106 | "compiler2") Src_Dirs="${BASE_PATHS} ${COMPILER2_PATHS}" ;; |
aoqi@0 | 107 | "tiered") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;; |
aoqi@0 | 108 | "zero") Src_Dirs="${BASE_PATHS}" ;; |
aoqi@0 | 109 | "shark") Src_Dirs="${BASE_PATHS}" ;; |
aoqi@0 | 110 | esac |
aoqi@0 | 111 | |
aoqi@0 | 112 | COMPILER2_SPECIFIC_FILES="opto libadt bcEscapeAnalyzer.cpp c2_* runtime_*" |
aoqi@0 | 113 | COMPILER1_SPECIFIC_FILES="c1_*" |
aoqi@0 | 114 | SHARK_SPECIFIC_FILES="shark" |
aoqi@0 | 115 | ZERO_SPECIFIC_FILES="zero" |
aoqi@0 | 116 | |
aoqi@0 | 117 | # Always exclude these. |
aoqi@0 | 118 | Src_Files_EXCLUDE="jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp" |
aoqi@0 | 119 | |
aoqi@0 | 120 | # Exclude per type. |
aoqi@0 | 121 | case "${TYPE}" in |
aoqi@0 | 122 | "compiler1") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; |
aoqi@0 | 123 | "compiler2") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; |
aoqi@0 | 124 | "tiered") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; |
aoqi@0 | 125 | "zero") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; |
aoqi@0 | 126 | "shark") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES}" ;; |
aoqi@0 | 127 | esac |
aoqi@0 | 128 | |
aoqi@0 | 129 | # Special handling of arch model. |
aoqi@0 | 130 | case "${Platform_arch_model}" in |
aoqi@0 | 131 | "x86_32") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} *x86_64*" ;; |
aoqi@0 | 132 | "x86_64") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} *x86_32*" ;; |
aoqi@0 | 133 | esac |
aoqi@0 | 134 | |
aoqi@0 | 135 | # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. |
aoqi@0 | 136 | function findsrc { |
aoqi@0 | 137 | $FIND ${1}/. ! -name . -prune \ |
aoqi@0 | 138 | -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \ |
aoqi@0 | 139 | -a \! \( -name ${Src_Files_EXCLUDE// / -o -name } \) \ |
aoqi@0 | 140 | | sed 's/.*\/\(.*\)/\1/'; |
aoqi@0 | 141 | } |
aoqi@0 | 142 | |
aoqi@0 | 143 | Src_Files= |
aoqi@0 | 144 | for e in ${Src_Dirs}; do |
aoqi@0 | 145 | Src_Files="${Src_Files}`findsrc ${e}` " |
aoqi@0 | 146 | done |
aoqi@0 | 147 | |
aoqi@0 | 148 | Obj_Files=" " |
aoqi@0 | 149 | for e in ${Src_Files}; do |
aoqi@0 | 150 | o="${e%\.[!.]*}.obj" |
aoqi@0 | 151 | set +e |
aoqi@0 | 152 | chk=`expr "${Obj_Files}" : ".* $o"` |
aoqi@0 | 153 | set -e |
aoqi@0 | 154 | if [ "$chk" != 0 ]; then |
aoqi@0 | 155 | echo "# INFO: skipping duplicate $o" |
aoqi@0 | 156 | continue |
aoqi@0 | 157 | fi |
aoqi@0 | 158 | Obj_Files="${Obj_Files}$o " |
aoqi@0 | 159 | done |
aoqi@0 | 160 | |
aoqi@0 | 161 | echo Obj_Files=${Obj_Files} |