r2493 - in jhalfs/branches/experimental: LFS common

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Sat Apr 8 09:30:12 PDT 2006


Author: manuel
Date: 2006-04-08 10:30:12 -0600 (Sat, 08 Apr 2006)
New Revision: 2493

Modified:
   jhalfs/branches/experimental/LFS/master.sh
   jhalfs/branches/experimental/common/func_ICA.sh
Log:
Added function to create iteration-N Makefile targets.

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-04-08 16:28:24 UTC (rev 2492)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-04-08 16:30:12 UTC (rev 2493)
@@ -219,6 +219,9 @@
 #----------------------------#
   echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9${R_arrow}"
 
+  # Reset $PREV for ICA runs
+  [[ "$RUN_ICA" != "0" ]] && PREV=iteration-last
+
   for file in chapter0{7,8,9}/* ; do
     # Keep the script file name
     this_script=`basename $file`

Modified: jhalfs/branches/experimental/common/func_ICA.sh
===================================================================
--- jhalfs/branches/experimental/common/func_ICA.sh	2006-04-08 16:28:24 UTC (rev 2492)
+++ jhalfs/branches/experimental/common/func_ICA.sh	2006-04-08 16:30:12 UTC (rev 2493)
@@ -4,6 +4,14 @@
 wrt_ica_targets() {                #
 #----------------------------------#
   local ICA_rebuild=$1
+  wrt_ica_rebuild "$ICA_rebuild"
+  wrt_iterations  "$ICA_rebuild"
+}
+
+#----------------------------------#
+wrt_ica_rebuild() {                #
+#----------------------------------#
+  local ICA_rebuild=$1
 (
     cat << EOF
 ICA_rebuild:  $ICA_rebuild
@@ -12,6 +20,62 @@
 ) >> $MKFILE
 }
 
+#----------------------------------#
+wrt_iterations() {                 #
+#----------------------------------#
+  local ICA_rebuild=$1
+
+  for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
+                                          # and "ITERATIONS" with no "$".
+   ITERATION=iteration-$N
+   if [ "$N" = "1" ] ; then
+(
+    cat << EOF
+$ITERATION:  chapter06
+	@do_ica_prep
+	@pushd logs && \\
+	mkdir $ITERATION && \\
+	mv $ICA_rebuild $ITERATION && \\
+	popd
+	@rm -f $ICA_rebuild
+	@touch \$@
+
+EOF
+) >> $MKFILE
+      PREV=$ITERATION
+    elif [ "$N" = "$ITERATIONS" ] ; then
+(
+    cat << EOF
+iteration-last: $PREV  ICA_rebuild
+	@do_ica_prep
+	@pushd logs && \\
+	mkdir iteration-last && \\
+	cp $ICA_rebuild iteration-last && \\
+	popd
+	@do_ica_work
+	@touch \$@
+
+EOF
+) >> $MKFILE
+    else
+(
+    cat << EOF
+$ITERATION: $PREV  ICA_rebuild
+	@do_ica_prep
+	@pushd logs && \\
+	mkdir $ITERATION && \\
+	mv $ICA_rebuild $ITERATION && \\
+	popd
+	@rm -f $ICA_rebuild
+	@touch \$@
+
+EOF
+) >> $MKFILE
+      PREV=$ITERATION
+    fi
+  done
+}
+
 # Acknowledgment:
 #  The following code is a modified version of an original work written by
 #  Greg Schafer for the "DIY Linux" project and is included here with his




More information about the alfs-log mailing list