r1995 - jhalfs/trunk

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Sun Sep 11 19:53:49 PDT 2005


Author: jhuntwork
Date: 2005-09-11 20:53:48 -0600 (Sun, 11 Sep 2005)
New Revision: 1995

Modified:
   jhalfs/trunk/jhalfs
Log:
Fixed some tagging, added a new sed to use 'cat' properly in the Makefile

Modified: jhalfs/trunk/jhalfs
===================================================================
--- jhalfs/trunk/jhalfs	2005-09-12 02:04:26 UTC (rev 1994)
+++ jhalfs/trunk/jhalfs	2005-09-12 02:53:48 UTC (rev 1995)
@@ -255,6 +255,7 @@
 }
 
 build_Makefile() {
+  echo -n "Creating Makefile... "
   cd $JHALFSDIR/commands
  
   # Start with a clean Makefile.tmp file
@@ -291,26 +292,34 @@
 	fi
 
 	# Drop in the actual commands that were parsed from the book
+	# These seds add an extra $ to each variable so make doesn't break,
+	# add tabs to the beginning of each line, and add ' && \' to the end
+	# of each line except for those that end in '\'.
 	cat $i | sed -e 's:\$:&&:g' -e 's:^:\t:' -e 's:[^\\]$:& \&\& \\:' >> $MKFILE.tmp
-	sed -i -e '$s: \&\& \\::' $MKFILE.tmp -e 's|\$\$LFS|\$(LFS)|' $MKFILE.tmp
+	# This sed removes the ' && \' from the last command of each target
+	sed -i '$s: \&\& \\::' $MKFILE.tmp
 
 	# Include a touch of the target name so make can check if it's already been made.
 	echo -e "\ttouch \$@" >> $MKFILE.tmp
   done
+  # These seds turn the variables '$$LFS' into '$(LFS)' so make will understand,
+  # and remove the ' && \'s from the end of each line of a cat command.
+  sed -i -e 's|\$\$LFS|\$(LFS)|' -e '/^\tcat/,/^\tEOF/s/ \&\& \\//' $MKFILE.tmp
 
-	# Stick a variable and some defines at the top of the real makefile	
-	echo "export SRC := /sources" > $MKFILE
-	echo "export LFS := $BUILDDIR" >> $MKFILE
-	echo "define unpack" >> $MKFILE
-	echo -e "\t at cd \$(SRC) ; tar -xvf \$(1) > /tmp/unpacked" >> $MKFILE
-	echo -e "endef\n" >> $MKFILE
+  # Stick a variable and some defines at the top of the real makefile	
+  echo "export SRC := /sources" > $MKFILE
+  echo "export LFS := $BUILDDIR" >> $MKFILE
+  echo "define unpack" >> $MKFILE
+  echo -e "\t at cd \$(SRC) ; tar -xvf \$(1) > /tmp/unpacked" >> $MKFILE
+  echo -e "endef\n" >> $MKFILE
 
-	# Drop in the list as the main target 'all:' with each sub-target as a dependency.
-  	echo "all: $list" >> $MKFILE
+  # Drop in the list as the main target 'all:' with each sub-target as a dependency.
+  echo "all: $list" >> $MKFILE
 
-	# Bring over the items from the Makefile.tmp
-	cat $MKFILE.tmp >> $MKFILE
-	rm $MKFILE.tmp
+  # Bring over the items from the Makefile.tmp
+  cat $MKFILE.tmp >> $MKFILE
+  rm $MKFILE.tmp
+  echo -ne "done\n"
 }
 
 




More information about the alfs-log mailing list