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