Fixed some tagging, added a new sed to use 'cat' properly in the Makefile
This commit is contained in:
parent
48d7968b10
commit
9e406b5e3f
1 changed files with 21 additions and 12 deletions
11
jhalfs
11
jhalfs
|
@ -255,6 +255,7 @@ get_sources() {
|
|||
}
|
||||
|
||||
build_Makefile() {
|
||||
echo -n "Creating Makefile... "
|
||||
cd $JHALFSDIR/commands
|
||||
|
||||
# Start with a clean Makefile.tmp file
|
||||
|
@ -291,12 +292,19 @@ build_Makefile() {
|
|||
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
|
||||
|
@ -311,6 +319,7 @@ build_Makefile() {
|
|||
# Bring over the items from the Makefile.tmp
|
||||
cat $MKFILE.tmp >> $MKFILE
|
||||
rm $MKFILE.tmp
|
||||
echo -ne "done\n"
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue