source: CLFS/master.sh@ 21dab83

experimental
Last change on this file since 21dab83 was 3b63c8c, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Updated experimental branch to current trunk code.

  • Property mode set to 100755
File size: 41.7 KB
RevLine 
[0170229]1#!/bin/sh
[1ce084e]2# $Id$
[0170229]3
4###################################
5### FUNCTIONS ###
6###################################
7
8
9
10#----------------------------#
[fcaf131]11host_prep_Makefiles() { # Initialization of the system
[0170229]12#----------------------------#
[3b63c8c]13 local CLFS_HOST
[0170229]14
15 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
16
17 # defined here, only for ease of reading
[3b63c8c]18 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
[0170229]19(
20cat << EOF
21023-creatingtoolsdir:
22 @\$(call echo_message, Building)
[9199a13]23 @mkdir \$(MOUNT_PT)/tools && \\
24 rm -f /tools && \\
25 ln -s \$(MOUNT_PT)/tools /
[0170229]26 @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
27 mkdir \$(MOUNT_PT)/sources; \\
28 fi;
29 @chmod a+wt \$(MOUNT_PT)/sources && \\
[9199a13]30 touch \$@ && \\
31 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
32 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]33
34024-creatingcrossdir: 023-creatingtoolsdir
35 @mkdir -v \$(MOUNT_PT)/cross-tools && \\
[9199a13]36 rm -f /cross-tools && \\
37 ln -s \$(MOUNT_PT)/cross-tools /
38 @touch \$@ && \\
39 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
40 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]41
42025-addinguser: 024-creatingcrossdir
43 @\$(call echo_message, Building)
[3b63c8c]44 @if [ ! -d /home/clfs ]; then \\
45 groupadd clfs; \\
46 useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
[0170229]47 else \\
[3b63c8c]48 touch user-clfs-exist; \\
[0170229]49 fi;
[3b63c8c]50 @chown clfs \$(MOUNT_PT) && \\
51 chown clfs \$(MOUNT_PT)/tools && \\
52 chown clfs \$(MOUNT_PT)/cross-tools && \\
53 chown clfs \$(MOUNT_PT)/sources && \\
[9199a13]54 touch \$@ && \\
55 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
56 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]57
58026-settingenvironment: 025-addinguser
59 @\$(call echo_message, Building)
[3b63c8c]60 @if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
61 mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
[0170229]62 fi;
[3b63c8c]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; \\
[0170229]65 fi;
[3b63c8c]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 && \\
[0170229]81 touch envars && \\
[9199a13]82 touch \$@ && \\
83 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
84 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]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@@' \
[3b63c8c]120 -e 's@-64@@' \
[0170229]121 -e 's@-n32@@'`
[3b63c8c]122 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]130 wrt_target "${this_script}" "$PREV"
[0170229]131 #
[3b63c8c]132 # If $pkg_tarball isn't empty, we've got a package...
[0170229]133 #
[3b63c8c]134 [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
[0170229]135 #
[3b63c8c]136 wrt_run_as_clfs_su "${this_script}" "${file}"
[0170229]137 #
[3b63c8c]138 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]139 #
140 # Include a touch of the target name so make can check if it's already been made.
[9199a13]141 wrt_touch
[0170229]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`
[3b63c8c]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
170
[0170229]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 #
[3b63c8c]180 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]188 wrt_target "${this_script}" "$PREV"
[0170229]189 #
[3b63c8c]190 # If $pkg_tarball isn't empty, we've got a package...
[0170229]191 # Insert instructions for unpacking the package and to set the PKGDIR variable.
192 #
[3b63c8c]193 [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
194 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]195 #
[3b63c8c]196 wrt_run_as_clfs_su "${this_script}" "${file}"
[0170229]197 #
[3b63c8c]198 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]199 #
200 # Include a touch of the target name so make can check if it's already been made.
[9199a13]201 wrt_touch
[0170229]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
[6d3564b]224 *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
[0170229]225 *whatnext*) continue ;;
[0271c0c]226 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]227 [[ -z $CONFIG ]] && continue
[0271c0c]228 # Copy the config file to /sources with a standardized name
[6eef5ef]229 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
[0170229]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
[6d3564b]239 *kernel) name=linux ;;
[fcaf131]240 *bootscripts) name="bootscripts-cross-lfs" ;;
[9dc8222]241 *udev-rules) name="udev-cross-lfs" ;;
[6d3564b]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 ;;
[0170229]249 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
250 esac
[3b63c8c]251 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
252 pkg_tarball=$(get_package_tarball_name $name)
[0170229]253
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.
[3e1c0e2]260 wrt_target "${this_script}" "$PREV"
[0170229]261 #
[3b63c8c]262 # If $pkg_tarball isn't empty, we've got a package...
[0170229]263 # Insert instructions for unpacking the package and changing directories
264 #
[3b63c8c]265 [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
266 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]267 #
268 # Select a script execution method
269 case $this_script in
[3b63c8c]270 *changingowner*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
271 *devices*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
[0170229]272 *fstab*) if [[ -n "$FSTAB" ]]; then
273 wrt_copy_fstab "${this_script}"
274 else
[3b63c8c]275 wrt_run_as_clfs_su "${this_script}" "${file}"
[0170229]276 fi
277 ;;
[3b63c8c]278 *) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
[0170229]279 esac
280 #
281 # Housekeeping...remove any build directory(ies) except if the package build fails.
[3b63c8c]282 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]283 #
284 # Include a touch of the target name so make can check if it's already been made.
[9199a13]285 wrt_touch
[0170229]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.
[fd5cb46]308 case $this_script in
309 *chroot*) continue ;;
310 esac
[0170229]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\}-@@'`
[3b63c8c]319
320 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]328 wrt_target "${this_script}" "$PREV"
[0170229]329 #
[3b63c8c]330 # If $pkg_tarball isn't empty, we've got a package...
[0170229]331 # Insert instructions for unpacking the package and changing directories
332 #
[3b63c8c]333 if [ "$pkg_tarball" != "" ] ; then
[0170229]334 case $this_script in
[3b63c8c]335 *util-linux) wrt_unpack_clfs "$pkg_tarball" ;;
336 *) wrt_unpack2 "$pkg_tarball" ;;
[0170229]337 esac
[c205656]338 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]339 fi
340 #
341 # Select a script execution method
342 case $this_script in
[3b63c8c]343 *kernfs) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
344 *util-linux) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
345 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
[0170229]346 esac
347 #
348 # Housekeeping...remove the build directory(ies), except if the package build fails.
[3b63c8c]349 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]350 #
351 # Include a touch of the target name so make can check if it's already been made.
[9199a13]352 wrt_touch
[0170229]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#-----------------------------#
[afd0232]368 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
[0170229]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
[3b63c8c]385 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]393 wrt_target "${this_script}" "$PREV"
[0170229]394 #
[3b63c8c]395 wrt_unpack2 "$pkg_tarball"
[c205656]396 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]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.
[9199a13]403 wrt_touch
[0170229]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#--------------------------------#
[afd0232]419 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
[0170229]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
[39d4d5c]427 PREV=
[0170229]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
[3b63c8c]437 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]445 wrt_target_boot "${this_script}" "$PREV"
[0170229]446 #
[3b63c8c]447 wrt_unpack3 "$pkg_tarball"
[c205656]448 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]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.
[9199a13]455 wrt_touch
[0170229]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#-----------------------------#
[b12abe1]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}"
[0170229]493
[b12abe1]494 for file in final-system$N/* ; do
[0170229]495 # Keep the script file name
496 this_script=`basename $file`
497
[b12abe1]498 # Test if the stripping phase must be skipped.
499 # Skip alsp temp-perl for iterative runs
[fd5cb46]500 case $this_script in
[b12abe1]501 *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
502 *temp-perl*) [[ -n "$N" ]] && continue ;;
[fd5cb46]503 esac
[3fcd63e]504
[0170229]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
[b12abe1]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
[3b63c8c]516 pkg_tarball=$(get_package_tarball_name $name)
[0170229]517
[3b63c8c]518 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[b12abe1]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
[0170229]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.
[b12abe1]539 wrt_target "${this_script}${N}" "$PREV"
[0170229]540
[3b63c8c]541 # If $pkg_tarball isn't empty, we've got a package...
542 if [ "$pkg_tarball" != "" ] ; then
543 wrt_unpack2 "$pkg_tarball"
[e35e794]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
[c205656]554 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]555 fi
556 #
557 wrt_run_as_chroot1 "${this_script}" "${file}"
558 #
[3b63c8c]559 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]560 #
561 # Include a touch of the target name so make can check if it's already been made.
[9199a13]562 wrt_touch
[0170229]563 #
564 #--------------------------------------------------------------------#
565 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
566 #--------------------------------------------------------------------#
567 #
568 # Keep the script file name for Makefile dependencies.
[b12abe1]569 PREV=${this_script}${N}
570 # Set system_build envar for iteration targets
571 system_build=$basicsystem
[0170229]572 done # for file in final-system/* ...
573}
574
575
576#-----------------------------#
577bm_final_system_Makefiles() { #
578#-----------------------------#
[b12abe1]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
[0170229]601
[b12abe1]602 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
[39d4d5c]603
[b12abe1]604 for file in final-system$N/* ; do
[0170229]605 # Keep the script file name
606 this_script=`basename $file`
607
[3fcd63e]608 # Test if the stripping phase must be skipped
[b12abe1]609 # Skip alsp temp-perl for iterative runs
[64cc345]610 case $this_script in
[b12abe1]611 *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
612 *temp-perl*) [[ -n "$N" ]] && continue ;;
[fd5cb46]613 esac
[0170229]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
[b12abe1]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
[0170229]626
[3b63c8c]627 pkg_tarball=$(get_package_tarball_name $name)
628
629 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
[b12abe1]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
[0170229]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.
[3b63c8c]650 wrt_target_boot "${this_script}${N}" "$PREV"
[0170229]651
[3b63c8c]652 # If $pkg_tarball isn't empty, we've got a package...
653 if [ "$pkg_tarball" != "" ] ; then
654 FILE="$pkg_tarball"
[b12abe1]655 wrt_unpack3 "$FILE"
[e35e794]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
[c205656]666 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
[0170229]667 fi
668 #
669 wrt_run_as_root2 "${this_script}" "${file}"
670 #
[3b63c8c]671 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]672 #
673 # Include a touch of the target name so make can check if it's already been made.
[9199a13]674 wrt_touch
[0170229]675 #
676 #--------------------------------------------------------------------#
677 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
678 #--------------------------------------------------------------------#
679 #
680 # Keep the script file name for Makefile dependencies.
[b12abe1]681 PREV=${this_script}${N}
682 # Set system_build envar for iteration targets
683 system_build=$basicsystem
[0170229]684 done # for file in final-system/* ...
685}
686
687
688#-----------------------------#
689bootscripts_Makefiles() { #
690#-----------------------------#
[afd0232]691 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
[0170229]692
693 for file in bootscripts/* ; do
694 # Keep the script file name
695 this_script=`basename $file`
696
697 case $this_script in
[eba62c0]698 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
[0170229]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@@'`
[fd5cb46]713 case $name in
[eba62c0]714 *bootscripts*) name=bootscripts-cross-lfs ;;
715 *udev-rules) name=udev-cross-lfs ;;
[fd5cb46]716 esac
[3b63c8c]717
718 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]726 wrt_target "${this_script}" "$PREV"
[0170229]727 #
[3b63c8c]728 # If $pkg_tarball isn't empty, we've got a package...
[0170229]729 #
[3b63c8c]730 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[0170229]731 #
732 wrt_run_as_chroot1 "${this_script}" "${file}"
733 #
[3b63c8c]734 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]735 #
736 # Include a touch of the target name so make can check if it's already been made.
[9199a13]737 wrt_touch
[0170229]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#-----------------------------#
[afd0232]753 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
[0170229]754
755 for file in bootscripts/* ; do
756 # Keep the script file name
757 this_script=`basename $file`
758
759 case $this_script in
760 *udev*) continue ;; # This is not a script but a commentary
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@@'`
[fd5cb46]775 case $name in
776 *bootscripts*) name=bootscripts-cross-lfs
777 ;;
778 esac
[3b63c8c]779
780 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]788 wrt_target_boot "${this_script}" "$PREV"
[0170229]789 #
[3b63c8c]790 # If $pkg_tarball isn't empty, we've got a package...
[0170229]791 #
[3b63c8c]792 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[0170229]793 #
794 wrt_run_as_root2 "${this_script}" "${file}"
795 #
[3b63c8c]796 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]797 #
798 # Include a touch of the target name so make can check if it's already been made.
[9199a13]799 wrt_touch
[0170229]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#-----------------------------#
[afd0232]817 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
[0170229]818
[7f38b6d]819 for file in {bootable,the-end}/* ; do
[0170229]820 # Keep the script file name
821 this_script=`basename $file`
822
823 # A little housekeeping on the scripts
824 case $this_script in
[7f38b6d]825 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[87b93b4]826 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]827 [[ -z $CONFIG ]] && continue
[0271c0c]828 # Copy the config file to /sources with a standardized name
[1917cad]829 cp $CONFIG $BUILDDIR/sources/kernel-config
[87b93b4]830 ;;
[0170229]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@@' `
[fd5cb46]839 case $this_script in
840 *kernel*) name=linux
841 ;;
842 esac
[3b63c8c]843
844 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3e1c0e2]852 wrt_target "${this_script}" "$PREV"
[0170229]853 #
[3b63c8c]854 # If $pkg_tarball isn't empty, we've got a package...
[0170229]855 # Insert instructions for unpacking the package and changing directories
856 #
[3b63c8c]857 [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
[0170229]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
[fcaf131]864 wrt_run_as_chroot1 "${this_script}" "${file}"
[0170229]865 fi
866 ;;
[fcaf131]867 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
[0170229]868 esac
869 #
870 # Housekeeping...remove any build directory(ies) except if the package build fails.
[3b63c8c]871 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
[0170229]872 #
873 # Include a touch of the target name so make can check if it's already been made.
[9199a13]874 wrt_touch
[0170229]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
[9e4b9a1]885 # Add SBU-disk_usage report target if required
886 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
887
[0170229]888}
889
890
891
892#-----------------------------#
893bm_bootable_Makefiles() { #
894#-----------------------------#
[afd0232]895 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
[0170229]896
[7f38b6d]897 for file in {bootable,the-end}/* ; do
[0170229]898 # Keep the script file name
899 this_script=`basename $file`
900
901 # A little housekeeping on the scripts
902 case $this_script in
[7f38b6d]903 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
[b83baf6]904 *kernel) # if there is no kernel config file do not build the kernel
[4845f38]905 [[ -z $CONFIG ]] && continue
[0271c0c]906 # Copy the named config file to /sources with a standardized name
[62033d2]907 cp $CONFIG $BUILDDIR/sources/kernel-config
[0170229]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
[3b63c8c]917 *kernel) name=linux ;;
[0170229]918 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
919 esac
920
[3b63c8c]921 pkg_tarball=$(get_package_tarball_name $name)
[0170229]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.
[3b63c8c]929 wrt_target_boot "${this_script}" "$PREV"
[0170229]930 #
[3b63c8c]931 # If $pkg_tarball isn't empty, we've got a package...
[0170229]932 # Insert instructions for unpacking the package and changing directories
933 #
[3b63c8c]934 [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
[0170229]935 #
936 # Select a script execution method
937 case $this_script in
938 *fstab*) if [[ -n "$FSTAB" ]]; then
[a9490ab]939 # Minimal boot mode has no access to original file, store in /sources
940 cp $FSTAB $BUILDDIR/sources/fstab
[0170229]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.
[3b63c8c]950 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
[0170229]951 #
952 # Include a touch of the target name so make can check if it's already been made.
[9199a13]953 wrt_touch
[0170229]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
[9e4b9a1]964 # Add SBU-disk_usage report target if required
965 if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
966
[0170229]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
[d43a271]980 cross_tools_Makefiles # $cross_tools
981 temptools_Makefiles # $temptools
[afd0232]982 if [[ $METHOD = "chroot" ]]; then
[d43a271]983 chroot_Makefiles # $chroottools
[fa06e8e]984 if [[ ! $TEST = "0" ]]; then
[d43a271]985 testsuite_tools_Makefiles # $testsuitetools
[0170229]986 fi
[d43a271]987 final_system_Makefiles # $basicsystem
[b12abe1]988 # Add the iterations targets, if needed
989 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[d43a271]990 bootscripts_Makefiles # $bootscripttools
991 bootable_Makefiles # $bootabletools
[0170229]992 else
[d43a271]993 boot_Makefiles # $boottools
[fa06e8e]994 if [[ ! $TEST = "0" ]]; then
[d43a271]995 bm_testsuite_tools_Makefiles # $testsuitetools
[0170229]996 fi
[d43a271]997 bm_final_system_Makefiles # $basicsystem
[b12abe1]998 # Add the iterations targets, if needed
999 [[ "$COMPARE" != "0" ]] && wrt_compare_targets
[d43a271]1000 bm_bootscripts_Makefiles # $bootscipttools
1001 bm_bootable_Makefiles # $bootabletoosl
[0170229]1002 fi
[39d4d5c]1003# the_end_Makefiles
[0170229]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
[460ea63]1014PKG_LST= $PKG_LST
[0170229]1015
1016include makefile-functions
1017
1018EOF
1019) > $MKFILE
1020
1021 # Add chroot commands
[e676ffa]1022 if [ "$METHOD" = "chroot" ] ; then
1023 chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
[0170229]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|' \
[3b63c8c]1030 -e 's|"$$CLFS"|$(MOUNT_PT)|'\
[0170229]1031 -e 's|set -e||'`
[e676ffa]1032 echo -e "CHROOT1= $chroot\n" >> $MKFILE
1033 fi
[0170229]1034
1035 # Drop in the main target 'all:' and the chapter targets with each sub-target
1036 # as a dependency.
[39d4d5c]1037if [[ "${METHOD}" = "chroot" ]]; then
[0170229]1038(
1039 cat << EOF
[3a27393]1040all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 do-housekeeping
[0170229]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
[d43a271]1049chapter5: chapter4 $chroottools $testsuitetools
[0170229]1050
1051chapter6: chapter5 $basicsystem
1052
1053chapter7: chapter6 $bootscripttools
1054
1055chapter8: chapter7 $bootabletools
1056
1057clean-all: clean
[db187c74]1058 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[0170229]1059
1060clean: clean-chapter4 clean-chapter3 clean-chapter2
1061
[3b63c8c]1062restart:
1063 @echo "This feature does not exist for the CLFS makefile. (yet)"
1064
[0170229]1065clean-chapter2:
[3b63c8c]1066 -if [ ! -f user-clfs-exist ]; then \\
1067 userdel clfs; \\
1068 rm -rf /home/clfs; \\
[0170229]1069 fi;
1070 rm -rf \$(MOUNT_PT)/tools
1071 rm -f /tools
1072 rm -rf \$(MOUNT_PT)/cross-tools
1073 rm -f /cross-tools
[3b63c8c]1074 rm -f envars user-clfs-exist
[0170229]1075 rm -f 02* logs/02*.log
1076
1077clean-chapter3:
1078 rm -rf \$(MOUNT_PT)/tools/*
[3b63c8c]1079 rm -f $cross_tools restore-clfs-env sources-dir
[0170229]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
[3b63c8c]1093restore-clfs-env:
[0170229]1094 @\$(call echo_message, Building)
[3b63c8c]1095 @if [ -f /home/clfs/.bashrc.XXX ]; then \\
1096 mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
[0170229]1097 fi;
[3b63c8c]1098 @if [ -f /home/clfs/.bash_profile.XXX ]; then \\
1099 mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
[0170229]1100 fi;
[3b63c8c]1101 @chown clfs:clfs /home/clfs/.bash* && \\
[9199a13]1102 touch \$@ && \\
1103 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1104 echo --------------------------------------------------------------------------------\$(WHITE)
[0170229]1105
[3a27393]1106do-housekeeping:
[9199a13]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
[3b63c8c]1112 @-if [ ! -f user-clfs-exist ]; then \\
1113 userdel clfs; \\
1114 rm -rf /home/clfs; \\
[3a27393]1115 fi;
1116
[0170229]1117EOF
1118) >> $MKFILE
[39d4d5c]1119fi
1120
1121
1122if [[ "${METHOD}" = "boot" ]]; then
1123(
1124 cat << EOF
[64cc345]1125
[3e1c0e2]1126all: makeboot
[39d4d5c]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
[d43a271]1135makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
[39d4d5c]1136 @\$(call echo_finished,$VERSION)
1137
1138
1139clean-all: clean
[db187c74]1140 rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
[39d4d5c]1141
1142clean: clean-makesys clean-makeboot clean-jhalfs
1143
[3b63c8c]1144restart:
1145 @echo "This feature does not exist for the CLFS makefile. (yet)"
1146
[39d4d5c]1147clean-jhalfs:
[3b63c8c]1148 -if [ ! -f user-clfs-exist ]; then \\
1149 userdel clfs; \\
1150 rm -rf /home/clfs; \\
[39d4d5c]1151 fi;
1152 rm -rf \$(MOUNT_PT)/tools
1153 rm -f /tools
1154 rm -rf \$(MOUNT_PT)/cross-tools
1155 rm -f /cross-tools
[3b63c8c]1156 rm -f envars user-clfs-exist
[39d4d5c]1157 rm -f 02* logs/02*.log
[0170229]1158
[39d4d5c]1159clean-makeboot:
1160 rm -rf /tools/*
[64cc345]1161 rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
[3b63c8c]1162 rm -f restore-clfs-env sources-dir
[39d4d5c]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
[3b63c8c]1178restore-clfs-env:
[39d4d5c]1179 @\$(call echo_message, Building)
[3b63c8c]1180 @if [ -f /home/clfs/.bashrc.XXX ]; then \\
1181 mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
[39d4d5c]1182 fi;
[3b63c8c]1183 @if [ -f /home/clfs/.bash_profile.XXX ]; then \\
1184 mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
[39d4d5c]1185 fi;
[3b63c8c]1186 @chown clfs:clfs /home/clfs/.bash* && \\
[9199a13]1187 touch \$@ && \\
1188 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1189 echo --------------------------------------------------------------------------------\$(WHITE)
[39d4d5c]1190
[3a27393]1191
[39d4d5c]1192EOF
1193) >> $MKFILE
1194fi
[0170229]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.