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