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 | # This will force the Makefile to exit and not allow it to be restarted with
|
---|
287 | # the command <make>, The user will have to issue the cmd <make chapterXX>
|
---|
288 | echo -e "\t@\$(call echo_boot_finished,$VERSION) && \\" >> $MKFILE.tmp
|
---|
289 | echo -e "\tfalse" >> $MKFILE.tmp
|
---|
290 | }
|
---|
291 |
|
---|
292 |
|
---|
293 | #-----------------------------#
|
---|
294 | chroot_Makefiles() { #
|
---|
295 | #-----------------------------#
|
---|
296 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
297 |
|
---|
298 | for file in chroot/* ; do
|
---|
299 | # Keep the script file name
|
---|
300 | this_script=`basename $file`
|
---|
301 | #
|
---|
302 | # Skipping scripts is done now and not included in the build tree.
|
---|
303 | case $this_script in
|
---|
304 | *chroot*) continue ;;
|
---|
305 | esac
|
---|
306 |
|
---|
307 | #
|
---|
308 | # First append each name of the script files to a list (this will become
|
---|
309 | # the names of the targets in the Makefile
|
---|
310 | chroottools="$chroottools $this_script"
|
---|
311 |
|
---|
312 | # Grab the name of the target, strip id number, XXX-script
|
---|
313 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
314 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
315 |
|
---|
316 | #--------------------------------------------------------------------#
|
---|
317 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
318 | #--------------------------------------------------------------------#
|
---|
319 | #
|
---|
320 | # Drop in the name of the target on a new line, and the previous target
|
---|
321 | # as a dependency. Also call the echo_message function.
|
---|
322 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
323 | #
|
---|
324 | # If $vrs isn't empty, we've got a package...
|
---|
325 | # Insert instructions for unpacking the package and changing directories
|
---|
326 | #
|
---|
327 | if [ "$vrs" != "" ] ; then
|
---|
328 | case $this_script in
|
---|
329 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
330 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
331 | ;;
|
---|
332 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
333 | ;;
|
---|
334 | esac
|
---|
335 | fi
|
---|
336 | #
|
---|
337 | # Select a script execution method
|
---|
338 | case $this_script in
|
---|
339 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
340 | *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
341 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
342 | esac
|
---|
343 | #
|
---|
344 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
345 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
346 | #
|
---|
347 | # Include a touch of the target name so make can check if it's already been made.
|
---|
348 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
349 | #
|
---|
350 | #--------------------------------------------------------------------#
|
---|
351 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
352 | #--------------------------------------------------------------------#
|
---|
353 | #
|
---|
354 | # Keep the script file name for Makefile dependencies.
|
---|
355 | PREV=$this_script
|
---|
356 |
|
---|
357 | done # for file in...
|
---|
358 | }
|
---|
359 |
|
---|
360 |
|
---|
361 | #-----------------------------#
|
---|
362 | testsuite_tools_Makefiles() { #
|
---|
363 | #-----------------------------#
|
---|
364 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
365 |
|
---|
366 | for file in testsuite-tools/* ; do
|
---|
367 | # Keep the script file name
|
---|
368 | this_script=`basename $file`
|
---|
369 |
|
---|
370 | # First append each name of the script files to a list (this will become
|
---|
371 | # the names of the targets in the Makefile
|
---|
372 | testsuitetools="$testsuitetools $this_script"
|
---|
373 |
|
---|
374 | # Grab the name of the target, strip id number, XXX-script
|
---|
375 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
376 | -e 's@-64bit@@' \
|
---|
377 | -e 's@-64@@' \
|
---|
378 | -e 's@64@@' \
|
---|
379 | -e 's@n32@@'`
|
---|
380 |
|
---|
381 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
382 |
|
---|
383 | #--------------------------------------------------------------------#
|
---|
384 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
385 | #--------------------------------------------------------------------#
|
---|
386 | #
|
---|
387 | # Drop in the name of the target on a new line, and the previous target
|
---|
388 | # as a dependency. Also call the echo_message function.
|
---|
389 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
390 | #
|
---|
391 | case $name in
|
---|
392 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
393 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
394 | esac
|
---|
395 | #
|
---|
396 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
397 | #
|
---|
398 | wrt_remove_build_dirs "${name}"
|
---|
399 | #
|
---|
400 | # Include a touch of the target name so make can check if it's already been made.
|
---|
401 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
402 | #
|
---|
403 | #--------------------------------------------------------------------#
|
---|
404 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
405 | #--------------------------------------------------------------------#
|
---|
406 | #
|
---|
407 | # Keep the script file name for Makefile dependencies.
|
---|
408 | PREV=$this_script
|
---|
409 |
|
---|
410 | done
|
---|
411 | }
|
---|
412 |
|
---|
413 |
|
---|
414 | #--------------------------------#
|
---|
415 | bm_testsuite_tools_Makefiles() { #
|
---|
416 | #--------------------------------#
|
---|
417 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
418 |
|
---|
419 | for file in testsuite-tools/* ; do
|
---|
420 | # Keep the script file name
|
---|
421 | this_script=`basename $file`
|
---|
422 |
|
---|
423 | # First append each name of the script files to a list (this will become
|
---|
424 | # the names of the targets in the Makefile
|
---|
425 | testsuitetools="$testsuitetools $this_script"
|
---|
426 |
|
---|
427 | # Grab the name of the target, strip id number, XXX-script
|
---|
428 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
429 | -e 's@-64bit@@' \
|
---|
430 | -e 's@-64@@' \
|
---|
431 | -e 's@64@@' \
|
---|
432 | -e 's@n32@@'`
|
---|
433 |
|
---|
434 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
435 |
|
---|
436 | #--------------------------------------------------------------------#
|
---|
437 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
438 | #--------------------------------------------------------------------#
|
---|
439 | #
|
---|
440 | # Drop in the name of the target on a new line, and the previous target
|
---|
441 | # as a dependency. Also call the echo_message function.
|
---|
442 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
443 | #
|
---|
444 | case $name in
|
---|
445 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
446 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
447 | esac
|
---|
448 | #
|
---|
449 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
450 | #
|
---|
451 | wrt_remove_build_dirs2 "${name}"
|
---|
452 | #
|
---|
453 | # Include a touch of the target name so make can check if it's already been made.
|
---|
454 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
455 | #
|
---|
456 | #--------------------------------------------------------------------#
|
---|
457 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
458 | #--------------------------------------------------------------------#
|
---|
459 | #
|
---|
460 | # Keep the script file name for Makefile dependencies.
|
---|
461 | PREV=$this_script
|
---|
462 |
|
---|
463 | done
|
---|
464 | }
|
---|
465 |
|
---|
466 |
|
---|
467 | #-----------------------------#
|
---|
468 | final_system_Makefiles() { #
|
---|
469 | #-----------------------------#
|
---|
470 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
|
---|
471 |
|
---|
472 | for file in final-system/* ; do
|
---|
473 | # Keep the script file name
|
---|
474 | this_script=`basename $file`
|
---|
475 |
|
---|
476 | # Test if the stripping phase must be skipped
|
---|
477 | case $this_script in
|
---|
478 | *stripping*) [[ "$STRIP" = "0" ]] && continue
|
---|
479 | ;;
|
---|
480 | esac
|
---|
481 |
|
---|
482 | # First append each name of the script files to a list (this will become
|
---|
483 | # the names of the targets in the Makefile
|
---|
484 | basicsystem="$basicsystem $this_script"
|
---|
485 |
|
---|
486 | # Grab the name of the target, strip id number, XXX-script
|
---|
487 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
488 | -e 's@temp-@@' \
|
---|
489 | -e 's@-64bit@@' \
|
---|
490 | -e 's@-64@@' \
|
---|
491 | -e 's@64@@' \
|
---|
492 | -e 's@n32@@'`
|
---|
493 |
|
---|
494 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
495 |
|
---|
496 | #--------------------------------------------------------------------#
|
---|
497 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
498 | #--------------------------------------------------------------------#
|
---|
499 | #
|
---|
500 | # Drop in the name of the target on a new line, and the previous target
|
---|
501 | # as a dependency. Also call the echo_message function.
|
---|
502 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
503 |
|
---|
504 | # If $vrs isn't empty, we've got a package...
|
---|
505 | if [ "$vrs" != "" ] ; then
|
---|
506 | case $name in
|
---|
507 | temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
|
---|
508 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
509 | esac
|
---|
510 | fi
|
---|
511 | #
|
---|
512 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
513 | #
|
---|
514 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
515 | #
|
---|
516 | # Include a touch of the target name so make can check if it's already been made.
|
---|
517 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
518 | #
|
---|
519 | #--------------------------------------------------------------------#
|
---|
520 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
521 | #--------------------------------------------------------------------#
|
---|
522 | #
|
---|
523 | # Keep the script file name for Makefile dependencies.
|
---|
524 | PREV=$this_script
|
---|
525 |
|
---|
526 | done # for file in final-system/* ...
|
---|
527 | }
|
---|
528 |
|
---|
529 |
|
---|
530 | #-----------------------------#
|
---|
531 | bm_final_system_Makefiles() { #
|
---|
532 | #-----------------------------#
|
---|
533 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
|
---|
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
|
---|
886 | temptools_Makefiles
|
---|
887 | if [[ $METHOD = "chroot" ]]; then
|
---|
888 | chroot_Makefiles
|
---|
889 | if [[ ! $TEST = "0" ]]; then
|
---|
890 | testsuite_tools_Makefiles
|
---|
891 | fi
|
---|
892 | final_system_Makefiles
|
---|
893 | bootscripts_Makefiles
|
---|
894 | bootable_Makefiles
|
---|
895 | else
|
---|
896 | boot_Makefiles # This phase must die at the end of its run..
|
---|
897 | if [[ ! $TEST = "0" ]]; then
|
---|
898 | bm_testsuite_tools_Makefiles
|
---|
899 | fi
|
---|
900 | bm_final_system_Makefiles
|
---|
901 | bm_bootscripts_Makefiles
|
---|
902 | bm_bootable_Makefiles
|
---|
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 | (
|
---|
938 | cat << EOF
|
---|
939 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
940 | @\$(call echo_finished,$VERSION)
|
---|
941 |
|
---|
942 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
943 |
|
---|
944 | chapter3: chapter2 $cross_tools
|
---|
945 |
|
---|
946 | chapter4: chapter3 $temptools
|
---|
947 |
|
---|
948 | chapter5: chapter4 $chroottools $boottools
|
---|
949 |
|
---|
950 | chapter6: chapter5 $basicsystem
|
---|
951 |
|
---|
952 | chapter7: chapter6 $bootscripttools
|
---|
953 |
|
---|
954 | chapter8: chapter7 $bootabletools
|
---|
955 |
|
---|
956 | clean-all: clean
|
---|
957 | rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
|
---|
958 |
|
---|
959 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
960 |
|
---|
961 | clean-chapter2:
|
---|
962 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
963 | userdel lfs; \\
|
---|
964 | rm -rf /home/lfs; \\
|
---|
965 | fi;
|
---|
966 | rm -rf \$(MOUNT_PT)/tools
|
---|
967 | rm -f /tools
|
---|
968 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
969 | rm -f /cross-tools
|
---|
970 | rm -f envars user-lfs-exist
|
---|
971 | rm -f 02* logs/02*.log
|
---|
972 |
|
---|
973 | clean-chapter3:
|
---|
974 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
975 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
976 | cd logs && rm -f $cross_tools && cd ..
|
---|
977 |
|
---|
978 | clean-chapter4:
|
---|
979 | -umount \$(MOUNT_PT)/sys
|
---|
980 | -umount \$(MOUNT_PT)/proc
|
---|
981 | -umount \$(MOUNT_PT)/dev/shm
|
---|
982 | -umount \$(MOUNT_PT)/dev/pts
|
---|
983 | -umount \$(MOUNT_PT)/dev
|
---|
984 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
985 | rm -f $temptools
|
---|
986 | cd logs && rm -f $temptools && cd ..
|
---|
987 |
|
---|
988 |
|
---|
989 | restore-lfs-env:
|
---|
990 | @\$(call echo_message, Building)
|
---|
991 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
992 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
993 | fi;
|
---|
994 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
995 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
996 | fi;
|
---|
997 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
998 | touch \$@
|
---|
999 |
|
---|
1000 | EOF
|
---|
1001 | ) >> $MKFILE
|
---|
1002 |
|
---|
1003 |
|
---|
1004 | # Bring over the items from the Makefile.tmp
|
---|
1005 | cat $MKFILE.tmp >> $MKFILE
|
---|
1006 | rm $MKFILE.tmp
|
---|
1007 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
1008 |
|
---|
1009 | }
|
---|
1010 |
|
---|