From 88dcce5b398fff03028f8bda8248f46f1d142c6c Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Fri, 30 Sep 2005 20:47:34 +0000 Subject: [PATCH] Reverted Makefiles dependencies. They don't do what I supossed. Added a first try of time and disk usage logging. Moved the make run to their own function. --- jhalfs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/jhalfs b/jhalfs index c2f2a5b..9919576 100755 --- a/jhalfs +++ b/jhalfs @@ -285,12 +285,9 @@ build_Makefile() { # and binutils in chapter 5) name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'` - # Set the dependency for the first target. - if [ -z $PREV ] ; then PREV=chapter4 ; fi - # Drop in the name of the target on a new line, and the # pevious target as a dependency. - echo -e "\n$i: $PREV" >> $MKFILE.tmp + echo -e "\n$i:" >> $MKFILE.tmp # Find the version of the command files, if it corresponds with the building of # a specific package @@ -313,8 +310,14 @@ build_Makefile() { echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp fi + # Inser date and disk usage at the top of the log file. + echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >\$(LOGDIR)/$i && \\" >> $MKFILE.tmp + # Insert the script run - echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >\$(LOGDIR)/$i 2>&1 && \\" >> $MKFILE.tmp + echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >>\$(LOGDIR)/$i 2>&1 && \\" >> $MKFILE.tmp + + # Inser date and disk usage at the bottom of the log file. + echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>\$(LOGDIR)/$i && \\" >> $MKFILE.tmp # Include a touch of the target name so make can check # if it's already been made. @@ -384,7 +387,7 @@ build_Makefile() { echo -e "\tln -sv \$(LFS)/tools / && \\" >> $MKFILE echo -e "\ttouch \$@\n" >> $MKFILE - echo "021-addinguser: 020-creatingtoolsdir" >> $MKFILE + echo "021-addinguser:" >> $MKFILE echo -e "\tgroupadd lfs && \\" >> $MKFILE echo -e "\tuseradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\" >> $MKFILE echo -e "\tchown lfs \$(LFS)/tools && \\" >> $MKFILE @@ -393,7 +396,7 @@ build_Makefile() { echo -e "\tchmod -R +x $JHALFSDIR/commands && \\" >> $MKFILE echo -e "\ttouch \$@\n" >> $MKFILE - echo "022-settingenvironment: 021-addinguser" >> $MKFILE + echo "022-settingenvironment:" >> $MKFILE echo -e "\techo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE echo -e "\techo \"set +h\" > /home/lfs/.bashrc && \\" >> $MKFILE echo -e "\techo \"umask 022\" >> /home/lfs/.bashrc && \\" >> $MKFILE @@ -403,9 +406,9 @@ build_Makefile() { echo -e "\techo \"export LFS LC_ALL PATH\" >> /home/lfs/.bashrc && \\" >> $MKFILE # Source the file where we place changing variables. echo -e "\techo \". $JHALFSDIR/envars\" >> /home/lfs/.bashrc && \\" >> $MKFILE - echo -e "\tchown lfs /home/lfs/.bash* && \\" >> $MKFILE + echo -e "\tchown lfs:lfs /home/lfs/.bash* && \\" >> $MKFILE echo -e "\ttouch envars && \\" >> $MKFILE - echo -e "\ttouch \$@\n" >> $MKFILE + echo -e "\ttouch \$@" >> $MKFILE # Bring over the items from the Makefile.tmp @@ -414,6 +417,14 @@ build_Makefile() { echo -ne "done\n" } +run_make() { + # Build the system + if [ -e $MKFILE ] ; then + echo -ne "Building the LFS system\n" + cd $JHALFSDIR && make + echo -ne "done\n" + fi +} if [ ! -d $JHALFSDIR ] ; then mkdir -p $JHALFSDIR @@ -431,6 +442,4 @@ fi get_book build_Makefile -if [ -e $MKFILE ] ; then - cd $JHALFSDIR && make -fi +#run_make