Changeset 0209bb7 for jhalfs


Ignore:
Timestamp:
09/30/2005 06:51:32 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
0.2, 1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
8b33a10
Parents:
a5e49c6
Message:

Added Makefile dependencies.
Fixed the clean targets.
Remove sources directories even if the build fails (not full tested yet).
Automatically execute make after Makefile creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jhalfs

    ra5e49c6 r0209bb7  
    286286  name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
    287287
    288   # Drop in the name of the target on a new line.
    289   echo -e "\n$i:" >> $MKFILE.tmp
     288  # Set the dependency for the first target.
     289  if [ -z $PREV ] ; then PREV=chapter4 ; fi
     290
     291  # Drop in the name of the target on a new line, and the
     292  # pevious target as a dependency.
     293  echo -e "\n$i: $PREV" >> $MKFILE.tmp
    290294
    291295  # Find the version of the command files, if it corresponds with the building of
     
    304308    # the PKGDIR variable.
    305309    echo -e "\t\$(call unpack-lfs,$FILE)" >> $MKFILE.tmp
    306     echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     310    echo -e "\t-ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    307311    echo -e "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    308312    echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp
     
    311315
    312316  # Insert the script run
    313   echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >\$(LOGDIR)/$i.log 2>&1 && \\" >> $MKFILE.tmp
    314 
    315   # Remove the build directory(ies).
    316   # (How could it be deleted even if the package build fails?)
    317   if [ "$vrs" != "" ] ; then
    318     echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    319     echo -e "\tif [ -e \$(LFS)\$(SRC)/*-build ]; then \\" >> $MKFILE.tmp
    320     echo -e "\t\t rm -r \$(LFS)\$(SRC)/*-build; \\" >> $MKFILE.tmp
    321     echo -e "\tfi;" >> $MKFILE.tmp
    322   fi
     317  echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >\$(LOGDIR)/$i 2>&1 && \\" >> $MKFILE.tmp
    323318
    324319  # Include a touch of the target name so make can check
    325320  # if it's already been made.
    326321  echo -e "\ttouch \$@" >> $MKFILE.tmp
     322
     323  # Remove the build directory(ies) even if the package build fails.
     324  if [ "$vrs" != "" ] ; then
     325    echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
     326    echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
     327    echo -e "\tif [ -e \$(LFS)\$(SRC)/*-build ]; then \\" >> $MKFILE.tmp
     328    echo -e "\t\trm -r \$(LFS)\$(SRC)/*-build; \\" >> $MKFILE.tmp
     329    echo -e "\tfi;" >> $MKFILE.tmp
     330  fi
     331
     332  # Check if the package has been sucessfully build.
     333  echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
     334  echo -e "\t\techo \"The build of \$@ has failed\" && exit 1; \\" >> $MKFILE.tmp
     335  echo -e "\tfi;" >> $MKFILE.tmp
     336
     337  # Keep the script file name in a second variable for Makefile dependencies.
     338  PREV=$i
    327339
    328340  done
     
    343355  echo -e "all:  chapter4 chapter5\n" >> $MKFILE
    344356  echo -e "chapter4:  020-creatingtoolsdir 021-addinguser 022-settingenvironment\n" >> $MKFILE
    345   echo -e "chapter5: $chapter5\n" >> $MKFILE
     357  echo -e "chapter5:  chapter4 $chapter5\n" >> $MKFILE
    346358
    347359  # Clean targets
    348   echo "clean:  clean-chapter5 clean-chapter4" >> $MKFILE
     360  echo "clean-all:  clean" >> $MKFILE
     361  echo -e "\trm -rfv ./*\n" >> $MKFILE
     362
     363  echo -e "clean:  clean-chapter5 clean-chapter4\n" >> $MKFILE
    349364
    350365  echo "clean-chapter4:" >> $MKFILE
    351   echo -e "\tuserdel lfs && \\" >> $MKFILE
    352   echo -e "\trm -r /home/lfs && \\" >> $MKFILE
    353   echo -e "\trm -r \$(LFS)/tools && \\" >> $MKFILE
    354   echo -e "\trm /tools" >> $MKFILE
    355   echo -e "\trm 02*\n" >> $MKFILE
     366  echo -e "\t-userdel lfs" >> $MKFILE
     367  echo -e "\trm -rfv /home/lfs" >> $MKFILE
     368  echo -e "\trm -rfv \$(LFS)/tools" >> $MKFILE
     369  echo -e "\trm -fv /tools" >> $MKFILE
     370  echo -e "\trm -fv envars" >> $MKFILE
     371  echo -e "\trm -fv 02* logs/02*.log\n" >> $MKFILE
    356372
    357373  echo "clean-chapter5:" >> $MKFILE
    358   echo -e "\trm -r \$(LFS)/tools/* && \\" >> $MKFILE
    359   echo -e "\trm -f $chapter5\n" >> $MKFILE
     374  echo -e "\trm -rfv \$(LFS)/tools/*" >> $MKFILE
     375  echo -e "\trm -fv envars" >> $MKFILE
     376  echo -e "\trm -fv $chapter5" >> $MKFILE
     377  echo -e "\tcd logs && rm -fv $chapter5 && cd ..\n" >> $MKFILE
    360378
    361379  # The chapter4 sub-targets are hard-coded to can create the lfs user,
     
    367385  echo -e "\ttouch \$@\n" >> $MKFILE
    368386
    369   echo "021-addinguser:" >> $MKFILE
     387  echo "021-addinguser:  020-creatingtoolsdir" >> $MKFILE
    370388  echo -e "\tgroupadd lfs && \\" >> $MKFILE
    371389  echo -e "\tuseradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\" >> $MKFILE
     
    376394  echo -e "\ttouch \$@\n" >> $MKFILE
    377395
    378   echo "022-settingenvironment:" >> $MKFILE
     396  echo "022-settingenvironment:  021-addinguser" >> $MKFILE
    379397  echo -e "\techo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE
    380398  echo -e "\techo \"set +h\" > /home/lfs/.bashrc && \\" >> $MKFILE
     
    414432get_book
    415433build_Makefile
     434#make
Note: See TracChangeset for help on using the changeset viewer.