llvm: Build scripts improvements.

Change-Id: I278cdebccdba18be7e264bfd240ff02d4480b33c
This commit is contained in:
Cristiano Giuffrida 2014-12-28 13:20:47 +01:00 committed by David van Moolenbroek
parent 04c5ac3eb5
commit 1e7bfb997f
4 changed files with 20 additions and 18 deletions

View file

@ -21,7 +21,7 @@ MINIX_MODS=
# Set default values for essential variables # Set default values for essential variables
: ${GENERATE_MAP="no"} : ${GENERATE_MAP="no"}
: ${C="servers,drivers"} : ${C="servers,fs,net,drivers"}
function usage() function usage()
{ {
@ -120,7 +120,7 @@ if [ "${LLVMPASS_PATHS}" != "" ]; then
OPTFLAGS=" ${OPTFLAGS} ${LLVMPASS_PATHS} ${LLVMARGS}" OPTFLAGS=" ${OPTFLAGS} ${LLVMPASS_PATHS} ${LLVMARGS}"
fi fi
TARGET_MODULES=`echo $C | sed -e "s/,/ /g"` TARGET_MODULES=`echo " $C " | sed -e "s/,/ /g" -e "s/ rd / ramdisk memory /g"`
for m in ${TARGET_MODULES} for m in ${TARGET_MODULES}
do do
@ -148,6 +148,10 @@ do
echo "Error: Couldn't fetch the module name for $m" echo "Error: Couldn't fetch the module name for $m"
continue continue
fi fi
if [ "$n" == "ramdisk" ] || [ "$n" == "memory" ]; then
(cd minix/llvm && C=$n ./relink.llvm)
continue
fi
clean_module $n $m clean_module $n $m
OPTFLAGS=`echo ${OPTFLAGS} | sed -e "s/\ /\\\ /g"` OPTFLAGS=`echo ${OPTFLAGS} | sed -e "s/\ /\\\ /g"`
OPTFLAGS_PLACEHOLDER="OPTFLAGS.$n=${OPTFLAGS}" OPTFLAGS_PLACEHOLDER="OPTFLAGS.$n=${OPTFLAGS}"

View file

@ -72,11 +72,6 @@ ROOT_1=`echo ${ROOT} | sed "s/\\\//\\\\\\\\\//g"`
sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/common.inc sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/common.inc
. ${MINIX_LLVM_DIR}/minix.inc . ${MINIX_LLVM_DIR}/minix.inc
# Configure llvm-apps
cp ${ROOT}/conf/common.overrides.llvm-minix.inc ${ROOT}/common.overrides.llvm.inc
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
echo "_MINIX_ROOT=\"${MINIX_ROOT_1}\"" > ${ROOT}/common.overrides.minix.inc
if [ ! -d ${ROOT}/.tmp ]; then if [ ! -d ${ROOT}/.tmp ]; then
mkdir ${ROOT}/.tmp 2>/dev/null || true mkdir ${ROOT}/.tmp 2>/dev/null || true
fi fi
@ -132,15 +127,17 @@ if [ "${REBUILD_MINIX}" == "yes" ]; then
cd ${MYPWD} cd ${MYPWD}
if [ "$EXITCODE" != "0" ]; then if [ "$EXITCODE" != "0" ]; then
echo "Error: Failed building Minix source code." echo "Error: Failed building Minix source code."
exit $EXITCODE
else else
echo "Completed building Minix source code." echo "Completed building Minix source code."
exit $EXITCODE
fi fi
else else
echo "Building Minix: NO" echo "Building Minix: NO"
fi fi
# Reconfigure llvm-apps # Configure llvm-apps
cp ${ROOT}/conf/common.overrides.llvm-minix.inc ${ROOT}/common.overrides.llvm.inc
MINIX_ROOT_1=`readlink -f ${MINIX_ROOT}`
MINIX_TOOLS_DIR=$(readlink -f ${MINIX_ROOT}/../obj.i386/tooldir.*) MINIX_TOOLS_DIR=$(readlink -f ${MINIX_ROOT}/../obj.i386/tooldir.*)
echo "MINIX_TOOLS_DIR=\"${MINIX_TOOLS_DIR}\"" >> ${ROOT}/common.overrides.minix.inc echo "_MINIX_ROOT=\"${MINIX_ROOT_1}\"" > ${ROOT}/common.overrides.minix.inc
echo "_MINIX_TOOLS_DIR=\"${MINIX_TOOLS_DIR}\"" >> ${ROOT}/common.overrides.minix.inc
exit $EXITCODE

View file

@ -19,8 +19,8 @@ function generate_modules_map()
echo "Generating Minix modules map..." 1>&2 echo "Generating Minix modules map..." 1>&2
cd ${MINIX_ROOT} cd ${MINIX_ROOT}
grep -r "^PROG=" . --include=Makefile | sed -e "s/\s*//g" | sed -e "s/PROG=//g" > ${TMPFILE} grep -r "^PROG *=" . --include=Makefile | sed -e "s/\s*//g" | sed -e "s/PROG *=//g" > ${TMPFILE}
grep -r "^PROGS=" . --include=Makefile | sed -e "s/\s\s*/ /g" | sed -e "s/PROGS=//g" | sed -e "s/\.\///g" | ( grep -r "^PROGS *=" . --include=Makefile | sed -e "s/\s\s*/ /g" | sed -e "s/PROGS *=//g" | sed -e "s/\.\///g" | (
while read line; do while read line; do
path=$(echo $line | cut -d' ' -f 1) path=$(echo $line | cut -d' ' -f 1)
progs=$(echo $line | cut -d' ' -f 2-) progs=$(echo $line | cut -d' ' -f 2-)
@ -49,7 +49,8 @@ function generate_modules_map()
blacklist="$blacklist -e ^tps65950=" blacklist="$blacklist -e ^tps65950="
blacklist="$blacklist -e ^tsl2550=" blacklist="$blacklist -e ^tsl2550="
blacklist="$blacklist -e ^usbd=" blacklist="$blacklist -e ^usbd="
grep -v -e ^${GREP_FILTER}= -e ^memory= $blacklist ${TMPFILE}.2 > ${OUTFILE} grep -v -e ^${GREP_FILTER}= -e ^ramdisk -e ^memory= $blacklist ${TMPFILE}.2 > ${OUTFILE}
echo ramdisk=minix/drivers/storage/ramdisk >> ${OUTFILE} # ramdisk always second last
echo memory=minix/drivers/storage/memory >> ${OUTFILE} # memory always last echo memory=minix/drivers/storage/memory >> ${OUTFILE} # memory always last
rm -rf ${TMPFILE} ${TMPFILE}.1 ${TMPFILE}.2 rm -rf ${TMPFILE} ${TMPFILE}.1 ${TMPFILE}.2
@ -68,7 +69,7 @@ function get_modules_path()
if [ ! -f "${MINIX_MODULES_MAPFILE}" ]; then if [ ! -f "${MINIX_MODULES_MAPFILE}" ]; then
generate_modules_map generate_modules_map
fi fi
if [ $MODULE_NAME == "servers" ] || [ $MODULE_NAME == "drivers" ]; then if [ $MODULE_NAME == "servers" ] || [ $MODULE_NAME == "drivers" ] || [ $MODULE_NAME == "fs" ] || [ $MODULE_NAME == "net" ] || [ $MODULE_NAME == "commands" ]; then
MODULE_NAME="=minix/${MODULE_NAME}/" MODULE_NAME="=minix/${MODULE_NAME}/"
else else
MODULE_NAME="^${MODULE_NAME}=" MODULE_NAME="^${MODULE_NAME}="

View file

@ -20,7 +20,7 @@ LDFLAGS_PLACEHOLDER=" "
# Set default values to essential variables. # Set default values to essential variables.
: ${GENERATE_MAP="no"} : ${GENERATE_MAP="no"}
: ${C="servers,drivers"} : ${C="servers,fs,net,drivers"}
function usage() function usage()
{ {
@ -97,7 +97,7 @@ fi
STATIC_LIBS=`find_static_libs $*` STATIC_LIBS=`find_static_libs $*`
TARGET_MODULES=`echo $C | sed -e "s/,/ /g"` TARGET_MODULES=`echo " $C " | sed -e "s/,/ /g" -e "s/ rd / ramdisk memory /g"`
for m in ${TARGET_MODULES} for m in ${TARGET_MODULES}
do do
@ -130,7 +130,7 @@ do
fi fi
env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes \ env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes \
${TOOLDIR}/nbmake-${ARCH} -C $m ${TOOLDIR}/nbmake-${ARCH} -C $m all install
echo echo
done done