source: CLFS/master.sh@ dbf2c71

experimental
Last change on this file since dbf2c71 was 1ce084e, checked in by George Boudreau <georgeb@…>, 19 years ago

Added $ tag

  • Property mode set to 100755
File size: 46.0 KB
RevLine 
[0170229]1#!/bin/sh
[1ce084e]2# $Id$
[0170229]3
4###################################
5### FUNCTIONS ###
6###################################
7
8unset extract_commands
9#----------------------------#
10extract_commands() { #
11#----------------------------#
12
13 #Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
14 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
15 exit 1"
16
17 cd $JHALFSDIR
18 VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
19
20 # Start clean
21 if [ -d ${PROGNAME}-commands ]; then
22 rm -rf ${PROGNAME}-commands
23 else
24 mkdir -v ${PROGNAME}-commands
25 fi
26 echo "Extracting commands... ${BOLD}START${OFF}"
27
28 echo "${tab_}Extracting commands for ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
29 xsltproc --xinclude \
30 --nonet \
31 --output ./${PROGNAME}-commands/ \
32 $BOOK/stylesheets/dump-commands.xsl $BOOK/$ARCH-index.xml
33
34 # Grab the patches and package names.
35 cd $JHALFSDIR
36
37 echo "${tab_}Creating the packages and patches files" ;
38 for i in patches packages ; do rm -f $i ; done
39
40 grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
41 -e 's@">@"@' \
42 -e '/generic/d' >> packages
43
44 # Download the vim-lang package if it must be installed
45 if [ "$VIMLANG" = "1" ] ; then
46 echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
47 fi
48
49 grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
50 # Needed for Groff patchlevel patch
51 GROFFLEVEL=`grep "groff-patchlevel" $BOOK/general.ent | sed -e 's/groff-patchlevel //' \
52 -e 's/"//g' \
53 -e 's@<!ENTITY @@' \
54 -e 's|>||'`
55 sed -i 's|&groff-patchlevel;|'$GROFFLEVEL'|' patches
56
57
58 # Preprocess the cmd scripts..
59 echo "${tab_}Preprocessing the cmd scripts"
60 #
61 local file this_script package vrs URLs
62 #
63 # Create a list of URLs..
64 echo "${tab_}${tab_}Writing a list of URLs to filelist_.wget "
65 xsltproc --nonet \
66 --xinclude \
67 -o filelist_.wget \
68 $BOOK/stylesheets/wget.xsl \
69 $BOOK/$ARCH-index.xml > /dev/null 2>&1
70 #
71 # Loop through all the command scripts
72 echo "${tab_}${tab_}Modifying the cmd scripts"
73 for file in `ls ${PROGNAME}-commands/*/*`;do
74 #
75 # 1. Compress the script file (remove blank lines)
76 # 2. Add a variable header and a footer to selected scripts
77 this_script=`basename $file`
78 #
79 # DO NOT play with the chroot scripts.. they are used as is later
80 [[ `_IS_ $this_script "chroot"` ]] && continue
81 #
82 # Strip leading index number and misc test.. This is a miserable method
83 package=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
84 -e 's@-static@@' \
85 -e 's@-final@@' \
86 -e 's@temp-@@' \
87 -e 's@-64bit@@' \
88 -e 's@-64@@' \
89 -e 's@64@@' \
90 -e 's@-n32@@' \
91 -e 's@-build@@' \
92 -e 's@glibc-headers@glibc@'`
93 #
94 # Find the package version of the command files
95 #
96 # A little package name manipulation
97 case $package in
98 bootscripts) package="lfs-bootscripts" ;;
99 kernel) package="linux" ;;
100 esac
101 vrs=`grep "^$package-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
102 #
103 # If $vrs isn't empty, we've got a package...
104 # NOTE: The included \n causes the separator to be written
105 # on the next line. This is for cosmetic purposes only...
106 #
107 # Set the appropriate 'sha-bang'.. depending of the phase..
108 case $package in
109 *introduction* | \
110 *changingowner* | \
111 *creatingdirs* | \
112 *createfiles* ) sha_bang=''
113 ;;
114 *) sha_bang='#!/bin/bash'
115 ;;
116 esac
117 #
118 #
119 if [ "$vrs" != "" ] ; then
120 HEADER_STR="cd \$PKGDIR${nl_}#------------------"
121 FOOTER_STR="#------------------${nl_}exit"
122 else
123 HEADER_STR="#------------------"
124 FOOTER_STR="#------------------${nl_}exit"
125 fi
126 PKG_URL=`grep -e "$package-$vrs.*tar." $JHALFSDIR/filelist_.wget` && true
127 PATCHES=`grep "$package-$vrs.*patch" $JHALFSDIR/filelist_.wget` && true
128 #
129 # There would be no URL for a cmd only script, reset package name
130 if [[ $PKG_URL = "" ]]; then
131 package=""
132 fi
133(
134cat << EOF
135${sha_bang}
136set -e
137
138#####################################
139 NAME=${this_script}
140 PACKAGE=${package}
141 VERSION=${vrs}
142 PKG_URL=( ${PKG_URL} )
143 PATCHES=( ${PATCHES} )
144#####################################
145
146${HEADER_STR}
147`grep '.' ${file}`
148${FOOTER_STR}
149EOF
150) > tmp.script
151mv tmp.script ${file}
152
153 done # for file in `ls $PROGNAME-commands/*/*`
154 #
155 # Make the scripts executable.
156 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
157
158 # Done. Moving on...
159 echo "Extracting commands... ${BOLD}DONE${OFF}"
160 get_sources
161
162}
163
164
165
166#----------------------------#
167host_prep_Makefiles() { # Initialization of the system
168#----------------------------#
169 local LFS_HOST
170
171 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
172
173 # defined here, only for ease of reading
174 LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
175(
176cat << EOF
177023-creatingtoolsdir:
178 @\$(call echo_message, Building)
179 @mkdir -v \$(MOUNT_PT)/tools && \\
180 rm -fv /tools && \\
181 ln -sv \$(MOUNT_PT)/tools /
182 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
183 mkdir \$(MOUNT_PT)/sources; \\
184 fi;
185 @chmod a+wt \$(MOUNT_PT)/sources && \\
186 touch \$@
187
188024-creatingcrossdir: 023-creatingtoolsdir
189 @mkdir -v \$(MOUNT_PT)/cross-tools && \\
190 rm -fv /cross-tools && \\
191 ln -sv \$(MOUNT_PT)/cross-tools /
192 @touch \$@
193
194025-addinguser: 024-creatingcrossdir
195 @\$(call echo_message, Building)
196 @if [ ! -d /home/lfs ]; then \\
197 groupadd lfs; \\
198 useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
199 else \\
200 touch user-lfs-exist; \\
201 fi;
202 @chown lfs \$(MOUNT_PT) && \\
203 chown lfs \$(MOUNT_PT)/tools && \\
204 chown lfs \$(MOUNT_PT)/cross-tools && \\
205 chown lfs \$(MOUNT_PT)/sources && \\
206 touch \$@
207
208026-settingenvironment: 025-addinguser
209 @\$(call echo_message, Building)
210 @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
211 mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
212 fi;
213 @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
214 mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
215 fi;
216 @echo "set +h" > /home/lfs/.bashrc && \\
217 echo "umask 022" >> /home/lfs/.bashrc && \\
218 echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
219 echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
220 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
221 echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
222 echo "" >> /home/lfs/.bashrc && \\
223 echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
224 echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
225 echo "" >> /home/lfs/.bashrc && \\
226 echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
227 echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
228 echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
229 echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
230 @chown lfs:lfs /home/lfs/.bashrc && \\
231 touch envars && \\
232 touch \$@
233EOF
234) >> $MKFILE.tmp
235
236}
237
238
239
240#-----------------------------#
241cross_tools_Makefiles() { #
242#-----------------------------#
243 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
244
245 for file in cross-tools/* ; do
246 # Keep the script file name
247 this_script=`basename $file`
248 #
249 # Skip this script...
250 case $this_script in
251 *cflags* | *variables* ) # work done in host_prep_Makefiles
252 continue; ;;
253 *) ;;
254 esac
255 #
256 # Set the dependency for the first target.
257 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
258
259 # First append each name of the script files to a list (this will become
260 # the names of the targets in the Makefile
261 cross_tools="$cross_tools $this_script"
262
263 # Grab the name of the target (minus the -headers or -cross in the case of gcc
264 # and binutils in chapter 5)
265 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
266 -e 's@-static@@' \
267 -e 's@-final@@' \
268 -e 's@-headers@@' \
269 -e 's@-64@@' \
270 -e 's@-n32@@'`
271 # Adjust 'name' and patch a few scripts on the fly..
272 case $name in
273 linux-libc) name=linux-libc-headers ;;
274 esac
275 #
276 # Find the version of the command files, if it corresponds with the building of a specific package
277 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
278
279
280 #--------------------------------------------------------------------#
281 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
282 #--------------------------------------------------------------------#
283 #
284 # Drop in the name of the target on a new line, and the previous target
285 # as a dependency. Also call the echo_message function.
286 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
287 #
288 # If $vrs isn't empty, we've got a package...
289 #
290 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar"
291 #
292 wrt_run_as_lfs "${this_script}" "${file}"
293 #
294 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
295 #
296 # Include a touch of the target name so make can check if it's already been made.
297 echo -e '\t@touch $@' >> $MKFILE.tmp
298 #
299 #--------------------------------------------------------------------#
300 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
301 #--------------------------------------------------------------------#
302 #
303 # Keep the script file name for Makefile dependencies.
304 PREV=$this_script
305
306 done # for file in ....
307}
308
309
310#-----------------------------#
311temptools_Makefiles() { #
312#-----------------------------#
313 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
314
315 for file in temp-system/* ; do
316 # Keep the script file name
317 this_script=`basename $file`
318 #
319 # First append each name of the script files to a list (this will become
320 # the names of the targets in the Makefile
321 temptools="$temptools $this_script"
322
323 #
324 # Grab the name of the target, strip id number, XXX-script
325 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
326 #
327 # Find the version of the command files, if it corresponds with the building of a specific package
328 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
329
330
331 #--------------------------------------------------------------------#
332 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
333 #--------------------------------------------------------------------#
334 #
335 # Drop in the name of the target on a new line, and the previous target
336 # as a dependency. Also call the echo_message function.
337 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
338 #
339 # If $vrs isn't empty, we've got a package...
340 # Insert instructions for unpacking the package and to set the PKGDIR variable.
341 #
342 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar"
343 #
344 wrt_run_as_lfs "${this_script}" "${file}"
345 #
346 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
347 #
348 # Include a touch of the target name so make can check if it's already been made.
349 echo -e '\t@touch $@' >> $MKFILE.tmp
350 #
351 #--------------------------------------------------------------------#
352 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
353 #--------------------------------------------------------------------#
354 #
355 # Keep the script file name for Makefile dependencies.
356 PREV=$this_script
357 done # for file in ....
358}
359
360
361#-----------------------------#
362boot_Makefiles() { #
363#-----------------------------#
364 echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
365
366 for file in boot/* ; do
367 # Keep the script file name
368 this_script=`basename $file`
369
370 # A little housekeeping on the scripts
371 case $this_script in
372 *grub*) continue ;;
373 *whatnext*) continue ;;
374 *settingenvironment*) sed 's@PS1=@set +h\nPS1=@' -i $file ;;
[4845f38]375 *kernel) # if there is no kernel config file do not build the kernel
376 [[ -z $CONFIG ]] && continue
377 sed "s|make mrproper|make mrproper\ncp $CONFIG .config|" -i $file
378 # You cannot run menuconfig from within the makefile
379 sed 's|menuconfig|oldconfig|' -i $file
380 #If defined include the keymap in the kernel
381 if [[ -n "$KEYMAP" ]]; then
382 sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
383 else
384 sed '/loadkeys -m/d' -i $file
385 sed '/drivers\/char/d' -i $file
386 fi
[0170229]387 ;;
388 esac
389 #
390 # First append each name of the script files to a list (this will become
391 # the names of the targets in the Makefile
392 boottools="$boottools $this_script"
393 #
394 # Grab the name of the target, strip id number and misc words.
395 case $this_script in
396 *kernel) name=linux ;;
397 *bootscripts) name=lfs-bootscripts ;;
398 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
399 esac
400
401 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
402
403 #--------------------------------------------------------------------#
404 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
405 #--------------------------------------------------------------------#
406 #
407 # Drop in the name of the target on a new line, and the previous target
408 # as a dependency. Also call the echo_message function.
409 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
410 #
411 # If $vrs isn't empty, we've got a package...
412 # Insert instructions for unpacking the package and changing directories
413 #
414 [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
415 #
416 # Select a script execution method
417 case $this_script in
418 *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
419 *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
420 *fstab*) if [[ -n "$FSTAB" ]]; then
421 wrt_copy_fstab "${this_script}"
422 else
423 wrt_run_as_lfs "${this_script}" "${file}"
424 fi
425 ;;
426 *) wrt_run_as_lfs "${this_script}" "${file}" ;;
427 esac
428 #
429 # Housekeeping...remove any build directory(ies) except if the package build fails.
430 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
431 #
432 # Include a touch of the target name so make can check if it's already been made.
433 echo -e '\t@touch $@' >> $MKFILE.tmp
434 #
435 #--------------------------------------------------------------------#
436 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
437 #--------------------------------------------------------------------#
438 #
439 # Keep the script file name for Makefile dependencies.
440 PREV=$this_script
441
442 done
443 # This will force the Makefile to exit and not allow it to be restarted with
444 # the command <make>, The user will have to issue the cmd <make chapterXX>
445 echo -e "\t@\$(call echo_boot_finished,$VERSION) && \\" >> $MKFILE.tmp
446 echo -e "\tfalse" >> $MKFILE.tmp
447}
448
449
450#-----------------------------#
451chroot_Makefiles() { #
452#-----------------------------#
453 echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
454
455 for file in chroot/* ; do
456 # Keep the script file name
457 this_script=`basename $file`
458 #
459 # Skipping scripts is done now and not included in the build tree.
460 [[ `_IS_ $this_script chroot` ]] && continue
461
462 #
463 # First append each name of the script files to a list (this will become
464 # the names of the targets in the Makefile
465 chroottools="$chroottools $this_script"
466
467 #
468 # A little housekeeping on the script contents
469 case $this_script in
470 *kernfs*) sed '/exit/d' -i $file ;;
471 *pwdgroup*) sed '/exec/d' -i $file ;;
472 esac
473 #
474 # Grab the name of the target, strip id number, XXX-script
475 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
476 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
477
478 #--------------------------------------------------------------------#
479 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
480 #--------------------------------------------------------------------#
481 #
482 # Drop in the name of the target on a new line, and the previous target
483 # as a dependency. Also call the echo_message function.
484 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
485 #
486 # If $vrs isn't empty, we've got a package...
487 # Insert instructions for unpacking the package and changing directories
488 #
489 if [ "$vrs" != "" ] ; then
490 case $this_script in
491 *util-linux) wrt_unpack "$name-$vrs.tar" ;;
492 *) wrt_unpack2 "$name-$vrs.tar.*" ;;
493 esac
494 fi
495 #
496 # Select a script execution method
497 case $this_script in
498 *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
499 *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
500 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
501 esac
502 #
503 # Housekeeping...remove the build directory(ies), except if the package build fails.
504 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
505 #
506 # Include a touch of the target name so make can check if it's already been made.
507 echo -e '\t@touch $@' >> $MKFILE.tmp
508 #
509 #--------------------------------------------------------------------#
510 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
511 #--------------------------------------------------------------------#
512 #
513 # Keep the script file name for Makefile dependencies.
514 PREV=$this_script
515
516 done # for file in...
517}
518
519
520#-----------------------------#
521testsuite_tools_Makefiles() { #
522#-----------------------------#
523 echo "${tab_}${GREEN}Processing... ${L_arrow}testsuite tools${R_arrow}"
524
525 for file in testsuite-tools/* ; do
526 # Keep the script file name
527 this_script=`basename $file`
528
529 # First append each name of the script files to a list (this will become
530 # the names of the targets in the Makefile
531 testsuitetools="$testsuitetools $this_script"
532
533 # Grab the name of the target, strip id number, XXX-script
534 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
535 -e 's@-64bit@@' \
536 -e 's@-64@@' \
537 -e 's@64@@' \
538 -e 's@n32@@'`
539
540 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
541
542 #--------------------------------------------------------------------#
543 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
544 #--------------------------------------------------------------------#
545 #
546 # Drop in the name of the target on a new line, and the previous target
547 # as a dependency. Also call the echo_message function.
548 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
549 #
550 case $name in
551 tcl) wrt_unpack2 "$name$vrs-src.tar" ;;
552 *) wrt_unpack2 "$name-$vrs.tar" ;;
553 esac
554 #
555 wrt_run_as_chroot1 "${this_script}" "${file}"
556 #
557 wrt_remove_build_dirs "${name}"
558 #
559 # Include a touch of the target name so make can check if it's already been made.
560 echo -e '\t@touch $@' >> $MKFILE.tmp
561 #
562 #--------------------------------------------------------------------#
563 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
564 #--------------------------------------------------------------------#
565 #
566 # Keep the script file name for Makefile dependencies.
567 PREV=$this_script
568
569 done
570}
571
572
573#--------------------------------#
574bm_testsuite_tools_Makefiles() { #
575#--------------------------------#
576 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) testsuite tools${R_arrow}"
577
578 for file in testsuite-tools/* ; do
579 # Keep the script file name
580 this_script=`basename $file`
581
582 # First append each name of the script files to a list (this will become
583 # the names of the targets in the Makefile
584 testsuitetools="$testsuitetools $this_script"
585
586 # Grab the name of the target, strip id number, XXX-script
587 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
588 -e 's@-64bit@@' \
589 -e 's@-64@@' \
590 -e 's@64@@' \
591 -e 's@n32@@'`
592
593 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
594
595 #--------------------------------------------------------------------#
596 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
597 #--------------------------------------------------------------------#
598 #
599 # Drop in the name of the target on a new line, and the previous target
600 # as a dependency. Also call the echo_message function.
601 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
602 #
603 case $name in
604 tcl) wrt_unpack4 "$name$vrs-src.tar.*" ;;
605 *) wrt_unpack4 "$name-$vrs.tar.*" ;;
606 esac
607 #
608 wrt_run_as_root2 "${this_script}" "${file}"
609 #
610 wrt_remove_build_dirs2 "${name}"
611 #
612 # Include a touch of the target name so make can check if it's already been made.
613 echo -e '\t@touch $@' >> $MKFILE.tmp
614 #
615 #--------------------------------------------------------------------#
616 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
617 #--------------------------------------------------------------------#
618 #
619 # Keep the script file name for Makefile dependencies.
620 PREV=$this_script
621
622 done
623}
624
625
626#-----------------------------#
627final_system_Makefiles() { #
628#-----------------------------#
629 echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
630
631 for file in final-system/* ; do
632 # Keep the script file name
633 this_script=`basename $file`
634
635 # Skipping scripts is done now so they are not included in the Makefile.
636 case $this_script in
637 *stripping*) continue ;;
638 *grub*) continue ;;
639 esac
640 #
641 # First append each name of the script files to a list (this will become
642 # the names of the targets in the Makefile
643 basicsystem="$basicsystem $this_script"
644 #
645 # A little customizing via sed scripts first..
646 if [[ $TEST = "0" ]]; then
647 # Drop any package checks..
648 sed -e '/make check/d' -e '/make test/d' -i $file
649 fi
650 case $this_script in
651 *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
652 *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
653 *vim*) sed '/vim -c/d' -i $file ;;
654 *bash*) sed '/exec /d' -i $file ;;
655 *shadow*) sed -e '/grpconv/d' -e '/pwconv/d' -e '/passwd root/d' -i $file
656 sed '/sed -i libtool/d' -i $file
657 sed '/search_path/d' -i $file
658 ;;
659 *glibc*) sed '/tzselect/d' -i $file
660 sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
661 # Manipulate glibc's test to work with Makefile
662 sed -e 's/glibc-check-log.*//' \
663 -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
664 ;;
665 *binutils*) sed '/expect /d' -i $file
666 if [[ $TOOLCHAINTEST = "0" ]]; then
667 sed '/make check/d' -i $file
668 fi
669 ;;
670 *gcc*) # Ignore all gcc testing for now..
671 sed -e '/make -k check/d' -i $file
672 sed -e '/test_summary/d' -i $file
673 ;;
674 *texinfo*) # This sucks as a way to trim a script
675 sed -e '/cd \/usr/d' \
676 -e '/rm dir/d' \
677 -e '/for f in/d' \
678 -e '/do inst/d' \
679 -e '/done/d' -i $file
680 ;;
681 esac
682
683 # Grab the name of the target, strip id number, XXX-script
684 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
685 -e 's@temp-@@' \
686 -e 's@-64bit@@' \
687 -e 's@-64@@' \
688 -e 's@64@@' \
689 -e 's@n32@@'`
690
691 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
692
693 #--------------------------------------------------------------------#
694 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
695 #--------------------------------------------------------------------#
696 #
697 # Drop in the name of the target on a new line, and the previous target
698 # as a dependency. Also call the echo_message function.
699 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
700
701 # If $vrs isn't empty, we've got a package...
702 if [ "$vrs" != "" ] ; then
703 case $name in
704 temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
705 *) wrt_unpack2 "$name-$vrs.tar.*" ;;
706 esac
707 #
708 # Export a few 'config' vars..
709 case $this_script in
710 *glibc*) # For glibc we can set then TIMEZONE envar.
711 wrt_export_timezone ;;
712 *groff*) # For Groff we need to set PAGE envar.
713 wrt_export_pagesize ;;
714 esac
715 fi
716 #
717 wrt_run_as_chroot1 "${this_script}" "${file}"
718 #
719 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
720 #
721 # Include a touch of the target name so make can check if it's already been made.
722 echo -e '\t@touch $@' >> $MKFILE.tmp
723 #
724 #--------------------------------------------------------------------#
725 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
726 #--------------------------------------------------------------------#
727 #
728 # Keep the script file name for Makefile dependencies.
729 PREV=$this_script
730
731 done # for file in final-system/* ...
732}
733
734
735#-----------------------------#
736bm_final_system_Makefiles() { #
737#-----------------------------#
738 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) final system${R_arrow}"
739
740 for file in final-system/* ; do
741 # Keep the script file name
742 this_script=`basename $file`
743
744 # Skipping scripts is done now so they are not included in the Makefile.
745 case $this_script in
746 *stripping*) continue ;;
747 *grub*) continue ;;
748 esac
749
750 # First append each name of the script files to a list (this will become
751 # the names of the targets in the Makefile
752 basicsystem="$basicsystem $this_script"
753
754 #
755 # A little customizing via sed scripts first..
756 if [[ $TEST = "0" ]]; then
757 # Drop any package checks..
758 sed -e '/make check/d' -e '/make test/d' -i $file
759 fi
760 case $this_script in
761 *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
762 *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
763 *vim*) sed '/vim -c/d' -i $file ;;
764 *bash*) sed '/exec /d' -i $file ;;
765 *shadow*) sed -e '/grpconv/d' \
766 -e '/pwconv/d' \
767 -e '/passwd root/d' -i $file
768 sed '/sed -i libtool/d' -i $file
769 sed '/search_path/d' -i $file
770 ;;
771 *psmisc*) # Build fails on creation of this link. <pidof> installed in sysvinit
772 sed -e 's/^ln -s/#ln -s/' -i $file
773 ;;
774 *glibc*) sed '/tzselect/d' -i $file
775 sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
776 # Manipulate glibc's test to work with Makefile
777 sed -e 's/glibc-check-log.*//' -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
778 ;;
779 *binutils*) sed '/expect /d' -i $file
780 if [[ $TOOLCHAINTEST = "0" ]]; then
781 sed '/make check/d' -i $file
782 fi
783 ;;
784 *gcc*) # Ignore all gcc testing for now..
785 sed -e '/make -k check/d' -i $file
786 sed -e '/test_summary/d' -i $file
787 ;;
788 *texinfo*) # This sucks as a way to trim a script
789 sed -e '/cd \/usr/d' \
790 -e '/rm dir/d' \
791 -e '/for f in/d' \
792 -e '/do inst/d' \
793 -e '/done/d' -i $file
794 ;;
795 esac
796
797 # Grab the name of the target, strip id number, XXX-script
798 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
799 -e 's@temp-@@' \
800 -e 's@-64bit@@' \
801 -e 's@-64@@' \
802 -e 's@64@@' \
803 -e 's@n32@@'`
804
805 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
806
807 #--------------------------------------------------------------------#
808 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
809 #--------------------------------------------------------------------#
810 #
811 # Drop in the name of the target on a new line, and the previous target
812 # as a dependency. Also call the echo_message function.
813 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
814
815 # If $vrs isn't empty, we've got a package...
816 if [ "$vrs" != "" ] ; then
817 case $name in
818 temp-perl) wrt_unpack4 "perl-$vrs.tar.*" ;;
819 *) wrt_unpack4 "$name-$vrs.tar.*" ;;
820 esac
821 #
822 # Export a few 'config' vars..
823 case $this_script in
824 *glibc*) # For glibc we can set then TIMEZONE envar.
825 echo -e '\t@echo "export TIMEZONE=$(TIMEZONE)" >> envars' >> $MKFILE.tmp ;;
826 *groff*) # For Groff we need to set PAGE envar.
827 echo -e '\t@echo "export PAGE=$(PAGE)" >> envars' >> $MKFILE.tmp ;;
828 esac
829 fi
830 #
831 wrt_run_as_root2 "${this_script}" "${file}"
832 #
833 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
834 #
835 # Include a touch of the target name so make can check if it's already been made.
836 echo -e '\t@touch $@' >> $MKFILE.tmp
837 #
838 #--------------------------------------------------------------------#
839 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
840 #--------------------------------------------------------------------#
841 #
842 # Keep the script file name for Makefile dependencies.
843 PREV=$this_script
844
845 done # for file in final-system/* ...
846}
847
848
849#-----------------------------#
850bootscripts_Makefiles() { #
851#-----------------------------#
852 echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
853
854 for file in bootscripts/* ; do
855 # Keep the script file name
856 this_script=`basename $file`
857
858 case $this_script in
859 *udev*) continue ;; # This is not a script but a commentary
860 *console*) continue ;; # Use the files that came with the bootscripts
861 *) ;;
862 esac
863
864 # First append each name of the script files to a list (this will become
865 # the names of the targets in the Makefile
866 bootscripttools="$bootscripttools $this_script"
867
868 # A little bit of script modification
869 case $this_script in
870 *profile*) # Over-ride the book cmds, write our own simple one.
871(
872cat <<- EOF
873 cat > /etc/profile << "_EOF_"
874 # Begin /etc/profile
875
876 export LC_ALL=${LC_ALL}
877 export LANG=${LANG}
878 export INPUTRC=/etc/inputrc
879
880 # End /etc/profile
881 _EOF_
882EOF
883) > $file
884 ;;
885 esac
886
887 # Grab the name of the target, strip id number, XXX-script
888 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
889 -e 's@-64bit@@' \
890 -e 's@-64@@' \
891 -e 's@64@@' \
892 -e 's@n32@@'`
893 if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
894
895 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
896
897 #--------------------------------------------------------------------#
898 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
899 #--------------------------------------------------------------------#
900 #
901 # Drop in the name of the target on a new line, and the previous target
902 # as a dependency. Also call the echo_message function.
903 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
904 #
905 # If $vrs isn't empty, we've got a package...
906 #
907 [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
908 #
909 wrt_run_as_chroot1 "${this_script}" "${file}"
910 #
911 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
912 #
913 # Include a touch of the target name so make can check if it's already been made.
914 echo -e '\t@touch $@' >> $MKFILE.tmp
915 #
916 #--------------------------------------------------------------------#
917 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
918 #--------------------------------------------------------------------#
919 #
920 # Keep the script file name for Makefile dependencies.
921 PREV=$this_script
922
923 done # for file in bootscripts/* ...
924
925}
926
927#-----------------------------#
928bm_bootscripts_Makefiles() { #
929#-----------------------------#
930 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) bootscripts${R_arrow}"
931
932 for file in bootscripts/* ; do
933 # Keep the script file name
934 this_script=`basename $file`
935
936 case $this_script in
937 *udev*) continue ;; # This is not a script but a commentary
938 *console*) continue ;; # Use the files that came with the bootscripts
939 *) ;;
940 esac
941
942 # First append each name of the script files to a list (this will become
943 # the names of the targets in the Makefile
944 bootscripttools="$bootscripttools $this_script"
945
946 # A little bit of script modification
947 case $this_script in
948 *profile*) # Over-ride the book cmds, write our own simple one.
949(
950cat <<- EOF
951 cat > /etc/profile << "_EOF_"
952 # Begin /etc/profile
953
954 export LC_ALL=${LC_ALL}
955 export LANG=${LANG}
956 export INPUTRC=/etc/inputrc
957
958 # End /etc/profile
959 _EOF_
960EOF
961) > $file
962 ;;
963 esac
964
965 # Grab the name of the target, strip id number, XXX-script
966 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
967 -e 's@-64bit@@' \
968 -e 's@-64@@' \
969 -e 's@64@@' \
970 -e 's@n32@@'`
971 if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
972
973 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
974
975 #--------------------------------------------------------------------#
976 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
977 #--------------------------------------------------------------------#
978 #
979 # Drop in the name of the target on a new line, and the previous target
980 # as a dependency. Also call the echo_message function.
981 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
982 #
983 # If $vrs isn't empty, we've got a package...
984 #
985 [[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
986 #
987 wrt_run_as_root2 "${this_script}" "${file}"
988 #
989 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
990 #
991 # Include a touch of the target name so make can check if it's already been made.
992 echo -e '\t@touch $@' >> $MKFILE.tmp
993 #
994 #--------------------------------------------------------------------#
995 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
996 #--------------------------------------------------------------------#
997 #
998 # Keep the script file name for Makefile dependencies.
999 PREV=$this_script
1000
1001 done # for file in bootscripts/* ...
1002
1003}
1004
1005
1006
1007#-----------------------------#
1008bootable_Makefiles() { #
1009#-----------------------------#
1010 echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
1011
1012 for file in bootable/* ; do
1013 # Keep the script file name
1014 this_script=`basename $file`
1015
1016 # A little housekeeping on the scripts
1017 case $this_script in
1018 *grub*) continue ;;
1019 *kernel)
[4845f38]1020 # if there is no kernel config file do not build the kernel
1021 [[ -z $CONFIG ]] && continue
[0170229]1022 sed "s|make mrproper|make mrproper\ncp $CONFIG .config|" -i $file
1023 # You cannot run menuconfig from within the makefile
1024 sed 's|menuconfig|oldconfig|' -i $file
1025 # If defined include the keymap in the kernel
1026 if [[ -n "$KEYMAP" ]]; then
1027 sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
1028 else
1029 sed '/loadkeys -m/d' -i $file
1030 sed '/drivers\/char/d' -i $file
1031 fi
1032 ;;
1033 esac
1034 #
1035 # First append each name of the script files to a list (this will become
1036 # the names of the targets in the Makefile
1037 bootabletools="$bootabletools $this_script"
1038 #
1039 # Grab the name of the target, strip id number and misc words.
1040 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
1041 [[ `_IS_ $this_script "kernel"` ]] && name=linux
1042
1043 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
1044
1045 #--------------------------------------------------------------------#
1046 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
1047 #--------------------------------------------------------------------#
1048 #
1049 # Drop in the name of the target on a new line, and the previous target
1050 # as a dependency. Also call the echo_message function.
1051 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
1052 #
1053 # If $vrs isn't empty, we've got a package...
1054 # Insert instructions for unpacking the package and changing directories
1055 #
1056 [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
1057 #
1058 # Select a script execution method
1059 case $this_script in
1060 *fstab*) if [[ -n "$FSTAB" ]]; then
1061 wrt_copy_fstab "${this_script}"
1062 else
1063 wrt_run_as_lfs "${this_script}" "${file}"
1064 fi
1065 ;;
1066 *) wrt_run_as_lfs "${this_script}" "${file}" ;;
1067 esac
1068 #
1069 # Housekeeping...remove any build directory(ies) except if the package build fails.
1070 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
1071 #
1072 # Include a touch of the target name so make can check if it's already been made.
1073 echo -e '\t@touch $@' >> $MKFILE.tmp
1074 #
1075 #--------------------------------------------------------------------#
1076 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
1077 #--------------------------------------------------------------------#
1078 #
1079 # Keep the script file name for Makefile dependencies.
1080 PREV=$this_script
1081
1082 done
1083
1084}
1085
1086
1087
1088#-----------------------------#
1089bm_bootable_Makefiles() { #
1090#-----------------------------#
1091 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) make bootable${R_arrow}"
1092
1093 for file in bootable/* ; do
1094 # Keep the script file name
1095 this_script=`basename $file`
1096
1097 # A little housekeeping on the scripts
1098 case $this_script in
1099 *grub*) continue ;;
[4845f38]1100 *kernel)
1101 # if there is no kernel config file do not build the kernel
1102 [[ -z $CONFIG ]] && continue
1103 cfg_file="/sources/`basename $CONFIG`"
[0170229]1104 sed "s|make mrproper|make mrproper\ncp $cfg_file .config|" -i $file
1105 # You cannot run menuconfig from within the makefile
1106 sed 's|menuconfig|oldconfig|' -i $file
1107 # If defined include the keymap in the kernel
1108 if [[ -n "$KEYMAP" ]]; then
1109 sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
1110 else
1111 sed '/loadkeys -m/d' -i $file
1112 sed '/drivers\/char/d' -i $file
1113 fi
1114 ;;
1115 esac
1116 #
1117 # First append each name of the script files to a list (this will become
1118 # the names of the targets in the Makefile
1119 bootabletools="$bootabletools $this_script"
1120 #
1121 # Grab the name of the target, strip id number and misc words.
1122 case $this_script in
1123 *kernel) name=linux
1124 ;;
1125 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
1126 esac
1127
1128 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
1129
1130 #--------------------------------------------------------------------#
1131 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
1132 #--------------------------------------------------------------------#
1133 #
1134 # Drop in the name of the target on a new line, and the previous target
1135 # as a dependency. Also call the echo_message function.
1136 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
1137 #
1138 # If $vrs isn't empty, we've got a package...
1139 # Insert instructions for unpacking the package and changing directories
1140 #
1141 [[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
1142 #
1143 # Select a script execution method
1144 case $this_script in
1145 *fstab*) if [[ -n "$FSTAB" ]]; then
1146 wrt_copy_fstab2 "${this_script}"
1147 else
1148 wrt_run_as_root2 "${this_script}" "${file}"
1149 fi
1150 ;;
1151 *) wrt_run_as_root2 "${this_script}" "${file}" ;;
1152 esac
1153 #
1154 # Housekeeping...remove any build directory(ies) except if the package build fails.
1155 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
1156 #
1157 # Include a touch of the target name so make can check if it's already been made.
1158 echo -e '\t@touch $@' >> $MKFILE.tmp
1159 #
1160 #--------------------------------------------------------------------#
1161 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
1162 #--------------------------------------------------------------------#
1163 #
1164 # Keep the script file name for Makefile dependencies.
1165 PREV=$this_script
1166
1167 done
1168
1169}
1170
1171
1172
1173#-----------------------------#
1174the_end_Makefiles() { #
1175#-----------------------------#
1176 echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
1177}
1178
1179
1180#-----------------------------#
1181build_Makefile() { # Construct a Makefile from the book scripts
1182#-----------------------------#
1183 echo "Creating Makefile... ${BOLD}START${OFF}"
1184
1185 cd $JHALFSDIR/${PROGNAME}-commands
1186 # Start with a clean Makefile.tmp file
1187 >$MKFILE.tmp
1188
1189 host_prep_Makefiles
1190 cross_tools_Makefiles
1191 temptools_Makefiles
1192 if [[ $BOOTMINIMAL = "0" ]]; then
1193 chroot_Makefiles
1194 if [[ $TOOLCHAINTEST = "1" ]]; then
1195 testsuite_tools_Makefiles
1196 fi
1197 final_system_Makefiles
1198 bootscripts_Makefiles
1199 bootable_Makefiles
1200 else
1201 boot_Makefiles # This phase must die at the end of its run..
1202 if [[ $TOOLCHAINTEST = "1" ]]; then
1203 bm_testsuite_tools_Makefiles
1204 fi
1205 bm_final_system_Makefiles
1206 bm_bootscripts_Makefiles
1207 bm_bootable_Makefiles
1208 fi
1209# the_end_Makefiles
1210
1211
1212 # Add a header, some variables and include the function file
1213 # to the top of the real Makefile.
1214(
1215 cat << EOF
1216$HEADER
1217
1218SRC= /sources
1219MOUNT_PT= $BUILDDIR
1220PAGE= $PAGE
1221TIMEZONE= $TIMEZONE
1222
1223include makefile-functions
1224
1225EOF
1226) > $MKFILE
1227
1228 # Add chroot commands
1229 i=1
1230 for file in chroot/*chroot* ; do
1231 chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
1232 -e '/^export/d' \
1233 -e '/^logout/d' \
1234 -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
1235 -e 's|\\$|&&|g' \
1236 -e 's|exit||g' \
1237 -e 's|$| -c|' \
1238 -e 's|"$$LFS"|$(MOUNT_PT)|'\
1239 -e 's|set -e||'`
1240 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
1241 i=`expr $i + 1`
1242 done
1243
1244 # Drop in the main target 'all:' and the chapter targets with each sub-target
1245 # as a dependency.
1246(
1247 cat << EOF
1248all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
1249 @\$(call echo_finished,$VERSION)
1250
1251chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
1252
1253chapter3: chapter2 $cross_tools
1254
1255chapter4: chapter3 $temptools
1256
1257chapter5: chapter4 $chroottools $boottools
1258
1259chapter6: chapter5 $basicsystem
1260
1261chapter7: chapter6 $bootscripttools
1262
1263chapter8: chapter7 $bootabletools
1264
1265clean-all: clean
1266 rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
1267
1268clean: clean-chapter4 clean-chapter3 clean-chapter2
1269
1270clean-chapter2:
1271 -if [ ! -f user-lfs-exist ]; then \\
1272 userdel lfs; \\
1273 rm -rf /home/lfs; \\
1274 fi;
1275 rm -rf \$(MOUNT_PT)/tools
1276 rm -f /tools
1277 rm -rf \$(MOUNT_PT)/cross-tools
1278 rm -f /cross-tools
1279 rm -f envars user-lfs-exist
1280 rm -f 02* logs/02*.log
1281
1282clean-chapter3:
1283 rm -rf \$(MOUNT_PT)/tools/*
1284 rm -f $cross_tools restore-lfs-env sources-dir
1285 cd logs && rm -f $cross_tools && cd ..
1286
1287clean-chapter4:
1288 -umount \$(MOUNT_PT)/sys
1289 -umount \$(MOUNT_PT)/proc
1290 -umount \$(MOUNT_PT)/dev/shm
1291 -umount \$(MOUNT_PT)/dev/pts
1292 -umount \$(MOUNT_PT)/dev
1293 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
1294 rm -f $temptools
1295 cd logs && rm -f $temptools && cd ..
1296
1297
1298restore-lfs-env:
1299 @\$(call echo_message, Building)
1300 @if [ -f /home/lfs/.bashrc.XXX ]; then \\
1301 mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
1302 fi;
1303 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
1304 mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
1305 fi;
1306 @chown lfs:lfs /home/lfs/.bash* && \\
1307 touch \$@
1308
1309EOF
1310) >> $MKFILE
1311
1312
1313 # Bring over the items from the Makefile.tmp
1314 cat $MKFILE.tmp >> $MKFILE
1315 rm $MKFILE.tmp
1316 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1317
1318}
1319
Note: See TracBrowser for help on using the repository browser.