Changeset 0fc4c75


Ignore:
Timestamp:
10/03/2005 12:56:55 AM (19 years ago)
Author:
Jeremy Huntwork <jhuntwork@…>
Branches:
0.2, 1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
47e0a38
Parents:
968dafd
Message:

Adjusted the use of '&&' and '@' for several commands in the Makefile. Added some nicer status messages. Also, no need to check if a package was built. If it fails, make will exit, we'll see where it failed via the status messages and we can check the logs for more details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jhalfs

    r968dafd r0fc4c75  
    148148MKFILE=$JHALFSDIR/Makefile
    149149XSL=dump-lfs-scripts.xsl
     150FNC=functions
    150151if [ -z $TEST ] ; then TEST=0 ; fi
    151152
     
    321322
    322323    # Drop in the name of the target on a new line, and the previous target
    323     # as a dependency.
     324    # as a dependency. Also call the echo_message function.
    324325    echo -e "\n$i:  $PREV" >> $MKFILE.tmp
     326    echo -e "\t@\$(call echo_message, Building)" >> $MKFILE.tmp
    325327
    326328    # Find the version of the command files, if it corresponds with the building of
     
    338340      # Insert instructions for unpacking the package and to set
    339341      # the PKGDIR variable.
    340       echo -e "\t\$(call unpack-lfs,$FILE)" >> $MKFILE.tmp
    341       echo -e "\t-ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     342      echo -e "\t@\$(call unpack-lfs,$FILE)" >> $MKFILE.tmp
     343      echo -e "\t@ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    342344      echo -e "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    343345      echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp
     
    347349    # Dump the path to the Binutils pass1 or TCL sources directory.
    348350    if [ "$i" = "027-binutils-pass1" -o "$i" = "032-tcl" ] ; then
    349       echo -e "\techo \"\$(LFS)\$(SRC)/\$\$ROOT\" > sources-dir && \\" >> $MKFILE.tmp
    350     fi
     351      echo -e "\techo \"\$(LFS)\$(SRC)/\$\$ROOT\" > sources-dir" >> $MKFILE.tmp
    351352
    352353    # Dump the path to the Binutils pass2 sources directory.
    353     if [ "$i" = "036-binutils-pass2" ] ; then
    354       echo -e "\techo \"\$(SRC)/\$\$ROOT\" > sources-dir && \\" >> $MKFILE.tmp
    355     fi
     354    elif [ "$i" = "036-binutils-pass2" ] ; then
     355      echo -e "\techo \"\$(SRC)/\$\$ROOT\" > sources-dir" >> $MKFILE.tmp
    356356
    357357    # For the Adjusting phase we must to cd to the binutils-build directory.
    358     if [ "$i" = "031-adjusting" ] ; then
     358    elif [ "$i" = "031-adjusting" ] ; then
    359359      echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/binutils-build\" > envars && \\" >> $MKFILE.tmp
    360       echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp
    361     fi
     360      echo -e "\techo \"export PKGDIR\" >> envars" >> $MKFILE.tmp
    362361
    363362    # For the Expect build we need to set the TCLPATH envar.
    364     if [ "$i" = "033-expect" ] ; then
     363    elif [ "$i" = "033-expect" ] ; then
    365364      echo -e "\techo \"TCLPATH=\`cat sources-dir\`\" >> envars && \\" >> $MKFILE.tmp
    366       echo -e "\techo \"export TCLPATH\" >> envars && \\" >> $MKFILE.tmp
     365      echo -e "\techo \"export TCLPATH\" >> envars" >> $MKFILE.tmp
     366
     367    # Everything else, add a true statment so we don't confuse make
     368    else
     369        echo -e "\ttrue" >> $MKFILE.tmp
    367370    fi
    368371
    369372    # Insert date and disk usage at the top of the log file.
    370     echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >logs/$i && \\" >> $MKFILE.tmp
     373    echo -e "\t@echo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >logs/$i && \\" >> $MKFILE.tmp
    371374
    372375    # Insert the script run
     
    374377
    375378    # Insert date and disk usage at the bottom of the log file.
    376     echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>logs/$i && \\" >> $MKFILE.tmp
     379    echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>logs/$i" >> $MKFILE.tmp
    377380
    378381    # Remove the build directory(ies) even if the package build fails, except for
     
    381384    if [ "$vrs" != "" ] ; then
    382385      if [ "$i" != "027-binutils-pass1" ] && [ "$i" != "032-tcl" ] && [ "$i" != "036-binutils-pass2" ] ; then
    383         echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     386        echo -e "\t@ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    384387        echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    385388        echo -e "\tif [ -e \$(LFS)\$(SRC)/$name-build ]; then \\" >> $MKFILE.tmp
     
    389392    fi
    390393    if [ "$i" = "027-binutils-pass1" -o "$i" = "036-binutils-pass2" ] ; then
    391       echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
     394      echo -e "\t@if [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
    392395      echo -e "\t\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    393396      echo -e "\t\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
     
    396399    fi
    397400    if [ "$i" = "032-tcl" ] ; then
    398       echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
     401      echo -e "\t@if [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
    399402      echo -e "\t\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    400403      echo -e "\t\trm -r \$(LFS)\$(SRC)/\$\$ROOT; \\" >> $MKFILE.tmp
     
    404407    # Remove the Binutils pass 1 sources after a successful Adjusting phase.
    405408    if [ "$i" = "031-adjusting" ] ; then
    406       echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
     409      echo -e "\t@if [ -e \$@ ] ; then \\" >> $MKFILE.tmp
    407410      echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
    408411      echo -e "\t\trm -r \$(LFS)\$(SRC)/binutils-build && \\" >> $MKFILE.tmp
     
    413416    # Remove the TCL sources after a successful Expect build.
    414417    if [ "$i" = "033-expect" ] ; then
    415       echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
     418      echo -e "\t@if [ -e \$@ ] ; then \\" >> $MKFILE.tmp
    416419      echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
    417420      echo -e "\t\trm sources-dir; \\" >> $MKFILE.tmp
     
    419422    fi
    420423
    421     # Check if the package has been successfully built.
    422     echo -e "\t@if [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
    423     echo -e "\t\techo \"The build of \$@ has failed\" && exit 1; \\" >> $MKFILE.tmp
    424     echo -e "\tfi;" >> $MKFILE.tmp
    425    
    426424    # Include a touch of the target name so make can check
    427425    # if it's already been made.
    428     echo -e "\ttouch \$@" >> $MKFILE.tmp
     426    echo -e "\t@touch \$@" >> $MKFILE.tmp
    429427
    430428    # Keep the script file name for Makefile dependencies.
     
    459457
    460458      # Insert instructions for unpacking the package and changing directories
    461       echo -e "\t\$(call unpack,$FILE)" >> $MKFILE.tmp
    462       echo -e "\t-ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     459      echo -e "\t@\$(call unpack,$FILE)" >> $MKFILE.tmp
     460      echo -e "\t@ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    463461      echo -e "\techo \"PKGDIR=\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp
    464462      echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp
     
    468466    if [ "$i" = "067-readjusting" ] ; then
    469467      echo -e "\techo \"PKGDIR=\$(SRC)/binutils-build\" > envars && \\" >> $MKFILE.tmp
    470       echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp
    471     fi
     468      echo -e "\techo \"export PKGDIR\" >> envars" >> $MKFILE.tmp
    472469
    473470    # Insert the script run
    474471    # For the mount of kernel filesystems we need to set LFS.
    475     if [ "$i" = "057-kernfs" ] ; then
     472    elif [ "$i" = "057-kernfs" ] ; then
    476473      echo -e "\techo \"LFS=\$(LFS)\" > envars && \\" >> $MKFILE.tmp
    477474      echo -e "\techo \"export LFS\" >> envars && \\" >> $MKFILE.tmp
     
    480477      echo -e "\t. envars && commands/$file >>logs/$i 2>&1 && \\" >> $MKFILE.tmp
    481478      # Insert date and disk usage at the bottom of the log file.
    482       echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>logs/$i && \\" >> $MKFILE.tmp
     479      echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>logs/$i" >> $MKFILE.tmp
    483480    else
    484481      # Insert date and disk usage at the top of the log file.
     
    486483      echo -e "\t. envars && commands/$file >>logs/$i 2>&1 && \\" >> $MKFILE.tmp
    487484      # Insert date and disk usage at the bottom of the log file.
    488       echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* /\`\\\n\" >>logs/$i && \\" >> $MKFILE.tmp
     485      echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* /\`\\\n\" >>logs/$i" >> $MKFILE.tmp
    489486    fi
    490487
    491488    # Remove the build directory(ies) even if the package build fails.
    492489    if [ "$vrs" != "" ] ; then
    493       echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     490      echo -e "\t@ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    494491      echo -e "\trm -r \$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    495492      echo -e "\tif [ -e \$(SRC)/$name-build ]; then \\" >> $MKFILE.tmp
     
    500497    # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
    501498    if [ "$i" = "067-readjusting" ] ; then
    502       echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
     499      echo -e "\t@if [ -e \$@ ] ; then \\" >> $MKFILE.tmp
    503500      echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
    504501      echo -e "\t\trm -r \$(SRC)/binutils-build && \\" >> $MKFILE.tmp
     
    507504    fi
    508505
    509     # Check if the package has been successfully built.
    510     echo -e "\t@if [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
    511     echo -e "\t\techo \"The build of \$@ has failed\" && exit 1; \\" >> $MKFILE.tmp
    512     echo -e "\tfi;" >> $MKFILE.tmp
    513 
    514506    # Include a touch of the target name so make can check
    515507    # if it's already been made.
    516     echo -e "\ttouch \$@" >> $MKFILE.tmp
     508    echo -e "\t@touch \$@" >> $MKFILE.tmp
    517509
    518510    # Keep the script file name for Makefile dependencies.
     
    524516  echo "export LFS := $BUILDDIR" >> $MKFILE
    525517  echo -e "export LOGDIR := $LOGDIR\n" >> $MKFILE
    526   echo "define unpack-lfs" >> $MKFILE
    527   echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE
    528   echo -e "endef\n" >> $MKFILE
    529   echo "define unpack" >> $MKFILE
    530   echo -e "\t@cd \$(SRC) ; tar -xvf \$(1) > /tmp/unpacked" >> $MKFILE
    531   echo -e "endef\n" >> $MKFILE
     518  echo "include functions" >> $MKFILE
    532519
    533520  # Drop in the main target 'all:' and the chapter targets with each sub-target
     
    563550  # for the lfs user.
    564551  echo "020-creatingtoolsdir:" >> $MKFILE
    565   echo -e "\tmkdir -v \$(LFS)/tools && \\" >> $MKFILE
     552  echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
     553  echo -e "\t@mkdir -v \$(LFS)/tools && \\" >> $MKFILE
    566554  echo -e "\tln -sv \$(LFS)/tools / && \\" >> $MKFILE
    567555  echo -e "\ttouch \$@\n" >> $MKFILE
    568556
    569557  echo "021-addinguser:  020-creatingtoolsdir" >> $MKFILE
    570   echo -e "\tgroupadd lfs && \\" >> $MKFILE
     558  echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
     559  echo -e "\t@groupadd lfs && \\" >> $MKFILE
    571560  echo -e "\tuseradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\" >> $MKFILE
    572561  echo -e "\tchown lfs \$(LFS)/tools && \\" >> $MKFILE
     
    577566
    578567  echo "022-settingenvironment:  021-addinguser" >> $MKFILE
    579   echo -e "\techo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE
     568  echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
     569  echo -e "\t@echo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE
    580570  echo -e "\techo \"set +h\" > /home/lfs/.bashrc && \\" >> $MKFILE
    581571  echo -e "\techo \"umask 022\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     
    619609
    620610if [ "$PWD" != "$JHALFSDIR" ] ; then
    621   cp $0 $XSL $JHALFSDIR/
     611  cp $0 $XSL $FNC $JHALFSDIR/
    622612fi
    623613
Note: See TracChangeset for help on using the changeset viewer.