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