74 lines
1.2 KiB
Bash
Executable File
74 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
OK=0
|
|
FAIL=1
|
|
TOPDIR=`pwd`
|
|
LOG_FILE=$1.log
|
|
LOG_DIR=${TOPDIR}/log/
|
|
LOG=${LOG_DIR}/${LOG_FILE}
|
|
DEPENDENCY=${LOG_DIR}/DEPEND/$1.depend.txt
|
|
|
|
LOG_OK_DIR=${LOG_DIR}/OK
|
|
LOG_FAIL_DIR=${LOG_DIR}/FAIL
|
|
LOG_OK_FILE=${LOG_OK_DIR}/${LOG_FILE}.OK
|
|
LOG_FAIL_FILE=${LOG_FAIL_DIR}/${LOG_FILE}.FAIL
|
|
|
|
mkdir -p ${LOG_DIR}
|
|
mkdir -p ${LOG_OK_DIR}
|
|
mkdir -p ${LOG_FAIL_DIR}
|
|
mkdir -p ${LOG_DIR}/DEPEND
|
|
|
|
test=${OK}
|
|
|
|
function clean_files()
|
|
{
|
|
rm -f ${LOG}
|
|
rm -f ${LOG_OK_FILE}
|
|
rm -f ${LOG_FAIL_FILE}
|
|
rm -f ${DEPENDENCY}
|
|
}
|
|
|
|
function dirclean ()
|
|
{
|
|
make $1-dirclean > /dev/null 2>&1
|
|
}
|
|
|
|
function process ()
|
|
{
|
|
make $1 >> ${LOG} 2>&1 || test=${FAIL}
|
|
grep "\.tar\." ${LOG} > ${DEPENDENCY}
|
|
if [ ${test} == ${OK} ] ; then
|
|
mv ${LOG} ${LOG_OK_FILE}
|
|
echo "OK "
|
|
else
|
|
mv ${LOG} ${LOG_FAIL_FILE}
|
|
printf "FAIL "
|
|
echo \"$2\"
|
|
fi
|
|
}
|
|
|
|
function build_package ()
|
|
{
|
|
printf "mk %-31s" "$1"
|
|
if [ "$2X" == "X" ] ; then # no parameters
|
|
clean_files $1
|
|
dirclean $1
|
|
process $1
|
|
elif [ "$2X" == "OKX" ] ; then # Previous build was OK
|
|
clean_files $1
|
|
dirclean $1
|
|
process $1
|
|
elif [ "$2X" == "FAILX" ] ; then
|
|
clean_files $1
|
|
dirclean $1
|
|
process $1 $3
|
|
elif [ "$2X" == "BROKENX" ] ; then
|
|
printf "BROKEN "
|
|
echo \"$3\"
|
|
fi
|
|
}
|
|
|
|
build_package $1 $2 $3
|
|
|
|
|
|
|