From: Cristiano Giuffrida Date: Sun, 28 Dec 2014 12:20:47 +0000 (+0100) Subject: llvm: Build scripts improvements. X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=1e7bfb997f3565f54ad97cc87d7ff421a67bf50e;p=minix.git llvm: Build scripts improvements. Change-Id: I278cdebccdba18be7e264bfd240ff02d4480b33c --- diff --git a/minix/llvm/build.llvm b/minix/llvm/build.llvm index d980e5dbf..c3b7eb5d9 100755 --- a/minix/llvm/build.llvm +++ b/minix/llvm/build.llvm @@ -21,7 +21,7 @@ MINIX_MODS= # Set default values for essential variables : ${GENERATE_MAP="no"} -: ${C="servers,drivers"} +: ${C="servers,fs,net,drivers"} function usage() { @@ -120,7 +120,7 @@ if [ "${LLVMPASS_PATHS}" != "" ]; then OPTFLAGS=" ${OPTFLAGS} ${LLVMPASS_PATHS} ${LLVMARGS}" 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} do @@ -148,6 +148,10 @@ do echo "Error: Couldn't fetch the module name for $m" continue fi + if [ "$n" == "ramdisk" ] || [ "$n" == "memory" ]; then + (cd minix/llvm && C=$n ./relink.llvm) + continue + fi clean_module $n $m OPTFLAGS=`echo ${OPTFLAGS} | sed -e "s/\ /\\\ /g"` OPTFLAGS_PLACEHOLDER="OPTFLAGS.$n=${OPTFLAGS}" diff --git a/minix/llvm/configure.llvm b/minix/llvm/configure.llvm index d23e9afab..029a70139 100755 --- a/minix/llvm/configure.llvm +++ b/minix/llvm/configure.llvm @@ -72,11 +72,6 @@ ROOT_1=`echo ${ROOT} | sed "s/\\\//\\\\\\\\\//g"` sed -i "s/ROOT=.*$/ROOT=\"${ROOT_1}\"/g" ${MINIX_LLVM_DIR}/common.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 mkdir ${ROOT}/.tmp 2>/dev/null || true fi @@ -132,15 +127,17 @@ if [ "${REBUILD_MINIX}" == "yes" ]; then cd ${MYPWD} if [ "$EXITCODE" != "0" ]; then echo "Error: Failed building Minix source code." - exit $EXITCODE else echo "Completed building Minix source code." - exit $EXITCODE fi else echo "Building Minix: NO" 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.*) -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 diff --git a/minix/llvm/minix.inc b/minix/llvm/minix.inc index 88c5f649e..a34944f1e 100644 --- a/minix/llvm/minix.inc +++ b/minix/llvm/minix.inc @@ -19,8 +19,8 @@ function generate_modules_map() echo "Generating Minix modules map..." 1>&2 cd ${MINIX_ROOT} - 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 "^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" | ( while read line; do path=$(echo $line | cut -d' ' -f 1) progs=$(echo $line | cut -d' ' -f 2-) @@ -49,7 +49,8 @@ function generate_modules_map() blacklist="$blacklist -e ^tps65950=" blacklist="$blacklist -e ^tsl2550=" 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 rm -rf ${TMPFILE} ${TMPFILE}.1 ${TMPFILE}.2 @@ -68,7 +69,7 @@ function get_modules_path() if [ ! -f "${MINIX_MODULES_MAPFILE}" ]; then generate_modules_map 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}/" else MODULE_NAME="^${MODULE_NAME}=" diff --git a/minix/llvm/relink.llvm b/minix/llvm/relink.llvm index 700a0b9d6..06efa2071 100755 --- a/minix/llvm/relink.llvm +++ b/minix/llvm/relink.llvm @@ -20,7 +20,7 @@ LDFLAGS_PLACEHOLDER=" " # Set default values to essential variables. : ${GENERATE_MAP="no"} -: ${C="servers,drivers"} +: ${C="servers,fs,net,drivers"} function usage() { @@ -97,7 +97,7 @@ fi 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} do @@ -130,7 +130,7 @@ do fi env "`echo ${LDFLAGS_PLACEHOLDER}`" MKBITCODE=yes \ - ${TOOLDIR}/nbmake-${ARCH} -C $m + ${TOOLDIR}/nbmake-${ARCH} -C $m all install echo done