source: CLFS/master.sh@ d87b293

experimental
Last change on this file since d87b293 was d87b293, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Set the actual LANG and LC_ALL values inside the generated scripts instead of exported envars.

  • Property mode set to 100755
File size: 45.8 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 #
[c3c4e1d]290 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
[0170229]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 #
[c3c4e1d]342 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
[0170229]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 #
[c3c4e1d]414 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
[0170229]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
[c3c4e1d]491 *util-linux) wrt_unpack "$name-$vrs.tar.*"
[7d018d1]492 echo -e '\ttrue' >> $MKFILE.tmp
493 ;;
494 *) wrt_unpack2 "$name-$vrs.tar.*"
495 ;;
[0170229]496 esac
497 fi
498 #
499 # Select a script execution method
500 case $this_script in
501 *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
502 *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
503 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
504 esac
505 #
506 # Housekeeping...remove the build directory(ies), except if the package build fails.
507 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
508 #
509 # Include a touch of the target name so make can check if it's already been made.
510 echo -e '\t@touch $@' >> $MKFILE.tmp
511 #
512 #--------------------------------------------------------------------#
513 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
514 #--------------------------------------------------------------------#
515 #
516 # Keep the script file name for Makefile dependencies.
517 PREV=$this_script
518
519 done # for file in...
520}
521
522
523#-----------------------------#
524testsuite_tools_Makefiles() { #
525#-----------------------------#
526 echo "${tab_}${GREEN}Processing... ${L_arrow}testsuite tools${R_arrow}"
527
528 for file in testsuite-tools/* ; do
529 # Keep the script file name
530 this_script=`basename $file`
531
532 # First append each name of the script files to a list (this will become
533 # the names of the targets in the Makefile
534 testsuitetools="$testsuitetools $this_script"
535
536 # Grab the name of the target, strip id number, XXX-script
537 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
538 -e 's@-64bit@@' \
539 -e 's@-64@@' \
540 -e 's@64@@' \
541 -e 's@n32@@'`
542
543 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
544
545 #--------------------------------------------------------------------#
546 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
547 #--------------------------------------------------------------------#
548 #
549 # Drop in the name of the target on a new line, and the previous target
550 # as a dependency. Also call the echo_message function.
551 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
552 #
553 case $name in
[c3c4e1d]554 tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
555 *) wrt_unpack2 "$name-$vrs.tar.*" ;;
[0170229]556 esac
557 #
558 wrt_run_as_chroot1 "${this_script}" "${file}"
559 #
560 wrt_remove_build_dirs "${name}"
561 #
562 # Include a touch of the target name so make can check if it's already been made.
563 echo -e '\t@touch $@' >> $MKFILE.tmp
564 #
565 #--------------------------------------------------------------------#
566 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
567 #--------------------------------------------------------------------#
568 #
569 # Keep the script file name for Makefile dependencies.
570 PREV=$this_script
571
572 done
573}
574
575
576#--------------------------------#
577bm_testsuite_tools_Makefiles() { #
578#--------------------------------#
579 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) testsuite tools${R_arrow}"
580
581 for file in testsuite-tools/* ; do
582 # Keep the script file name
583 this_script=`basename $file`
584
585 # First append each name of the script files to a list (this will become
586 # the names of the targets in the Makefile
587 testsuitetools="$testsuitetools $this_script"
588
589 # Grab the name of the target, strip id number, XXX-script
590 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
591 -e 's@-64bit@@' \
592 -e 's@-64@@' \
593 -e 's@64@@' \
594 -e 's@n32@@'`
595
596 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
597
598 #--------------------------------------------------------------------#
599 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
600 #--------------------------------------------------------------------#
601 #
602 # Drop in the name of the target on a new line, and the previous target
603 # as a dependency. Also call the echo_message function.
604 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
605 #
606 case $name in
[c3c4e1d]607 tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
608 *) wrt_unpack3 "$name-$vrs.tar.*" ;;
[0170229]609 esac
610 #
611 wrt_run_as_root2 "${this_script}" "${file}"
612 #
613 wrt_remove_build_dirs2 "${name}"
614 #
615 # Include a touch of the target name so make can check if it's already been made.
616 echo -e '\t@touch $@' >> $MKFILE.tmp
617 #
618 #--------------------------------------------------------------------#
619 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
620 #--------------------------------------------------------------------#
621 #
622 # Keep the script file name for Makefile dependencies.
623 PREV=$this_script
624
625 done
626}
627
628
629#-----------------------------#
630final_system_Makefiles() { #
631#-----------------------------#
632 echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
633
634 for file in final-system/* ; do
635 # Keep the script file name
636 this_script=`basename $file`
637
638 # Skipping scripts is done now so they are not included in the Makefile.
639 case $this_script in
640 *stripping*) continue ;;
641 *grub*) continue ;;
642 esac
643 #
644 # First append each name of the script files to a list (this will become
645 # the names of the targets in the Makefile
646 basicsystem="$basicsystem $this_script"
647 #
648 # A little customizing via sed scripts first..
649 if [[ $TEST = "0" ]]; then
650 # Drop any package checks..
651 sed -e '/make check/d' -e '/make test/d' -i $file
652 fi
653 case $this_script in
654 *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
655 *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
656 *vim*) sed '/vim -c/d' -i $file ;;
657 *bash*) sed '/exec /d' -i $file ;;
658 *shadow*) sed -e '/grpconv/d' -e '/pwconv/d' -e '/passwd root/d' -i $file
659 sed '/sed -i libtool/d' -i $file
660 sed '/search_path/d' -i $file
661 ;;
662 *glibc*) sed '/tzselect/d' -i $file
663 sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
664 # Manipulate glibc's test to work with Makefile
665 sed -e 's/glibc-check-log.*//' \
666 -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
667 ;;
668 *binutils*) sed '/expect /d' -i $file
669 if [[ $TOOLCHAINTEST = "0" ]]; then
670 sed '/make check/d' -i $file
671 fi
672 ;;
673 *gcc*) # Ignore all gcc testing for now..
674 sed -e '/make -k check/d' -i $file
675 sed -e '/test_summary/d' -i $file
676 ;;
677 *texinfo*) # This sucks as a way to trim a script
678 sed -e '/cd \/usr/d' \
679 -e '/rm dir/d' \
680 -e '/for f in/d' \
681 -e '/do inst/d' \
682 -e '/done/d' -i $file
683 ;;
684 esac
685
686 # Grab the name of the target, strip id number, XXX-script
687 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
688 -e 's@temp-@@' \
689 -e 's@-64bit@@' \
690 -e 's@-64@@' \
691 -e 's@64@@' \
692 -e 's@n32@@'`
693
694 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
695
696 #--------------------------------------------------------------------#
697 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
698 #--------------------------------------------------------------------#
699 #
700 # Drop in the name of the target on a new line, and the previous target
701 # as a dependency. Also call the echo_message function.
702 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
703
704 # If $vrs isn't empty, we've got a package...
705 if [ "$vrs" != "" ] ; then
706 case $name in
707 temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
708 *) wrt_unpack2 "$name-$vrs.tar.*" ;;
709 esac
710 fi
711 #
712 wrt_run_as_chroot1 "${this_script}" "${file}"
713 #
714 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
715 #
716 # Include a touch of the target name so make can check if it's already been made.
717 echo -e '\t@touch $@' >> $MKFILE.tmp
718 #
719 #--------------------------------------------------------------------#
720 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
721 #--------------------------------------------------------------------#
722 #
723 # Keep the script file name for Makefile dependencies.
724 PREV=$this_script
725
726 done # for file in final-system/* ...
727}
728
729
730#-----------------------------#
731bm_final_system_Makefiles() { #
732#-----------------------------#
733 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) final system${R_arrow}"
734
735 for file in final-system/* ; do
736 # Keep the script file name
737 this_script=`basename $file`
738
739 # Skipping scripts is done now so they are not included in the Makefile.
740 case $this_script in
741 *stripping*) continue ;;
742 *grub*) continue ;;
743 esac
744
745 # First append each name of the script files to a list (this will become
746 # the names of the targets in the Makefile
747 basicsystem="$basicsystem $this_script"
748
749 #
750 # A little customizing via sed scripts first..
751 if [[ $TEST = "0" ]]; then
752 # Drop any package checks..
753 sed -e '/make check/d' -e '/make test/d' -i $file
754 fi
755 case $this_script in
756 *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
757 *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
758 *vim*) sed '/vim -c/d' -i $file ;;
759 *bash*) sed '/exec /d' -i $file ;;
760 *shadow*) sed -e '/grpconv/d' \
761 -e '/pwconv/d' \
762 -e '/passwd root/d' -i $file
763 sed '/sed -i libtool/d' -i $file
764 sed '/search_path/d' -i $file
765 ;;
766 *psmisc*) # Build fails on creation of this link. <pidof> installed in sysvinit
767 sed -e 's/^ln -s/#ln -s/' -i $file
768 ;;
769 *glibc*) sed '/tzselect/d' -i $file
770 sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
771 # Manipulate glibc's test to work with Makefile
772 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
773 ;;
774 *binutils*) sed '/expect /d' -i $file
775 if [[ $TOOLCHAINTEST = "0" ]]; then
776 sed '/make check/d' -i $file
777 fi
778 ;;
779 *gcc*) # Ignore all gcc testing for now..
780 sed -e '/make -k check/d' -i $file
781 sed -e '/test_summary/d' -i $file
782 ;;
783 *texinfo*) # This sucks as a way to trim a script
784 sed -e '/cd \/usr/d' \
785 -e '/rm dir/d' \
786 -e '/for f in/d' \
787 -e '/do inst/d' \
788 -e '/done/d' -i $file
789 ;;
790 esac
791
792 # Grab the name of the target, strip id number, XXX-script
793 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
794 -e 's@temp-@@' \
795 -e 's@-64bit@@' \
796 -e 's@-64@@' \
797 -e 's@64@@' \
798 -e 's@n32@@'`
799
800 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
801
802 #--------------------------------------------------------------------#
803 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
804 #--------------------------------------------------------------------#
805 #
806 # Drop in the name of the target on a new line, and the previous target
807 # as a dependency. Also call the echo_message function.
808 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
809
810 # If $vrs isn't empty, we've got a package...
811 if [ "$vrs" != "" ] ; then
812 case $name in
[c3c4e1d]813 temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
814 *) wrt_unpack3 "$name-$vrs.tar.*" ;;
[0170229]815 esac
816 #
817 # Export a few 'config' vars..
818 case $this_script in
819 *glibc*) # For glibc we can set then TIMEZONE envar.
820 echo -e '\t@echo "export TIMEZONE=$(TIMEZONE)" >> envars' >> $MKFILE.tmp ;;
821 *groff*) # For Groff we need to set PAGE envar.
822 echo -e '\t@echo "export PAGE=$(PAGE)" >> envars' >> $MKFILE.tmp ;;
823 esac
824 fi
825 #
826 wrt_run_as_root2 "${this_script}" "${file}"
827 #
828 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
829 #
830 # Include a touch of the target name so make can check if it's already been made.
831 echo -e '\t@touch $@' >> $MKFILE.tmp
832 #
833 #--------------------------------------------------------------------#
834 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
835 #--------------------------------------------------------------------#
836 #
837 # Keep the script file name for Makefile dependencies.
838 PREV=$this_script
839
840 done # for file in final-system/* ...
841}
842
843
844#-----------------------------#
845bootscripts_Makefiles() { #
846#-----------------------------#
847 echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
848
849 for file in bootscripts/* ; do
850 # Keep the script file name
851 this_script=`basename $file`
852
853 case $this_script in
854 *udev*) continue ;; # This is not a script but a commentary
855 *console*) continue ;; # Use the files that came with the bootscripts
856 *) ;;
857 esac
858
859 # First append each name of the script files to a list (this will become
860 # the names of the targets in the Makefile
861 bootscripttools="$bootscripttools $this_script"
862
863 # A little bit of script modification
864 case $this_script in
865 *profile*) # Over-ride the book cmds, write our own simple one.
866(
867cat <<- EOF
868 cat > /etc/profile << "_EOF_"
869 # Begin /etc/profile
870
871 export LC_ALL=${LC_ALL}
872 export LANG=${LANG}
873 export INPUTRC=/etc/inputrc
874
875 # End /etc/profile
876 _EOF_
877EOF
878) > $file
879 ;;
880 esac
881
882 # Grab the name of the target, strip id number, XXX-script
883 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
884 -e 's@-64bit@@' \
885 -e 's@-64@@' \
886 -e 's@64@@' \
887 -e 's@n32@@'`
888 if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
889
890 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
891
892 #--------------------------------------------------------------------#
893 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
894 #--------------------------------------------------------------------#
895 #
896 # Drop in the name of the target on a new line, and the previous target
897 # as a dependency. Also call the echo_message function.
898 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
899 #
900 # If $vrs isn't empty, we've got a package...
901 #
902 [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
903 #
904 wrt_run_as_chroot1 "${this_script}" "${file}"
905 #
906 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
907 #
908 # Include a touch of the target name so make can check if it's already been made.
909 echo -e '\t@touch $@' >> $MKFILE.tmp
910 #
911 #--------------------------------------------------------------------#
912 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
913 #--------------------------------------------------------------------#
914 #
915 # Keep the script file name for Makefile dependencies.
916 PREV=$this_script
917
918 done # for file in bootscripts/* ...
919
920}
921
922#-----------------------------#
923bm_bootscripts_Makefiles() { #
924#-----------------------------#
925 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) bootscripts${R_arrow}"
926
927 for file in bootscripts/* ; do
928 # Keep the script file name
929 this_script=`basename $file`
930
931 case $this_script in
932 *udev*) continue ;; # This is not a script but a commentary
933 *console*) continue ;; # Use the files that came with the bootscripts
934 *) ;;
935 esac
936
937 # First append each name of the script files to a list (this will become
938 # the names of the targets in the Makefile
939 bootscripttools="$bootscripttools $this_script"
940
941 # A little bit of script modification
942 case $this_script in
943 *profile*) # Over-ride the book cmds, write our own simple one.
944(
945cat <<- EOF
946 cat > /etc/profile << "_EOF_"
947 # Begin /etc/profile
948
949 export LC_ALL=${LC_ALL}
950 export LANG=${LANG}
951 export INPUTRC=/etc/inputrc
952
953 # End /etc/profile
954 _EOF_
955EOF
956) > $file
957 ;;
958 esac
959
960 # Grab the name of the target, strip id number, XXX-script
961 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
962 -e 's@-64bit@@' \
963 -e 's@-64@@' \
964 -e 's@64@@' \
965 -e 's@n32@@'`
966 if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
967
968 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
969
970 #--------------------------------------------------------------------#
971 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
972 #--------------------------------------------------------------------#
973 #
974 # Drop in the name of the target on a new line, and the previous target
975 # as a dependency. Also call the echo_message function.
976 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
977 #
978 # If $vrs isn't empty, we've got a package...
979 #
[c3c4e1d]980 [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
[0170229]981 #
982 wrt_run_as_root2 "${this_script}" "${file}"
983 #
984 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
985 #
986 # Include a touch of the target name so make can check if it's already been made.
987 echo -e '\t@touch $@' >> $MKFILE.tmp
988 #
989 #--------------------------------------------------------------------#
990 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
991 #--------------------------------------------------------------------#
992 #
993 # Keep the script file name for Makefile dependencies.
994 PREV=$this_script
995
996 done # for file in bootscripts/* ...
997
998}
999
1000
1001
1002#-----------------------------#
1003bootable_Makefiles() { #
1004#-----------------------------#
1005 echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
1006
1007 for file in bootable/* ; do
1008 # Keep the script file name
1009 this_script=`basename $file`
1010
1011 # A little housekeeping on the scripts
1012 case $this_script in
1013 *grub*) continue ;;
1014 *kernel)
[4845f38]1015 # if there is no kernel config file do not build the kernel
1016 [[ -z $CONFIG ]] && continue
[0170229]1017 sed "s|make mrproper|make mrproper\ncp $CONFIG .config|" -i $file
1018 # You cannot run menuconfig from within the makefile
1019 sed 's|menuconfig|oldconfig|' -i $file
1020 # If defined include the keymap in the kernel
1021 if [[ -n "$KEYMAP" ]]; then
1022 sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
1023 else
1024 sed '/loadkeys -m/d' -i $file
1025 sed '/drivers\/char/d' -i $file
1026 fi
1027 ;;
1028 esac
1029 #
1030 # First append each name of the script files to a list (this will become
1031 # the names of the targets in the Makefile
1032 bootabletools="$bootabletools $this_script"
1033 #
1034 # Grab the name of the target, strip id number and misc words.
1035 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
1036 [[ `_IS_ $this_script "kernel"` ]] && name=linux
1037
1038 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
1039
1040 #--------------------------------------------------------------------#
1041 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
1042 #--------------------------------------------------------------------#
1043 #
1044 # Drop in the name of the target on a new line, and the previous target
1045 # as a dependency. Also call the echo_message function.
1046 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
1047 #
1048 # If $vrs isn't empty, we've got a package...
1049 # Insert instructions for unpacking the package and changing directories
1050 #
[c3c4e1d]1051 [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
[0170229]1052 #
1053 # Select a script execution method
1054 case $this_script in
1055 *fstab*) if [[ -n "$FSTAB" ]]; then
1056 wrt_copy_fstab "${this_script}"
1057 else
1058 wrt_run_as_lfs "${this_script}" "${file}"
1059 fi
1060 ;;
1061 *) wrt_run_as_lfs "${this_script}" "${file}" ;;
1062 esac
1063 #
1064 # Housekeeping...remove any build directory(ies) except if the package build fails.
1065 [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
1066 #
1067 # Include a touch of the target name so make can check if it's already been made.
1068 echo -e '\t@touch $@' >> $MKFILE.tmp
1069 #
1070 #--------------------------------------------------------------------#
1071 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
1072 #--------------------------------------------------------------------#
1073 #
1074 # Keep the script file name for Makefile dependencies.
1075 PREV=$this_script
1076
1077 done
1078
1079}
1080
1081
1082
1083#-----------------------------#
1084bm_bootable_Makefiles() { #
1085#-----------------------------#
1086 echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) make bootable${R_arrow}"
1087
1088 for file in bootable/* ; do
1089 # Keep the script file name
1090 this_script=`basename $file`
1091
1092 # A little housekeeping on the scripts
1093 case $this_script in
1094 *grub*) continue ;;
[c3c4e1d]1095 *kernel)
[4845f38]1096 # if there is no kernel config file do not build the kernel
1097 [[ -z $CONFIG ]] && continue
1098 cfg_file="/sources/`basename $CONFIG`"
[0170229]1099 sed "s|make mrproper|make mrproper\ncp $cfg_file .config|" -i $file
1100 # You cannot run menuconfig from within the makefile
1101 sed 's|menuconfig|oldconfig|' -i $file
1102 # If defined include the keymap in the kernel
1103 if [[ -n "$KEYMAP" ]]; then
1104 sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
1105 else
1106 sed '/loadkeys -m/d' -i $file
1107 sed '/drivers\/char/d' -i $file
1108 fi
1109 ;;
1110 esac
1111 #
1112 # First append each name of the script files to a list (this will become
1113 # the names of the targets in the Makefile
1114 bootabletools="$bootabletools $this_script"
1115 #
1116 # Grab the name of the target, strip id number and misc words.
1117 case $this_script in
1118 *kernel) name=linux
1119 ;;
1120 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
1121 esac
1122
1123 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
1124
1125 #--------------------------------------------------------------------#
1126 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
1127 #--------------------------------------------------------------------#
1128 #
1129 # Drop in the name of the target on a new line, and the previous target
1130 # as a dependency. Also call the echo_message function.
1131 echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
1132 #
1133 # If $vrs isn't empty, we've got a package...
1134 # Insert instructions for unpacking the package and changing directories
1135 #
[c3c4e1d]1136 [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
[0170229]1137 #
1138 # Select a script execution method
1139 case $this_script in
1140 *fstab*) if [[ -n "$FSTAB" ]]; then
1141 wrt_copy_fstab2 "${this_script}"
1142 else
1143 wrt_run_as_root2 "${this_script}" "${file}"
1144 fi
1145 ;;
1146 *) wrt_run_as_root2 "${this_script}" "${file}" ;;
1147 esac
1148 #
1149 # Housekeeping...remove any build directory(ies) except if the package build fails.
1150 [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
1151 #
1152 # Include a touch of the target name so make can check if it's already been made.
1153 echo -e '\t@touch $@' >> $MKFILE.tmp
1154 #
1155 #--------------------------------------------------------------------#
1156 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
1157 #--------------------------------------------------------------------#
1158 #
1159 # Keep the script file name for Makefile dependencies.
1160 PREV=$this_script
1161
1162 done
1163
1164}
1165
1166
1167
1168#-----------------------------#
1169the_end_Makefiles() { #
1170#-----------------------------#
1171 echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
1172}
1173
1174
1175#-----------------------------#
1176build_Makefile() { # Construct a Makefile from the book scripts
1177#-----------------------------#
1178 echo "Creating Makefile... ${BOLD}START${OFF}"
1179
1180 cd $JHALFSDIR/${PROGNAME}-commands
1181 # Start with a clean Makefile.tmp file
1182 >$MKFILE.tmp
1183
1184 host_prep_Makefiles
1185 cross_tools_Makefiles
1186 temptools_Makefiles
1187 if [[ $BOOTMINIMAL = "0" ]]; then
1188 chroot_Makefiles
1189 if [[ $TOOLCHAINTEST = "1" ]]; then
1190 testsuite_tools_Makefiles
1191 fi
1192 final_system_Makefiles
1193 bootscripts_Makefiles
1194 bootable_Makefiles
1195 else
1196 boot_Makefiles # This phase must die at the end of its run..
1197 if [[ $TOOLCHAINTEST = "1" ]]; then
1198 bm_testsuite_tools_Makefiles
1199 fi
1200 bm_final_system_Makefiles
1201 bm_bootscripts_Makefiles
1202 bm_bootable_Makefiles
1203 fi
1204# the_end_Makefiles
1205
1206
1207 # Add a header, some variables and include the function file
1208 # to the top of the real Makefile.
1209(
1210 cat << EOF
1211$HEADER
1212
1213SRC= /sources
1214MOUNT_PT= $BUILDDIR
1215
1216include makefile-functions
1217
1218EOF
1219) > $MKFILE
1220
1221 # Add chroot commands
1222 i=1
1223 for file in chroot/*chroot* ; do
1224 chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
1225 -e '/^export/d' \
1226 -e '/^logout/d' \
1227 -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
1228 -e 's|\\$|&&|g' \
1229 -e 's|exit||g' \
1230 -e 's|$| -c|' \
1231 -e 's|"$$LFS"|$(MOUNT_PT)|'\
1232 -e 's|set -e||'`
1233 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
1234 i=`expr $i + 1`
1235 done
1236
1237 # Drop in the main target 'all:' and the chapter targets with each sub-target
1238 # as a dependency.
1239(
1240 cat << EOF
1241all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
1242 @\$(call echo_finished,$VERSION)
1243
1244chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
1245
1246chapter3: chapter2 $cross_tools
1247
1248chapter4: chapter3 $temptools
1249
1250chapter5: chapter4 $chroottools $boottools
1251
1252chapter6: chapter5 $basicsystem
1253
1254chapter7: chapter6 $bootscripttools
1255
1256chapter8: chapter7 $bootabletools
1257
1258clean-all: clean
1259 rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
1260
1261clean: clean-chapter4 clean-chapter3 clean-chapter2
1262
1263clean-chapter2:
1264 -if [ ! -f user-lfs-exist ]; then \\
1265 userdel lfs; \\
1266 rm -rf /home/lfs; \\
1267 fi;
1268 rm -rf \$(MOUNT_PT)/tools
1269 rm -f /tools
1270 rm -rf \$(MOUNT_PT)/cross-tools
1271 rm -f /cross-tools
1272 rm -f envars user-lfs-exist
1273 rm -f 02* logs/02*.log
1274
1275clean-chapter3:
1276 rm -rf \$(MOUNT_PT)/tools/*
1277 rm -f $cross_tools restore-lfs-env sources-dir
1278 cd logs && rm -f $cross_tools && cd ..
1279
1280clean-chapter4:
1281 -umount \$(MOUNT_PT)/sys
1282 -umount \$(MOUNT_PT)/proc
1283 -umount \$(MOUNT_PT)/dev/shm
1284 -umount \$(MOUNT_PT)/dev/pts
1285 -umount \$(MOUNT_PT)/dev
1286 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
1287 rm -f $temptools
1288 cd logs && rm -f $temptools && cd ..
1289
1290
1291restore-lfs-env:
1292 @\$(call echo_message, Building)
1293 @if [ -f /home/lfs/.bashrc.XXX ]; then \\
1294 mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
1295 fi;
1296 @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
1297 mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
1298 fi;
1299 @chown lfs:lfs /home/lfs/.bash* && \\
1300 touch \$@
1301
1302EOF
1303) >> $MKFILE
1304
1305
1306 # Bring over the items from the Makefile.tmp
1307 cat $MKFILE.tmp >> $MKFILE
1308 rm $MKFILE.tmp
1309 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1310
1311}
1312
Note: See TracBrowser for help on using the repository browser.