source: CLFS/master.sh@ 423c229

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 423c229 was 401f81e, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Ported Makefile clean-up and 0/1 to n/y migration code from experimental.
There is no obvious bugs, let users to find hidden bugs.

  • Property mode set to 100755
File size: 42.5 KB
RevLine 
[877cc6a]1#!/bin/sh
2# $Id$
3
4###################################
5### FUNCTIONS ###
6###################################
7
8
9#----------------------------#
10host_prep_Makefiles() { # Initialization of the system
11#----------------------------#
[e2ec07a]12 local CLFS_HOST
[877cc6a]13
14 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
15
16 # defined here, only for ease of reading
[ff4d1ab]17 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
[877cc6a]18(
19cat << EOF
20023-creatingtoolsdir:
21 @\$(call echo_message, Building)
[e314f7e]22 @mkdir \$(MOUNT_PT)/tools && \\
23 rm -f /tools && \\
24 ln -s \$(MOUNT_PT)/tools /
[877cc6a]25 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
26 mkdir \$(MOUNT_PT)/sources; \\
27 fi;
28 @chmod a+wt \$(MOUNT_PT)/sources && \\
[93f38e7]29 touch \$@ && \\
30 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
31 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]32
33024-creatingcrossdir: 023-creatingtoolsdir
34 @mkdir -v \$(MOUNT_PT)/cross-tools && \\
[e314f7e]35 rm -f /cross-tools && \\
36 ln -s \$(MOUNT_PT)/cross-tools /
[93f38e7]37 @touch \$@ && \\
38 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
39 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]40
41025-addinguser: 024-creatingcrossdir
42 @\$(call echo_message, Building)
[6ad5a2f]43 @if [ ! -d /home/\$(LUSER) ]; then \\
44 groupadd \$(LGROUP); \\
45 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
[877cc6a]46 else \\
[6ad5a2f]47 touch luser-exist; \\
[877cc6a]48 fi;
[6ad5a2f]49 @chown \$(LUSER) \$(MOUNT_PT) && \\
50 chown \$(LUSER) \$(MOUNT_PT)/tools && \\
51 chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
52 chown \$(LUSER) \$(MOUNT_PT)/sources && \\
[93f38e7]53 touch \$@ && \\
54 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
55 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]56
57026-settingenvironment: 025-addinguser
58 @\$(call echo_message, Building)
[6ad5a2f]59 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
60 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
[877cc6a]61 fi;
[6ad5a2f]62 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
63 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
[877cc6a]64 fi;
[6ad5a2f]65 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
66 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
67 echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
68 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
69 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
70 echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
71 echo "" >> /home/\$(LUSER)/.bashrc && \\
72 echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
73 echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
74 echo "" >> /home/\$(LUSER)/.bashrc && \\
75 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
76 echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
77 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
78 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
79 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
[877cc6a]80 touch envars && \\
[93f38e7]81 touch \$@ && \\
82 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
83 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]84EOF
85) >> $MKFILE.tmp
86
87}
88
89
90
91#-----------------------------#
92cross_tools_Makefiles() { #
93#-----------------------------#
94 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
95
96 for file in cross-tools/* ; do
97 # Keep the script file name
98 this_script=`basename $file`
99 #
100 # Skip this script...
101 case $this_script in
102 *cflags* | *variables* ) # work done in host_prep_Makefiles
103 continue; ;;
104 *) ;;
105 esac
106 #
107 # Set the dependency for the first target.
108 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
109
110 # First append each name of the script files to a list (this will become
111 # the names of the targets in the Makefile
112 cross_tools="$cross_tools $this_script"
113
114 # Grab the name of the target (minus the -headers or -cross in the case of gcc
115 # and binutils in chapter 5)
116 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
117 -e 's@-static@@' \
118 -e 's@-final@@' \
[a160d86]119 -e 's@-64@@' \
[877cc6a]120 -e 's@-n32@@'`
[a160d86]121 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]122
123 #--------------------------------------------------------------------#
124 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
125 #--------------------------------------------------------------------#
126 #
127 # Drop in the name of the target on a new line, and the previous target
128 # as a dependency. Also call the echo_message function.
[041bc01]129 wrt_target "${this_script}" "$PREV"
[877cc6a]130 #
[a160d86]131 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]132 #
[6ad5a2f]133 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[877cc6a]134 #
[6ad5a2f]135 wrt_RunAsUser "${this_script}" "${file}"
[877cc6a]136 #
[a160d86]137 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]138 #
139 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]140 wrt_touch
[877cc6a]141 #
142 #--------------------------------------------------------------------#
143 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
144 #--------------------------------------------------------------------#
145 #
146 # Keep the script file name for Makefile dependencies.
147 PREV=$this_script
148
149 done # for file in ....
150}
151
152
153#-----------------------------#
154temptools_Makefiles() { #
155#-----------------------------#
156 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
157
158 for file in temp-system/* ; do
159 # Keep the script file name
160 this_script=`basename $file`
[6f2cd96]161 #
162 # Deal with any odd scripts..
163 case $this_script in
164 *choose) # The choose script will fail if you cannot enter the new environment
165 # If the 'boot' build method was chosen don't run the script
166 [[ $METHOD = "boot" ]] && continue; ;;
167 *) ;;
168 esac
[e2ec07a]169
[877cc6a]170 #
171 # First append each name of the script files to a list (this will become
172 # the names of the targets in the Makefile
173 temptools="$temptools $this_script"
174
175 #
176 # Grab the name of the target, strip id number, XXX-script
177 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
178 #
[a160d86]179 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]180
181 #--------------------------------------------------------------------#
182 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
183 #--------------------------------------------------------------------#
184 #
185 # Drop in the name of the target on a new line, and the previous target
186 # as a dependency. Also call the echo_message function.
[041bc01]187 wrt_target "${this_script}" "$PREV"
[877cc6a]188 #
[a160d86]189 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]190 # Insert instructions for unpacking the package and to set the PKGDIR variable.
191 #
[6ad5a2f]192 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[a160d86]193 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]194 #
[6ad5a2f]195 wrt_RunAsUser "${this_script}" "${file}"
[877cc6a]196 #
[a160d86]197 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]198 #
199 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]200 wrt_touch
[877cc6a]201 #
202 #--------------------------------------------------------------------#
203 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
204 #--------------------------------------------------------------------#
205 #
206 # Keep the script file name for Makefile dependencies.
207 PREV=$this_script
208 done # for file in ....
209}
210
211
212#-----------------------------#
213boot_Makefiles() { #
214#-----------------------------#
215 echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
216
217 for file in boot/* ; do
218 # Keep the script file name
219 this_script=`basename $file`
220
221 # A little housekeeping on the scripts
222 case $this_script in
223 *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
224 *whatnext*) continue ;;
225 *kernel) # if there is no kernel config file do not build the kernel
226 [[ -z $CONFIG ]] && continue
227 # Copy the config file to /sources with a standardized name
228 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
229 ;;
230 esac
231 #
232 # First append each name of the script files to a list (this will become
233 # the names of the targets in the Makefile
234 boottools="$boottools $this_script"
235 #
236 # Grab the name of the target, strip id number and misc words.
237 case $this_script in
238 *kernel) name=linux ;;
239 *bootscripts) name="bootscripts-cross-lfs" ;;
240 *udev-rules) name="udev-cross-lfs" ;;
241 *grub-build) name=grub ;;
242 *-aboot-build) name=aboot ;;
243 *yaboot-build) name=yaboot ;;
244 *colo-build) name=colo ;;
245 *silo-build) name=silo ;;
246 *arcload-build) name=arcload ;;
247 *lilo-build) name=lilo ;;
248 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
249 esac
[c044e3c]250 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
[a160d86]251 pkg_tarball=$(get_package_tarball_name $name)
252
[877cc6a]253 #--------------------------------------------------------------------#
254 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
255 #--------------------------------------------------------------------#
256 #
257 # Drop in the name of the target on a new line, and the previous target
258 # as a dependency. Also call the echo_message function.
[041bc01]259 wrt_target "${this_script}" "$PREV"
[877cc6a]260 #
[a160d86]261 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]262 # Insert instructions for unpacking the package and changing directories
263 #
[6ad5a2f]264 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[a160d86]265 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]266 #
267 # Select a script execution method
268 case $this_script in
[6ad5a2f]269 *changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;;
270 *devices*) wrt_RunAsRoot "${this_script}" "${file}" ;;
[877cc6a]271 *fstab*) if [[ -n "$FSTAB" ]]; then
272 wrt_copy_fstab "${this_script}"
273 else
[6ad5a2f]274 wrt_RunAsUser "${this_script}" "${file}"
[877cc6a]275 fi
276 ;;
[6ad5a2f]277 *) wrt_RunAsUser "${this_script}" "${file}" ;;
[877cc6a]278 esac
279 #
280 # Housekeeping...remove any build directory(ies) except if the package build fails.
[a160d86]281 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]282 #
283 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]284 wrt_touch
[877cc6a]285 #
286 #--------------------------------------------------------------------#
287 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
288 #--------------------------------------------------------------------#
289 #
290 # Keep the script file name for Makefile dependencies.
291 PREV=$this_script
292
293 done
294}
295
296
297#-----------------------------#
298chroot_Makefiles() { #
299#-----------------------------#
300 echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
301
302 for file in chroot/* ; do
303 # Keep the script file name
304 this_script=`basename $file`
305 #
306 # Skipping scripts is done now and not included in the build tree.
307 case $this_script in
308 *chroot*) continue ;;
309 esac
310
311 #
312 # First append each name of the script files to a list (this will become
313 # the names of the targets in the Makefile
314 chroottools="$chroottools $this_script"
315
316 # Grab the name of the target, strip id number, XXX-script
317 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
[a160d86]318
319 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]320
321 #--------------------------------------------------------------------#
322 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
323 #--------------------------------------------------------------------#
324 #
325 # Drop in the name of the target on a new line, and the previous target
326 # as a dependency. Also call the echo_message function.
[041bc01]327 wrt_target "${this_script}" "$PREV"
[877cc6a]328 #
[a160d86]329 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]330 # Insert instructions for unpacking the package and changing directories
331 #
[a160d86]332 if [ "$pkg_tarball" != "" ] ; then
[877cc6a]333 case $this_script in
[6ad5a2f]334 *util-linux) wrt_unpack "$pkg_tarball" ;;
[a160d86]335 *) wrt_unpack2 "$pkg_tarball" ;;
[877cc6a]336 esac
[1b65a84]337 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]338 fi
339 #
340 # Select a script execution method
341 case $this_script in
[6ad5a2f]342 *kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;;
343 *util-linux) wrt_RunAsUser "${this_script}" "${file}" ;;
344 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
[877cc6a]345 esac
346 #
347 # Housekeeping...remove the build directory(ies), except if the package build fails.
[a160d86]348 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]349 #
350 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]351 wrt_touch
[877cc6a]352 #
353 #--------------------------------------------------------------------#
354 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
355 #--------------------------------------------------------------------#
356 #
357 # Keep the script file name for Makefile dependencies.
358 PREV=$this_script
359
360 done # for file in...
361}
362
363
364#-----------------------------#
365testsuite_tools_Makefiles() { #
366#-----------------------------#
367 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
368
369 for file in testsuite-tools/* ; do
370 # Keep the script file name
371 this_script=`basename $file`
372
373 # First append each name of the script files to a list (this will become
374 # the names of the targets in the Makefile
375 testsuitetools="$testsuitetools $this_script"
376
377 # Grab the name of the target, strip id number, XXX-script
378 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
379 -e 's@-64bit@@' \
380 -e 's@-64@@' \
381 -e 's@64@@' \
382 -e 's@n32@@'`
383
[a160d86]384 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]385
386 #--------------------------------------------------------------------#
387 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
388 #--------------------------------------------------------------------#
389 #
390 # Drop in the name of the target on a new line, and the previous target
391 # as a dependency. Also call the echo_message function.
[041bc01]392 wrt_target "${this_script}" "$PREV"
[877cc6a]393 #
[06cf3c1]394 wrt_unpack2 "$pkg_tarball"
[1b65a84]395 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]396 #
397 wrt_run_as_chroot1 "${this_script}" "${file}"
398 #
399 wrt_remove_build_dirs "${name}"
400 #
401 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]402 wrt_touch
[877cc6a]403 #
404 #--------------------------------------------------------------------#
405 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
406 #--------------------------------------------------------------------#
407 #
408 # Keep the script file name for Makefile dependencies.
409 PREV=$this_script
410
411 done
412}
413
414
415#--------------------------------#
416bm_testsuite_tools_Makefiles() { #
417#--------------------------------#
418 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
419
420 for file in testsuite-tools/* ; do
421 # Keep the script file name
422 this_script=`basename $file`
423
424 # First append each name of the script files to a list (this will become
425 # the names of the targets in the Makefile
426 PREV=
427 testsuitetools="$testsuitetools $this_script"
428
429 # Grab the name of the target, strip id number, XXX-script
430 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
431 -e 's@-64bit@@' \
432 -e 's@-64@@' \
433 -e 's@64@@' \
434 -e 's@n32@@'`
435
[a160d86]436 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]437
438 #--------------------------------------------------------------------#
439 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
440 #--------------------------------------------------------------------#
441 #
442 # Drop in the name of the target on a new line, and the previous target
443 # as a dependency. Also call the echo_message function.
[7eb9402]444 wrt_target_boot "${this_script}" "$PREV"
[877cc6a]445 #
[06cf3c1]446 wrt_unpack3 "$pkg_tarball"
[1b65a84]447 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]448 #
449 wrt_run_as_root2 "${this_script}" "${file}"
450 #
451 wrt_remove_build_dirs2 "${name}"
452 #
453 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]454 wrt_touch
[877cc6a]455 #
456 #--------------------------------------------------------------------#
457 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
458 #--------------------------------------------------------------------#
459 #
460 # Keep the script file name for Makefile dependencies.
461 PREV=$this_script
462
463 done
464}
465
466
467#-----------------------------#
468final_system_Makefiles() { #
469#-----------------------------#
[45f82718]470 # Set envars and scripts for iteration targets
471 LOGS="" # Start with an empty global LOGS envar
472 if [[ -z "$1" ]] ; then
473 local N=""
474 else
475 local N=-build_$1
476 local basicsystem=""
477 mkdir final-system$N
478 cp final-system/* final-system$N
479 for script in final-system$N/* ; do
480 # Overwrite existing symlinks, files, and dirs
481 sed -e 's/ln -sv/&f/g' \
482 -e 's/mv -v/&f/g' \
483 -e 's/mkdir -v/&p/g' -i ${script}
484 done
485 # Remove Bzip2 binaries before make install
486 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
487 # Delete *old Readline libraries just after make install
488 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
489 fi
490
491 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N${R_arrow}"
[877cc6a]492
[45f82718]493 for file in final-system$N/* ; do
[877cc6a]494 # Keep the script file name
495 this_script=`basename $file`
496
[45f82718]497 # Test if the stripping phase must be skipped.
498 # Skip alsp temp-perl for iterative runs
[877cc6a]499 case $this_script in
[401f81e]500 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
[45f82718]501 *temp-perl*) [[ -n "$N" ]] && continue ;;
[877cc6a]502 esac
503
504 # Grab the name of the target, strip id number, XXX-script
505 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
506 -e 's@temp-@@' \
507 -e 's@-64bit@@' \
508 -e 's@-64@@' \
509 -e 's@64@@' \
510 -e 's@n32@@'`
511
[45f82718]512 # Find the version of the command files, if it corresponds with the building of
513 # a specific package. We need this here to can skip scripts not needed for
514 # iterations rebuilds
[a160d86]515 pkg_tarball=$(get_package_tarball_name $name)
[9d9ecf7]516
[a160d86]517 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]518 case "${this_script}" in
519 *stripping*) ;;
520 *) continue ;;
521 esac
522 fi
523
524 # Append each name of the script files to a list (this will become
525 # the names of the targets in the Makefile
526 basicsystem="$basicsystem ${this_script}${N}"
527
528 # Append each name of the script files to a list (this will become
529 # the names of the logs to be moved for each iteration)
530 LOGS="$LOGS ${this_script}"
531
[877cc6a]532 #--------------------------------------------------------------------#
533 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
534 #--------------------------------------------------------------------#
535 #
536 # Drop in the name of the target on a new line, and the previous target
537 # as a dependency. Also call the echo_message function.
[45f82718]538 wrt_target "${this_script}${N}" "$PREV"
[877cc6a]539
[a160d86]540 # If $pkg_tarball isn't empty, we've got a package...
541 if [ "$pkg_tarball" != "" ] ; then
542 wrt_unpack2 "$pkg_tarball"
[a229600]543 # If the testsuites must be run, initialize the log file
544 case $name in
545 binutils | gcc | glibc )
546 [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
547 ;;
548 * )
549 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
550 ;;
551 esac
552 # If using optimizations, write the instructions
[1b65a84]553 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]554 fi
555 #
556 wrt_run_as_chroot1 "${this_script}" "${file}"
557 #
[a160d86]558 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]559 #
560 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]561 wrt_touch
[877cc6a]562 #
563 #--------------------------------------------------------------------#
564 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
565 #--------------------------------------------------------------------#
566 #
567 # Keep the script file name for Makefile dependencies.
[45f82718]568 PREV=${this_script}${N}
569 # Set system_build envar for iteration targets
570 system_build=$basicsystem
[877cc6a]571 done # for file in final-system/* ...
572}
573
574
575#-----------------------------#
576bm_final_system_Makefiles() { #
577#-----------------------------#
[45f82718]578 # Set envars and scripts for iteration targets
579 LOGS="" # Start with an empty global LOGS envar
580 if [[ -z "$1" ]] ; then
581 local N=""
582 # The makesys phase was initiated in bm_testsuite_tools_makefile
583 [[ "$TEST" = 0 ]] && PREV=""
584 else
585 local N=-build_$1
586 local basicsystem=""
587 mkdir final-system$N
588 cp final-system/* final-system$N
589 for script in final-system$N/* ; do
590 # Overwrite existing symlinks, files, and dirs
591 sed -e 's/ln -sv/&f/g' \
592 -e 's/mv -v/&f/g' \
593 -e 's/mkdir -v/&p/g' -i ${script}
594 done
595 # Remove Bzip2 binaries before make install
596 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
597 # Delete *old Readline libraries just after make install
598 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
599 fi
[877cc6a]600
[45f82718]601 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
[877cc6a]602
[45f82718]603 for file in final-system$N/* ; do
[877cc6a]604 # Keep the script file name
605 this_script=`basename $file`
606
607 # Test if the stripping phase must be skipped
[45f82718]608 # Skip alsp temp-perl for iterative runs
[877cc6a]609 case $this_script in
[401f81e]610 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
[45f82718]611 *temp-perl*) [[ -n "$N" ]] && continue ;;
[877cc6a]612 esac
613
614 # Grab the name of the target, strip id number, XXX-script
615 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
616 -e 's@temp-@@' \
617 -e 's@-64bit@@' \
618 -e 's@-64@@' \
619 -e 's@64@@' \
620 -e 's@n32@@'`
621
[45f82718]622 # Find the version of the command files, if it corresponds with the building of
623 # a specific package. We need this here to can skip scripts not needed for
624 # iterations rebuilds
[877cc6a]625
[a160d86]626 pkg_tarball=$(get_package_tarball_name $name)
627
628 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[45f82718]629 case "${this_script}" in
630 *stripping*) ;;
631 *) continue ;;
632 esac
633 fi
634
635 # Append each name of the script files to a list (this will become
636 # the names of the targets in the Makefile
637 basicsystem="$basicsystem ${this_script}${N}"
638
639 # Append each name of the script files to a list (this will become
640 # the names of the logs to be moved for each iteration)
641 LOGS="$LOGS ${this_script}"
642
[877cc6a]643 #--------------------------------------------------------------------#
644 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
645 #--------------------------------------------------------------------#
646 #
647 # Drop in the name of the target on a new line, and the previous target
648 # as a dependency. Also call the echo_message function.
[7eb9402]649 wrt_target_boot "${this_script}${N}" "$PREV"
[877cc6a]650
[a160d86]651 # If $pkg_tarball isn't empty, we've got a package...
652 if [ "$pkg_tarball" != "" ] ; then
653 FILE="$pkg_tarball"
[45f82718]654 wrt_unpack3 "$FILE"
[a229600]655 # If the testsuites must be run, initialize the log file
656 case $name in
657 binutils | gcc | glibc )
658 [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
659 ;;
660 * )
661 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
662 ;;
663 esac
664 # If using optimizations, write the instructions
[1b65a84]665 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[877cc6a]666 fi
667 #
668 wrt_run_as_root2 "${this_script}" "${file}"
669 #
[a160d86]670 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[877cc6a]671 #
672 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]673 wrt_touch
[877cc6a]674 #
675 #--------------------------------------------------------------------#
676 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
677 #--------------------------------------------------------------------#
678 #
679 # Keep the script file name for Makefile dependencies.
[45f82718]680 PREV=${this_script}${N}
681 # Set system_build envar for iteration targets
682 system_build=$basicsystem
[877cc6a]683 done # for file in final-system/* ...
684}
685
686
687#-----------------------------#
688bootscripts_Makefiles() { #
689#-----------------------------#
690 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
691
692 for file in bootscripts/* ; do
693 # Keep the script file name
694 this_script=`basename $file`
695
696 case $this_script in
697 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
698 *console*) continue ;; # Use the files that came with the bootscripts
699 *) ;;
700 esac
701
702 # First append each name of the script files to a list (this will become
703 # the names of the targets in the Makefile
704 bootscripttools="$bootscripttools $this_script"
705
706 # Grab the name of the target, strip id number, XXX-script
707 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
708 -e 's@-64bit@@' \
709 -e 's@-64@@' \
710 -e 's@64@@' \
711 -e 's@n32@@'`
712 case $name in
[c044e3c]713 *bootscripts*) name=bootscripts-cross-lfs ;;
[877cc6a]714 *udev-rules) name=udev-cross-lfs ;;
715 esac
[c044e3c]716
[a160d86]717 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]718
719 #--------------------------------------------------------------------#
720 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
721 #--------------------------------------------------------------------#
722 #
723 # Drop in the name of the target on a new line, and the previous target
724 # as a dependency. Also call the echo_message function.
[041bc01]725 wrt_target "${this_script}" "$PREV"
[877cc6a]726 #
[a160d86]727 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]728 #
[a160d86]729 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[877cc6a]730 #
731 wrt_run_as_chroot1 "${this_script}" "${file}"
732 #
[a160d86]733 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]734 #
735 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]736 wrt_touch
[877cc6a]737 #
738 #--------------------------------------------------------------------#
739 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
740 #--------------------------------------------------------------------#
741 #
742 # Keep the script file name for Makefile dependencies.
743 PREV=$this_script
744
745 done # for file in bootscripts/* ...
746
747}
748
749#-----------------------------#
750bm_bootscripts_Makefiles() { #
751#-----------------------------#
752 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
753
754 for file in bootscripts/* ; do
755 # Keep the script file name
756 this_script=`basename $file`
757
758 case $this_script in
[33c7b13]759 *udev) continue ;; # This is not a script but a commentary
[877cc6a]760 *console*) continue ;; # Use the files that came with the bootscripts
761 *) ;;
762 esac
763
764 # First append each name of the script files to a list (this will become
765 # the names of the targets in the Makefile
766 bootscripttools="$bootscripttools $this_script"
767
768 # Grab the name of the target, strip id number, XXX-script
769 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
770 -e 's@-64bit@@' \
771 -e 's@-64@@' \
772 -e 's@64@@' \
773 -e 's@n32@@'`
774 case $name in
[33c7b13]775 *bootscripts*) name=bootscripts-cross-lfs ;;
776 *udev-rules) name=udev-cross-lfs ;;
[877cc6a]777 esac
[a160d86]778
779 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]780
781 #--------------------------------------------------------------------#
782 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
783 #--------------------------------------------------------------------#
784 #
785 # Drop in the name of the target on a new line, and the previous target
786 # as a dependency. Also call the echo_message function.
[7eb9402]787 wrt_target_boot "${this_script}" "$PREV"
[877cc6a]788 #
[a160d86]789 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]790 #
[a160d86]791 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[877cc6a]792 #
793 wrt_run_as_root2 "${this_script}" "${file}"
794 #
[a160d86]795 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[877cc6a]796 #
797 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]798 wrt_touch
[877cc6a]799 #
800 #--------------------------------------------------------------------#
801 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
802 #--------------------------------------------------------------------#
803 #
804 # Keep the script file name for Makefile dependencies.
805 PREV=$this_script
806
807 done # for file in bootscripts/* ...
808
809}
810
811
812
813#-----------------------------#
814bootable_Makefiles() { #
815#-----------------------------#
816 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
817
818 for file in {bootable,the-end}/* ; do
819 # Keep the script file name
820 this_script=`basename $file`
821
822 # A little housekeeping on the scripts
823 case $this_script in
824 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
825 *kernel) # if there is no kernel config file do not build the kernel
826 [[ -z $CONFIG ]] && continue
827 # Copy the config file to /sources with a standardized name
828 cp $CONFIG $BUILDDIR/sources/kernel-config
829 ;;
830 esac
831 #
832 # First append each name of the script files to a list (this will become
833 # the names of the targets in the Makefile
834 bootabletools="$bootabletools $this_script"
835 #
836 # Grab the name of the target, strip id number and misc words.
837 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
838 case $this_script in
839 *kernel*) name=linux
840 ;;
841 esac
[a160d86]842
843 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]844
845 #--------------------------------------------------------------------#
846 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
847 #--------------------------------------------------------------------#
848 #
849 # Drop in the name of the target on a new line, and the previous target
850 # as a dependency. Also call the echo_message function.
[041bc01]851 wrt_target "${this_script}" "$PREV"
[877cc6a]852 #
[a160d86]853 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]854 # Insert instructions for unpacking the package and changing directories
855 #
[a160d86]856 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[877cc6a]857 #
858 # Select a script execution method
859 case $this_script in
860 *fstab*) if [[ -n "$FSTAB" ]]; then
861 wrt_copy_fstab "${this_script}"
862 else
863 wrt_run_as_chroot1 "${this_script}" "${file}"
864 fi
865 ;;
866 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
867 esac
868 #
869 # Housekeeping...remove any build directory(ies) except if the package build fails.
[a160d86]870 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[877cc6a]871 #
872 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]873 wrt_touch
[877cc6a]874 #
875 #--------------------------------------------------------------------#
876 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
877 #--------------------------------------------------------------------#
878 #
879 # Keep the script file name for Makefile dependencies.
880 PREV=$this_script
881
882 done
883
[453bef0]884 # Add SBU-disk_usage report target if required
[401f81e]885 if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
[453bef0]886
[877cc6a]887}
888
889
890
891#-----------------------------#
892bm_bootable_Makefiles() { #
893#-----------------------------#
894 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
895
896 for file in {bootable,the-end}/* ; do
897 # Keep the script file name
898 this_script=`basename $file`
899
900 # A little housekeeping on the scripts
901 case $this_script in
902 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
903 *kernel) # if there is no kernel config file do not build the kernel
904 [[ -z $CONFIG ]] && continue
905 # Copy the named config file to /sources with a standardized name
906 cp $CONFIG $BUILDDIR/sources/kernel-config
907 ;;
908 esac
909 #
910 # First append each name of the script files to a list (this will become
911 # the names of the targets in the Makefile
912 bootabletools="$bootabletools $this_script"
913 #
914 # Grab the name of the target, strip id number and misc words.
915 case $this_script in
[a160d86]916 *kernel) name=linux ;;
[877cc6a]917 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
918 esac
919
[a160d86]920 pkg_tarball=$(get_package_tarball_name $name)
[877cc6a]921
922 #--------------------------------------------------------------------#
923 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
924 #--------------------------------------------------------------------#
925 #
926 # Drop in the name of the target on a new line, and the previous target
927 # as a dependency. Also call the echo_message function.
[7eb9402]928 wrt_target_boot "${this_script}" "$PREV"
[877cc6a]929 #
[a160d86]930 # If $pkg_tarball isn't empty, we've got a package...
[877cc6a]931 # Insert instructions for unpacking the package and changing directories
932 #
[a160d86]933 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[877cc6a]934 #
935 # Select a script execution method
936 case $this_script in
937 *fstab*) if [[ -n "$FSTAB" ]]; then
938 # Minimal boot mode has no access to original file, store in /sources
939 cp $FSTAB $BUILDDIR/sources/fstab
940 wrt_copy_fstab2 "${this_script}"
941 else
942 wrt_run_as_root2 "${this_script}" "${file}"
943 fi
944 ;;
945 *) wrt_run_as_root2 "${this_script}" "${file}" ;;
946 esac
947 #
948 # Housekeeping...remove any build directory(ies) except if the package build fails.
[a160d86]949 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[877cc6a]950 #
951 # Include a touch of the target name so make can check if it's already been made.
[93f38e7]952 wrt_touch
[877cc6a]953 #
954 #--------------------------------------------------------------------#
955 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
956 #--------------------------------------------------------------------#
957 #
958 # Keep the script file name for Makefile dependencies.
959 PREV=$this_script
960
961 done
962
[453bef0]963 # Add SBU-disk_usage report target if required
[401f81e]964 if [[ "$REPORT" = "y" ]] ; then wrt_report ; fi
[453bef0]965
[877cc6a]966}
967
968
969#-----------------------------#
970build_Makefile() { # Construct a Makefile from the book scripts
971#-----------------------------#
972 echo "Creating Makefile... ${BOLD}START${OFF}"
973
974 cd $JHALFSDIR/${PROGNAME}-commands
975 # Start with a clean Makefile.tmp file
976 >$MKFILE.tmp
977
978 host_prep_Makefiles
979 cross_tools_Makefiles # $cross_tools
980 temptools_Makefiles # $temptools
981 if [[ $METHOD = "chroot" ]]; then
982 chroot_Makefiles # $chroottools
983 if [[ ! $TEST = "0" ]]; then
984 testsuite_tools_Makefiles # $testsuitetools
985 fi
986 final_system_Makefiles # $basicsystem
[45f82718]987 # Add the iterations targets, if needed
[401f81e]988 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
[877cc6a]989 bootscripts_Makefiles # $bootscripttools
990 bootable_Makefiles # $bootabletools
991 else
992 boot_Makefiles # $boottools
993 if [[ ! $TEST = "0" ]]; then
994 bm_testsuite_tools_Makefiles # $testsuitetools
995 fi
996 bm_final_system_Makefiles # $basicsystem
[45f82718]997 # Add the iterations targets, if needed
[401f81e]998 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
[877cc6a]999 bm_bootscripts_Makefiles # $bootscipttools
1000 bm_bootable_Makefiles # $bootabletoosl
1001 fi
1002# the_end_Makefiles
1003
1004
1005 # Add a header, some variables and include the function file
1006 # to the top of the real Makefile.
1007(
1008 cat << EOF
1009$HEADER
1010
[401f81e]1011SRC = /sources
1012MOUNT_PT = $BUILDDIR
1013PKG_LST = $PKG_LST
1014LUSER = $LUSER
1015LGROUP = $LGROUP
1016SCRIPT_ROOT = $SCRIPT_ROOT
1017
1018BASEDIR = \$(MOUNT_PT)
1019SRCSDIR = \$(BASEDIR)/sources
1020CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
1021LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs
1022TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs
1023
1024crSRCSDIR = /sources
1025crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
1026crLOGDIR = /\$(SCRIPT_ROOT)/logs
1027crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
1028
1029SU_LUSER = su - \$(LUSER) -c
1030LUSER_HOME = /home/\$(LUSER)
1031PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n"
1032PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n"
1033
[877cc6a]1034
1035include makefile-functions
1036
1037EOF
1038) > $MKFILE
1039
1040 # Add chroot commands
1041 if [ "$METHOD" = "chroot" ] ; then
[6ad5a2f]1042 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
1043 chroot=`cat chroot/*chroot* | \
1044 sed -e "s@chroot@$CHROOT_LOC@" \
1045 -e '/#!\/tools\/bin\/bash/d' \
1046 -e '/^export/d' \
1047 -e '/^logout/d' \
1048 -e 's@ \\\@ @g' | \
1049 tr -d '\n' | \
1050 sed -e 's/ */ /g' \
1051 -e 's|\\$|&&|g' \
1052 -e 's|exit||g' \
1053 -e 's|$| -c|' \
1054 -e 's|"$$CLFS"|$(MOUNT_PT)|'\
1055 -e 's|set -e||'`
[877cc6a]1056 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1057 fi
1058
1059 # Drop in the main target 'all:' and the chapter targets with each sub-target
1060 # as a dependency.
1061if [[ "${METHOD}" = "chroot" ]]; then
1062(
1063 cat << EOF
[7d9a82d]1064all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 do-housekeeping
[877cc6a]1065 @\$(call echo_finished,$VERSION)
1066
1067chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
1068
1069chapter3: chapter2 $cross_tools
1070
1071chapter4: chapter3 $temptools
1072
[6ad5a2f]1073chapter5: chapter4 $chroottools restore-luser-env $testsuitetools
[877cc6a]1074
1075chapter6: chapter5 $basicsystem
1076
1077chapter7: chapter6 $bootscripttools
1078
1079chapter8: chapter7 $bootabletools
1080
1081clean-all: clean
1082 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
1083
1084clean: clean-chapter4 clean-chapter3 clean-chapter2
1085
[a160d86]1086restart:
1087 @echo "This feature does not exist for the CLFS makefile. (yet)"
1088
[877cc6a]1089clean-chapter2:
[6ad5a2f]1090 -if [ ! -f luser-exist ]; then \\
1091 userdel \$(LUSER); \\
1092 rm -rf /home/\$(LUSER); \\
[877cc6a]1093 fi;
1094 rm -rf \$(MOUNT_PT)/tools
1095 rm -f /tools
1096 rm -rf \$(MOUNT_PT)/cross-tools
1097 rm -f /cross-tools
[6ad5a2f]1098 rm -f envars luser-exist
[877cc6a]1099 rm -f 02* logs/02*.log
1100
1101clean-chapter3:
1102 rm -rf \$(MOUNT_PT)/tools/*
[6ad5a2f]1103 rm -f $cross_tools sources-dir
[877cc6a]1104 cd logs && rm -f $cross_tools && cd ..
1105
1106clean-chapter4:
1107 -umount \$(MOUNT_PT)/sys
1108 -umount \$(MOUNT_PT)/proc
1109 -umount \$(MOUNT_PT)/dev/shm
1110 -umount \$(MOUNT_PT)/dev/pts
1111 -umount \$(MOUNT_PT)/dev
1112 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
1113 rm -f $temptools
1114 cd logs && rm -f $temptools && cd ..
1115
1116
[6ad5a2f]1117restore-luser-env:
[877cc6a]1118 @\$(call echo_message, Building)
[6ad5a2f]1119 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
1120 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[877cc6a]1121 fi;
[6ad5a2f]1122 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
1123 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[877cc6a]1124 fi;
[6ad5a2f]1125 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[93f38e7]1126 touch \$@ && \\
1127 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1128 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]1129
[7d9a82d]1130do-housekeeping:
[4524fb2]1131 @-umount \$(MOUNT_PT)/dev/pts
1132 @-umount \$(MOUNT_PT)/dev/shm
1133 @-umount \$(MOUNT_PT)/dev
1134 @-umount \$(MOUNT_PT)/sys
1135 @-umount \$(MOUNT_PT)/proc
[6ad5a2f]1136 @-if [ ! -f luser-exist ]; then \\
1137 userdel \$(LUSER); \\
1138 rm -rf /home/\$(LUSER); \\
[7d9a82d]1139 fi;
1140
[877cc6a]1141EOF
1142) >> $MKFILE
1143fi
1144
1145
1146if [[ "${METHOD}" = "boot" ]]; then
1147(
1148 cat << EOF
1149
[041bc01]1150all: makeboot
[877cc6a]1151
1152makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
1153 $cross_tools\
1154 $temptools \
1155 $chroottools \
[6ad5a2f]1156 $boottools restore-luser-env
[877cc6a]1157 @\$(call echo_boot_finished,$VERSION)
1158
1159makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
1160 @\$(call echo_finished,$VERSION)
1161
1162
1163clean-all: clean
1164 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
1165
1166clean: clean-makesys clean-makeboot clean-jhalfs
1167
[a160d86]1168restart:
1169 @echo "This feature does not exist for the CLFS makefile. (yet)"
1170
[877cc6a]1171clean-jhalfs:
[6ad5a2f]1172 -if [ ! -f luser-exist ]; then \\
1173 userdel \$(LUSER); \\
1174 rm -rf /home/\$(LUSER); \\
[877cc6a]1175 fi;
1176 rm -rf \$(MOUNT_PT)/tools
1177 rm -f /tools
1178 rm -rf \$(MOUNT_PT)/cross-tools
1179 rm -f /cross-tools
[6ad5a2f]1180 rm -f envars luser-exist
[877cc6a]1181 rm -f 02* logs/02*.log
1182
1183clean-makeboot:
1184 rm -rf /tools/*
1185 rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
[6ad5a2f]1186 rm -f restore-luser-env sources-dir
[877cc6a]1187 cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
1188
1189clean-makesys:
1190 -umount \$(MOUNT_PT)/sys
1191 -umount \$(MOUNT_PT)/proc
1192 -umount \$(MOUNT_PT)/dev/shm
1193 -umount \$(MOUNT_PT)/dev/pts
1194 -umount \$(MOUNT_PT)/dev
1195 rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
1196 rm -f $basicsystem
1197 rm -f $bootscripttools
1198 rm -f $bootabletools
1199 cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
1200
1201
[6ad5a2f]1202restore-luser-env:
[877cc6a]1203 @\$(call echo_message, Building)
[6ad5a2f]1204 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
1205 mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[877cc6a]1206 fi;
[6ad5a2f]1207 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
1208 mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[877cc6a]1209 fi;
[6ad5a2f]1210 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[93f38e7]1211 touch \$@ && \\
1212 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1213 echo --------------------------------------------------------------------------------\$(WHITE)
[877cc6a]1214
[7d9a82d]1215
[877cc6a]1216EOF
1217) >> $MKFILE
1218fi
1219
1220 # Bring over the items from the Makefile.tmp
1221 cat $MKFILE.tmp >> $MKFILE
1222 rm $MKFILE.tmp
1223 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1224
1225}
1226
Note: See TracBrowser for help on using the repository browser.