Index: common/makefile-functions
===================================================================
--- common/makefile-functions	(revision 2ee1d113d416fe0ba8e9b8c8ec9522b246fd7afc)
+++ common/makefile-functions	(revision 9c9775f7c4ddcf151de34dc43d4404e9277da41c)
@@ -11,14 +11,22 @@
 
 OFF     = "[0m"
-BOLD    = "[1m"
 REVERSE = "[7m"
 
+tab_    = "	"
+nl_     = ""
+
+#==== BUILD MESSAGES ===
 
 define echo_PHASE
-  @clear
-  @echo $(BOLD)--------------------------------------------------------------------------------
-  @echo -e \\t\\tExecuting $(BLUE)$(1)$(WHITE) scripts
-  @echo $(BOLD)--------------------------------------------------------------------------------
-  #echo $(WHITE)
+  @echo $(BOLD)--------------------------------------------------------------------------------
+  @echo  $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
+  @echo $(BOLD)--------------------------------------------------------------------------------
+  @echo $(WHITE)
+endef
+
+define sh_echo_PHASE
+  echo $(BOLD)--------------------------------------------------------------------------------;\
+  echo  $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
+  echo $(BOLD)--------------------------------------------------------------------------------echo $(WHITE)
 endef
 
@@ -31,13 +39,11 @@
 
 define echo_SULUSER_request
-  @clear
   @echo $(BOLD)--------------------------------------------------------------------------------
   @echo $(BOLD)$(BLUE)$@
   @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
-  @echo su requires a password 
+  @echo sudo requires a password
 endef
 
 define echo_CHROOT_request
-  @clear
   @echo $(BOLD)--------------------------------------------------------------------------------
   @echo $(BOLD)$(BLUE)$@
@@ -51,9 +57,17 @@
 endef
 
+#=======================
+
+
+#=== BUILD FUNCTIONS ===
+
 define remove_existing_dirs
   @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
   ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
-  rm -rf $(SRCSDIR)/$$ROOT && \
-  rm -rf $(SRCSDIR)/$${ROOT%-*}-build
+  [ -n "$$ROOT" ] && \
+  if [ -d $(SRCDIR)/$$ROOT ]; then \
+    rm -rf $(SRCSDIR)/$$ROOT && \
+    rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \
+  fi;
 endef
 
@@ -61,27 +75,24 @@
   @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
   ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
-  rm -rf $(SRC)/$$ROOT && \
-  rm -rf $(SRC)/$${ROOT%-*}-build
-endef
-
-define remove_build_dirs
-  @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
-  rm -rf $(SRCSDIR)/$$ROOT && \
-  rm -rf $(SRCSDIR)/$(1)-build
-endef
-
-define remove_build_dirs2
-  @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
-  rm -rf $(SRC)/$$ROOT && \
-  rm -rf $(SRC)/$(1)-build
-endef
-
-define housekeeping
-  @touch  $@ && \
-  sleep .25 && \
-  echo  -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
-  echo --------------------------------------------------------------------------------$(WHITE)
-
-endef
+  [ -n "$$ROOT" ] && \
+  if [ -d $(SRC)/$$ROOT ]; then \
+    rm -rf $(SRC)/$$ROOT && \
+    rm -rf $(SRC)/$${ROOT%-*}-build; \
+  fi;
+endef
+
+#==#
+
+define unpack
+  @cd $(SRCSDIR) && \
+  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
+endef
+
+define unpack2
+  @cd $(SRC) && \
+  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
+endef
+
+#==#
 
 define get_pkg_root
@@ -105,28 +116,68 @@
 endef
 
-define unpack
-  @cd $(SRCSDIR) && \
-  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
-endef
-
-define unpack2
-  @cd $(SRCSDIR) && \
-  /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
-endef
-
-define unpack3
-  @cd $(SRC) && \
-  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
-endef
+#==#
+
+define touch_timestamp
+  @touch $(SRC)/timestamp-marker && sleep 1
+endef
+
+define touch_timestamp_LUSER
+  @touch $(SRCSDIR)/timestamp-marker && sleep 1
+endef
+
+define log_new_files
+  @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
+  -newer $(SRC)/timestamp-marker -not -type d \
+  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
+endef
+
+define log_new_files_LUSER
+  @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
+  -newer $(SRCSDIR)/timestamp-marker -not -type d \
+  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
+endef
+
+#==@
+
+define remove_build_dirs
+  @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
+  rm -rf $(SRCSDIR)/$$ROOT && \
+  rm -rf $(SRCSDIR)/$(1)-build
+endef
+
+define remove_build_dirs2
+  @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
+  rm -rf $(SRC)/$$ROOT && \
+  rm -rf $(SRC)/$(1)-build
+endef
+
+#==#
+
+define housekeeping
+  @touch  $@ && \
+  sleep .25 && \
+  echo  -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
+  echo --------------------------------------------------------------------------------$(WHITE) && \
+  if [ "$(BREAKPOINT)" = "$@" ] ; then \
+     echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \
+     false ; \
+  fi
+endef
+
+#=======================
+
+
+#==== FINAL MESSAGES ===
 
 define echo_report
