source: CLFS/master.sh@ 6a9d41e

experimental
Last change on this file since 6a9d41e was 398a037, checked in by George Boudreau <georgeb@…>, 18 years ago

Mods to most files to allow for reduction of internal functions and reduction in the size of the generated makefile

  • Property mode set to 100755
File size: 42.5 KB
RevLine 
[0170229]1#!/bin/sh
[1ce084e]2# $Id$
[0170229]3
4###################################
5### FUNCTIONS ###
6###################################
7
8
9#----------------------------#
[fcaf131]10host_prep_Makefiles() { # Initialization of the system
[0170229]11#----------------------------#
[3b63c8c]12 local CLFS_HOST
[0170229]13
14 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
15
16 # defined here, only for ease of reading
[3b63c8c]17 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
[0170229]18(
19cat << EOF
20023-creatingtoolsdir:
21 @\$(call echo_message, Building)
[9199a13]22 @mkdir \$(MOUNT_PT)/tools && \\
23 rm -f /tools && \\
24 ln -s \$(MOUNT_PT)/tools /
[0170229]25 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
26 mkdir \$(MOUNT_PT)/sources; \\
27 fi;
28 @chmod a+wt \$(MOUNT_PT)/sources && \\
[9199a13]29 touch \$@ && \\
30 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
31 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]32
33024-creatingcrossdir: 023-creatingtoolsdir
34 @mkdir -v \$(MOUNT_PT)/cross-tools && \\
[9199a13]35 rm -f /cross-tools && \\
36 ln -s \$(MOUNT_PT)/cross-tools /
37 @touch \$@ && \\
38 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
39 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]40
41025-addinguser: 024-creatingcrossdir
42 @\$(call echo_message, Building)
[9485eba]43 @if [ ! -d /home/\$(LUSER) ]; then \\
44 groupadd \$(LGROUP); \\
45 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
[0170229]46 else \\
[30737ea8]47 touch luser-exist; \\
[0170229]48 fi;
[9485eba]49 @chown \$(LUSER) \$(MOUNT_PT) && \\
50 chown \$(LUSER) \$(MOUNT_PT)/tools && \\
51 chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
52 chown \$(LUSER) \$(MOUNT_PT)/sources && \\
[9199a13]53 touch \$@ && \\
54 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
55 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]56
57026-settingenvironment: 025-addinguser
58 @\$(call echo_message, Building)
[9485eba]59 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
60 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
[0170229]61 fi;
[9485eba]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; \\
[0170229]64 fi;
[9485eba]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 && \\
[0170229]80 touch envars && \\
[9199a13]81 touch \$@ && \\
82 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
83 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]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@@' \
[3b63c8c]119 -e 's@-64@@' \
[0170229]120 -e 's@-n32@@'`
[3b63c8c]121 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]129 wrt_target "${this_script}" "$PREV"
[0170229]130 #
[3b63c8c]131 # If $pkg_tarball isn't empty, we've got a package...
[0170229]132 #
[9485eba]133 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[0170229]134 #
[9485eba]135 wrt_RunAsUser "${this_script}" "${file}"
[0170229]136 #
[3b63c8c]137 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]138 #
139 # Include a touch of the target name so make can check if it's already been made.
[9199a13]140 wrt_touch
[0170229]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`
[3b63c8c]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
169
[0170229]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 #
[3b63c8c]179 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]187 wrt_target "${this_script}" "$PREV"
[0170229]188 #
[3b63c8c]189 # If $pkg_tarball isn't empty, we've got a package...
[0170229]190 # Insert instructions for unpacking the package and to set the PKGDIR variable.
191 #
[9485eba]192 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[3b63c8c]193 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]194 #
[9485eba]195 wrt_RunAsUser "${this_script}" "${file}"
[0170229]196 #
[3b63c8c]197 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]198 #
199 # Include a touch of the target name so make can check if it's already been made.
[9199a13]200 wrt_touch
[0170229]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
[6d3564b]223 *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
[0170229]224 *whatnext*) continue ;;
[0271c0c]225 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]226 [[ -z $CONFIG ]] && continue
[0271c0c]227 # Copy the config file to /sources with a standardized name
[6eef5ef]228 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
[0170229]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
[6d3564b]238 *kernel) name=linux ;;
[fcaf131]239 *bootscripts) name="bootscripts-cross-lfs" ;;
[9dc8222]240 *udev-rules) name="udev-cross-lfs" ;;
[6d3564b]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 ;;
[0170229]248 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
249 esac
[3b63c8c]250 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
251 pkg_tarball=$(get_package_tarball_name $name)
[0170229]252
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.
[3e1c0e2]259 wrt_target "${this_script}" "$PREV"
[0170229]260 #
[3b63c8c]261 # If $pkg_tarball isn't empty, we've got a package...
[0170229]262 # Insert instructions for unpacking the package and changing directories
263 #
[9485eba]264 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
[3b63c8c]265 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]266 #
267 # Select a script execution method
268 case $this_script in
[9485eba]269 *changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;;
270 *devices*) wrt_RunAsRoot "${this_script}" "${file}" ;;
[0170229]271 *fstab*) if [[ -n "$FSTAB" ]]; then
272 wrt_copy_fstab "${this_script}"
273 else
[9485eba]274 wrt_RunAsUser "${this_script}" "${file}"
[0170229]275 fi
276 ;;
[9485eba]277 *) wrt_RunAsUser "${this_script}" "${file}" ;;
[0170229]278 esac
279 #
280 # Housekeeping...remove any build directory(ies) except if the package build fails.
[3b63c8c]281 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]282 #
283 # Include a touch of the target name so make can check if it's already been made.
[9199a13]284 wrt_touch
[0170229]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.
[fd5cb46]307 case $this_script in
308 *chroot*) continue ;;
309 esac
[0170229]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\}-@@'`
[3b63c8c]318
319 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]327 wrt_target "${this_script}" "$PREV"
[0170229]328 #
[3b63c8c]329 # If $pkg_tarball isn't empty, we've got a package...
[0170229]330 # Insert instructions for unpacking the package and changing directories
331 #
[3b63c8c]332 if [ "$pkg_tarball" != "" ] ; then
[0170229]333 case $this_script in
[9485eba]334 *util-linux) wrt_unpack "$pkg_tarball" ;;
[3b63c8c]335 *) wrt_unpack2 "$pkg_tarball" ;;
[0170229]336 esac
[c205656]337 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]338 fi
339 #
340 # Select a script execution method
341 case $this_script in
[9485eba]342 *kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;;
343 *util-linux) wrt_RunAsUser "${this_script}" "${file}" ;;
344 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
[0170229]345 esac
346 #
347 # Housekeeping...remove the build directory(ies), except if the package build fails.
[3b63c8c]348 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]349 #
350 # Include a touch of the target name so make can check if it's already been made.
[9199a13]351 wrt_touch
[0170229]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#-----------------------------#
[afd0232]367 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
[0170229]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
[3b63c8c]384 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]392 wrt_target "${this_script}" "$PREV"
[0170229]393 #
[3b63c8c]394 wrt_unpack2 "$pkg_tarball"
[c205656]395 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]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.
[9199a13]402 wrt_touch
[0170229]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#--------------------------------#
[afd0232]418 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
[0170229]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
[39d4d5c]426 PREV=
[0170229]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
[3b63c8c]436 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]444 wrt_target_boot "${this_script}" "$PREV"
[0170229]445 #
[3b63c8c]446 wrt_unpack3 "$pkg_tarball"
[c205656]447 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]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.
[9199a13]454 wrt_touch
[0170229]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#-----------------------------#
[b12abe1]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}"
[0170229]492
[b12abe1]493 for file in final-system$N/* ; do
[0170229]494 # Keep the script file name
495 this_script=`basename $file`
496
[b12abe1]497 # Test if the stripping phase must be skipped.
498 # Skip alsp temp-perl for iterative runs
[fd5cb46]499 case $this_script in
[b12abe1]500 *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
501 *temp-perl*) [[ -n "$N" ]] && continue ;;
[fd5cb46]502 esac
[3fcd63e]503
[0170229]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
[b12abe1]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
[3b63c8c]515 pkg_tarball=$(get_package_tarball_name $name)
[0170229]516
[3b63c8c]517 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[b12abe1]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
[0170229]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.
[b12abe1]538 wrt_target "${this_script}${N}" "$PREV"
[0170229]539
[3b63c8c]540 # If $pkg_tarball isn't empty, we've got a package...
541 if [ "$pkg_tarball" != "" ] ; then
542 wrt_unpack2 "$pkg_tarball"
[e35e794]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
[c205656]553 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]554 fi
555 #
556 wrt_run_as_chroot1 "${this_script}" "${file}"
557 #
[3b63c8c]558 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]559 #
560 # Include a touch of the target name so make can check if it's already been made.
[9199a13]561 wrt_touch
[0170229]562 #
563 #--------------------------------------------------------------------#
564 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
565 #--------------------------------------------------------------------#
566 #
567 # Keep the script file name for Makefile dependencies.
[b12abe1]568 PREV=${this_script}${N}
569 # Set system_build envar for iteration targets
570 system_build=$basicsystem
[0170229]571 done # for file in final-system/* ...
572}
573
574
575#-----------------------------#
576bm_final_system_Makefiles() { #
577#-----------------------------#
[b12abe1]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
[0170229]600
[b12abe1]601 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
[39d4d5c]602
[b12abe1]603 for file in final-system$N/* ; do
[0170229]604 # Keep the script file name
605 this_script=`basename $file`
606
[3fcd63e]607 # Test if the stripping phase must be skipped
[b12abe1]608 # Skip alsp temp-perl for iterative runs
[64cc345]609 case $this_script in
[b12abe1]610 *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
611 *temp-perl*) [[ -n "$N" ]] && continue ;;
[fd5cb46]612 esac
[0170229]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
[b12abe1]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
[0170229]625
[3b63c8c]626 pkg_tarball=$(get_package_tarball_name $name)
627
628 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[b12abe1]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
[0170229]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.
[3b63c8c]649 wrt_target_boot "${this_script}${N}" "$PREV"
[0170229]650
[3b63c8c]651 # If $pkg_tarball isn't empty, we've got a package...
652 if [ "$pkg_tarball" != "" ] ; then
653 FILE="$pkg_tarball"
[b12abe1]654 wrt_unpack3 "$FILE"
[e35e794]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
[c205656]665 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]666 fi
667 #
668 wrt_run_as_root2 "${this_script}" "${file}"
669 #
[3b63c8c]670 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]671 #
672 # Include a touch of the target name so make can check if it's already been made.
[9199a13]673 wrt_touch
[0170229]674 #
675 #--------------------------------------------------------------------#
676 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
677 #--------------------------------------------------------------------#
678 #
679 # Keep the script file name for Makefile dependencies.
[b12abe1]680 PREV=${this_script}${N}
681 # Set system_build envar for iteration targets
682 system_build=$basicsystem
[0170229]683 done # for file in final-system/* ...
684}
685
686
687#-----------------------------#
688bootscripts_Makefiles() { #
689#-----------------------------#
[afd0232]690 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
[0170229]691
692 for file in bootscripts/* ; do
693 # Keep the script file name
694 this_script=`basename $file`
695
696 case $this_script in
[eba62c0]697 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
[0170229]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@@'`
[fd5cb46]712 case $name in
[eba62c0]713 *bootscripts*) name=bootscripts-cross-lfs ;;
714 *udev-rules) name=udev-cross-lfs ;;
[fd5cb46]715 esac
[3b63c8c]716
717 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]725 wrt_target "${this_script}" "$PREV"
[0170229]726 #
[3b63c8c]727 # If $pkg_tarball isn't empty, we've got a package...
[0170229]728 #
[3b63c8c]729 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[0170229]730 #
731 wrt_run_as_chroot1 "${this_script}" "${file}"
732 #
[3b63c8c]733 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]734 #
735 # Include a touch of the target name so make can check if it's already been made.
[9199a13]736 wrt_touch
[0170229]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#-----------------------------#
[afd0232]752 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
[0170229]753
754 for file in bootscripts/* ; do
755 # Keep the script file name
756 this_script=`basename $file`
757
758 case $this_script in
[9485eba]759 *udev) continue ;; # This is not a script but a commentary
[0170229]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@@'`
[fd5cb46]774 case $name in
[9485eba]775 *bootscripts*) name=bootscripts-cross-lfs ;;
776 *udev-rules) name=udev-cross-lfs ;;
[fd5cb46]777 esac
[3b63c8c]778
779 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]787 wrt_target_boot "${this_script}" "$PREV"
[0170229]788 #
[3b63c8c]789 # If $pkg_tarball isn't empty, we've got a package...
[0170229]790 #
[3b63c8c]791 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[0170229]792 #
793 wrt_run_as_root2 "${this_script}" "${file}"
794 #
[3b63c8c]795 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]796 #
797 # Include a touch of the target name so make can check if it's already been made.
[9199a13]798 wrt_touch
[0170229]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#-----------------------------#
[afd0232]816 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
[0170229]817
[7f38b6d]818 for file in {bootable,the-end}/* ; do
[0170229]819 # Keep the script file name
820 this_script=`basename $file`
821
822 # A little housekeeping on the scripts
823 case $this_script in
[7f38b6d]824 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[87b93b4]825 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]826 [[ -z $CONFIG ]] && continue
[0271c0c]827 # Copy the config file to /sources with a standardized name
[1917cad]828 cp $CONFIG $BUILDDIR/sources/kernel-config
[87b93b4]829 ;;
[0170229]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@@' `
[fd5cb46]838 case $this_script in
839 *kernel*) name=linux
840 ;;
841 esac
[3b63c8c]842
843 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]851 wrt_target "${this_script}" "$PREV"
[0170229]852 #
[3b63c8c]853 # If $pkg_tarball isn't empty, we've got a package...
[0170229]854 # Insert instructions for unpacking the package and changing directories
855 #
[3b63c8c]856 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[0170229]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
[fcaf131]863 wrt_run_as_chroot1 "${this_script}" "${file}"
[0170229]864 fi
865 ;;
[fcaf131]866 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
[0170229]867 esac
868 #
869 # Housekeeping...remove any build directory(ies) except if the package build fails.
[3b63c8c]870 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]871 #
872 # Include a touch of the target name so make can check if it's already been made.
[9199a13]873 wrt_touch
[0170229]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
[9e4b9a1]884 # Add SBU-disk_usage report target if required
885 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
886
[0170229]887}
888
889
890
891#-----------------------------#
892bm_bootable_Makefiles() { #
893#-----------------------------#
[afd0232]894 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
[0170229]895
[7f38b6d]896 for file in {bootable,the-end}/* ; do
[0170229]897 # Keep the script file name
898 this_script=`basename $file`
899
900 # A little housekeeping on the scripts
901 case $this_script in
[7f38b6d]902 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[b83baf6]903 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]904 [[ -z $CONFIG ]] && continue
[0271c0c]905 # Copy the named config file to /sources with a standardized name
[62033d2]906 cp $CONFIG $BUILDDIR/sources/kernel-config
[0170229]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
[3b63c8c]916 *kernel) name=linux ;;
[0170229]917 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
918 esac
919
[3b63c8c]920 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]928 wrt_target_boot "${this_script}" "$PREV"
[0170229]929 #
[3b63c8c]930 # If $pkg_tarball isn't empty, we've got a package...
[0170229]931 # Insert instructions for unpacking the package and changing directories
932 #
[3b63c8c]933 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[0170229]934 #
935 # Select a script execution method
936 case $this_script in
937 *fstab*) if [[ -n "$FSTAB" ]]; then
[a9490ab]938 # Minimal boot mode has no access to original file, store in /sources
939 cp $FSTAB $BUILDDIR/sources/fstab
[0170229]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.
[3b63c8c]949 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]950 #
951 # Include a touch of the target name so make can check if it's already been made.
[9199a13]952 wrt_touch
[0170229]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
[9e4b9a1]963 # Add SBU-disk_usage report target if required
964 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
965
[0170229]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
[d43a271]979 cross_tools_Makefiles # $cross_tools
980 temptools_Makefiles # $temptools
[afd0232]981 if [[ $METHOD = "chroot" ]]; then
[d43a271]982 chroot_Makefiles # $chroottools
[fa06e8e]983 if [[ ! $TEST = "0" ]]; then
[d43a271]984 testsuite_tools_Makefiles # $testsuitetools
[0170229]985 fi
[d43a271]986 final_system_Makefiles # $basicsystem
[b12abe1]987 # Add the iterations targets, if needed
988 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[d43a271]989 bootscripts_Makefiles # $bootscripttools
990 bootable_Makefiles # $bootabletools
[0170229]991 else
[d43a271]992 boot_Makefiles # $boottools
[fa06e8e]993 if [[ ! $TEST = "0" ]]; then
[d43a271]994 bm_testsuite_tools_Makefiles # $testsuitetools
[0170229]995 fi
[d43a271]996 bm_final_system_Makefiles # $basicsystem
[b12abe1]997 # Add the iterations targets, if needed
998 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[d43a271]999 bm_bootscripts_Makefiles # $bootscipttools
1000 bm_bootable_Makefiles # $bootabletoosl
[0170229]1001 fi
[39d4d5c]1002# the_end_Makefiles
[0170229]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
[398a037]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
[0170229]1034
1035include makefile-functions
1036
1037EOF
1038) > $MKFILE
1039
1040 # Add chroot commands
[e676ffa]1041 if [ "$METHOD" = "chroot" ] ; then
[8381f6e]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||'`
[e676ffa]1056 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1057 fi
[0170229]1058
1059 # Drop in the main target 'all:' and the chapter targets with each sub-target
1060 # as a dependency.
[39d4d5c]1061if [[ "${METHOD}" = "chroot" ]]; then
[0170229]1062(
1063 cat << EOF
[3a27393]1064all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 do-housekeeping
[0170229]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
[30737ea8]1073chapter5: chapter4 $chroottools restore-luser-env $testsuitetools
[0170229]1074
1075chapter6: chapter5 $basicsystem
1076
1077chapter7: chapter6 $bootscripttools
1078
1079chapter8: chapter7 $bootabletools
1080
1081clean-all: clean
[db187c74]1082 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[0170229]1083
1084clean: clean-chapter4 clean-chapter3 clean-chapter2
1085
[3b63c8c]1086restart:
1087 @echo "This feature does not exist for the CLFS makefile. (yet)"
1088
[0170229]1089clean-chapter2:
[30737ea8]1090 -if [ ! -f luser-exist ]; then \\
[9485eba]1091 userdel \$(LUSER); \\
1092 rm -rf /home/\$(LUSER); \\
[0170229]1093 fi;
1094 rm -rf \$(MOUNT_PT)/tools
1095 rm -f /tools
1096 rm -rf \$(MOUNT_PT)/cross-tools
1097 rm -f /cross-tools
[30737ea8]1098 rm -f envars luser-exist
[0170229]1099 rm -f 02* logs/02*.log
1100
1101clean-chapter3:
1102 rm -rf \$(MOUNT_PT)/tools/*
[30737ea8]1103 rm -f $cross_tools sources-dir
[0170229]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
[30737ea8]1117restore-luser-env:
[0170229]1118 @\$(call echo_message, Building)
[9485eba]1119 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
1120 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[0170229]1121 fi;
[9485eba]1122 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
1123 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[0170229]1124 fi;
[9485eba]1125 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[9199a13]1126 touch \$@ && \\
1127 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1128 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]1129
[3a27393]1130do-housekeeping:
[9199a13]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
[30737ea8]1136 @-if [ ! -f luser-exist ]; then \\
[9485eba]1137 userdel \$(LUSER); \\
1138 rm -rf /home/\$(LUSER); \\
[3a27393]1139 fi;
1140
[0170229]1141EOF
1142) >> $MKFILE
[39d4d5c]1143fi
1144
1145
1146if [[ "${METHOD}" = "boot" ]]; then
1147(
1148 cat << EOF
[64cc345]1149
[3e1c0e2]1150all: makeboot
[39d4d5c]1151
1152makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
1153 $cross_tools\
1154 $temptools \
1155 $chroottools \
[30737ea8]1156 $boottools restore-luser-env
[39d4d5c]1157 @\$(call echo_boot_finished,$VERSION)
1158
[d43a271]1159makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
[39d4d5c]1160 @\$(call echo_finished,$VERSION)
1161
1162
1163clean-all: clean
[db187c74]1164 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[39d4d5c]1165
1166clean: clean-makesys clean-makeboot clean-jhalfs
1167
[3b63c8c]1168restart:
1169 @echo "This feature does not exist for the CLFS makefile. (yet)"
1170
[39d4d5c]1171clean-jhalfs:
[30737ea8]1172 -if [ ! -f luser-exist ]; then \\
[9485eba]1173 userdel \$(LUSER); \\
1174 rm -rf /home/\$(LUSER); \\
[39d4d5c]1175 fi;
1176 rm -rf \$(MOUNT_PT)/tools
1177 rm -f /tools
1178 rm -rf \$(MOUNT_PT)/cross-tools
1179 rm -f /cross-tools
[30737ea8]1180 rm -f envars luser-exist
[39d4d5c]1181 rm -f 02* logs/02*.log
[0170229]1182
[39d4d5c]1183clean-makeboot:
1184 rm -rf /tools/*
[64cc345]1185 rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
[30737ea8]1186 rm -f restore-luser-env sources-dir
[39d4d5c]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
[30737ea8]1202restore-luser-env:
[39d4d5c]1203 @\$(call echo_message, Building)
[9485eba]1204 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
1205 mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
[39d4d5c]1206 fi;
[9485eba]1207 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
1208 mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
[39d4d5c]1209 fi;
[9485eba]1210 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
[9199a13]1211 touch \$@ && \\
1212 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1213 echo --------------------------------------------------------------------------------\$(WHITE)
[39d4d5c]1214
[3a27393]1215
[39d4d5c]1216EOF
1217) >> $MKFILE
1218fi
[0170229]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.