source: CLFS/master.sh@ d81c640

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

Updated the command to set CLFS_HOST

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