-  @echo
-  @echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created
-  @echo
-  @echo ${WHITE}Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE)
-  @echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE)
-  @echo
-  @echo That will help us to keep more accurate SBU and
-  @echo disk usage values into the book. Thanks.
+  echo ; \
+  echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
+  echo ; \
+  echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \
+  echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \
+  echo ; \
+  echo That will help us to keep more accurate SBU and ; \
+  echo disk usage values into the book. Thanks. ; \
+  echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
 endef
 
@@ -136,5 +187,5 @@
   @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
   @echo --------------------------------------------------------------------------------
-  @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
+  @echo  $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
   @echo --------------------------------------------------------------------------------
   @echo
@@ -142,24 +193,24 @@
   @echo the next steps:$(WHITE)
   @echo
-  @echo -e \\t- Enter to the chroot using the command found
-  @echo -e \\tin the section -Entering the Chroot Environment-
-  @echo -e \\texcept if building CLFS with METHOD=boot.
-  @echo
-  @echo -e \\t- Set a password for the root user.
-  @echo
-  @echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
-  @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
-  @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
-  @echo -e \\tany other configuration file required to suit your needs.
-  @echo
-  @echo -e \\t- Exit from the chroot.
-  @echo
-  @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot.
-  @echo -e \\tYou can set-up the host bootloader or the new boot-loader
-  @echo -e \\tinstalled on the new system.
-  @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter
-  @echo -e \\tthe chroot and be sure that /dev is populated with the
-  @echo -e \\trequired devices before configure the boot-loader. When ready,
-  @echo -e \\texit from the chroot and umount the filesystems
+  @echo  $(tab_)- Enter to the chroot using the command found
+  @echo  $(tab_)in the section -Entering the Chroot Environment-
+  @echo  $(tab_)except if building CLFS with METHOD=boot.
+  @echo
+  @echo  $(tab_)- Set a password for the root user.
+  @echo
+  @echo  $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
+  @echo  $(tab_)/etc/sysconfig/console, /etc/sysconfig/network,
+  @echo  $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
+  @echo  $(tab_)any other configuration file required to suit your needs.
+  @echo
+  @echo  $(tab_)- Exit from the chroot.
+  @echo
+  @echo  $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot.
+  @echo  $(tab_)You can set-up the host bootloader or the new boot-loader
+  @echo  $(tab_)installed on the new system.
+  @echo  $(tab_)If the last, you must to mount the virtual filesystems, re-enter
+  @echo  $(tab_)the chroot and be sure that /dev is populated with the
+  @echo  $(tab_)required devices before configure the boot-loader. When ready,
+  @echo  $(tab_)exit from the chroot and umount the filesystems
   @echo
   @echo If you are an experienced LFS user, several of those steps can be
@@ -168,5 +219,5 @@
   @echo $(BOLD)
   @echo --------------------------------------------------------------------------------
-  @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
+  @echo  $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
   @echo --------------------------------------------------------------------------------$(WHITE)
 endef
@@ -177,11 +228,11 @@
   @echo        $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
   @echo --------------------------------------------------------------------------------
-  @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
+  @echo  $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
   @echo --------------------------------------------------------------------------------
   @echo
   @echo The build is not complete. Follow the next steps:$(WHITE)
   @echo
-  @echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab
-  @echo -e \\t and any other configuration file required to suit your needs.
+  @echo  $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab
+  @echo  $(tab_) and any other configuration file required to suit your needs.
   @echo $(BOLD)
   @echo $(BOLD)$(YELLOW)
@@ -189,9 +240,9 @@
   @echo  2.Boot the new partition.
   @echo  3.Once you are logged in issue the following commands
-  @echo -e \\t $(BOLD})cd /jhalfs
-  @echo -e \\t $(BOLD)make makesys
+  @echo  $(tab_) $(BOLD)cd /jhalfs
+  @echo  $(tab_) $(BOLD)make makesys
   @echo  The build process should resume. Follow any instructions that appear.
   @echo --------------------------------------------------------------------------------
-  @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
+  @echo  $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
   @echo --------------------------------------------------------------------------------$(WHITE)
 endef
