housekeeping on func_makefile

This commit is contained in:
George Boudreau 2006-06-13 13:00:46 +00:00
parent 5d93cec9ac
commit c62275f61b

View file

@ -12,7 +12,7 @@ declare SCRIPT_ROOT=jhalfs
declare BUILD_SCRIPTS=scripts
declare TRACKING_DIR=/var/lib/jhalfs/BLFS
declare BUILDDIR=~/TRIAL
declare LOGDIR=$BUILDDIR/logs
#----------------------------------#
__wrt_target() { # Create target and initialize log file
@ -24,6 +24,7 @@ cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@./progress_bar.sh \$@ &
EOF
) >> $MKFILE.tmp
}
@ -31,13 +32,13 @@ EOF
#----------------------------------#
__write_build_cmd() { # Some scripts must be run as root..
__write_build_cmd() { #
#----------------------------------#
local this_script=$1
local file=$2
(
cat << EOF
@( time { export LFS=\$(MOUNT_PT) && ${BUILD_SCRIPTS}/$file >>\$(LOGDIR)/$this_script 2>&1 ; } ) 2>>\$(LOGDIR)/$this_script
@( time { export LFS=\$(MOUNT_PT) && ${BUILD_SCRIPTS}/${file} >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script}
EOF
) >> $MKFILE.tmp
}
@ -45,10 +46,11 @@ EOF
#----------------------------------#
__wrt_touch() { #
#----------------------------------#
local pkg_name=$1
(
cat << EOF
@touch \$@ && \\
touch /var/lib/jhalfs/BLFS/${1#*-} && \\
touch \$(TRACKING_DIR)/${pkg_name#*-} && \\
sleep .25 && \\
echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
echo --------------------------------------------------------------------------------\$(WHITE)
@ -60,9 +62,9 @@ EOF
#----------------------------#
__write_entry() { #
#----------------------------#
local pkg_name=$1
local script_name=$1
echo "${tab_}${tab_} entry for <$pkg_name>"
echo -n "${tab_}${tab_} entry for <$script_name>"
#--------------------------------------------------------------------#
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
@ -70,17 +72,17 @@ __write_entry() { #
#
# Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function.
__wrt_target "${pkg_name}" "$PREV_PACKAGE"
__write_build_cmd "${pkg_name}" "${pkg_name}"
__wrt_target "${script_name}" "$PREV_PACKAGE"
__write_build_cmd "${script_name}" "${script_name}"
# Include a touch of the target name so make can check
# if it's already been made.
__wrt_touch "${pkg_name}"
__wrt_touch "${script_name}"
#
#--------------------------------------------------------------------#
# >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------#
echo " .. OK"
}
#----------------------------#
@ -113,8 +115,8 @@ $HEADER
SRC= /sources
MOUNT_PT= $BUILDDIR
LOGDIR= $LOGDIR
PACKAGE= "`basename $PKGXML .xml`"
TRACKING_DIR= $TRACKING_DIR
BOLD= ""
RED= ""
@ -143,9 +145,9 @@ all : $pkg_list
EOF
) > $MKFILE
cat $MKFILE.tmp >> $MKFILE
echo "${tab_}Creating Makefile... ${BOLD}DONE${OFF}"
rm $MKFILE.tmp
}