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 | echo -e "\t@\$(call echo_boot_finished,$VERSION)" >> $MKFILE.tmp
|
---|
287 | }
|
---|
288 |
|
---|
289 |
|
---|
290 | #-----------------------------#
|
---|
291 | chroot_Makefiles() { #
|
---|
292 | #-----------------------------#
|
---|
293 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
294 |
|
---|
295 | for file in chroot/* ; do
|
---|
296 | # Keep the script file name
|
---|
297 | this_script=`basename $file`
|
---|
298 | #
|
---|
299 | # Skipping scripts is done now and not included in the build tree.
|
---|
300 | case $this_script in
|
---|
301 | *chroot*) continue ;;
|
---|
302 | esac
|
---|
303 |
|
---|
304 | #
|
---|
305 | # First append each name of the script files to a list (this will become
|
---|
306 | # the names of the targets in the Makefile
|
---|
307 | chroottools="$chroottools $this_script"
|
---|
308 |
|
---|
309 | # Grab the name of the target, strip id number, XXX-script
|
---|
310 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
311 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
312 |
|
---|
313 | #--------------------------------------------------------------------#
|
---|
314 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
315 | #--------------------------------------------------------------------#
|
---|
316 | #
|
---|
317 | # Drop in the name of the target on a new line, and the previous target
|
---|
318 | # as a dependency. Also call the echo_message function.
|
---|
319 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
320 | #
|
---|
321 | # If $vrs isn't empty, we've got a package...
|
---|
322 | # Insert instructions for unpacking the package and changing directories
|
---|
323 | #
|
---|
324 | if [ "$vrs" != "" ] ; then
|
---|
325 | case $this_script in
|
---|
326 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
327 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
328 | ;;
|
---|
329 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
330 | ;;
|
---|
331 | esac
|
---|
332 | fi
|
---|
333 | #
|
---|
334 | # Select a script execution method
|
---|
335 | case $this_script in
|
---|
336 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
337 | *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
338 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
339 | esac
|
---|
340 | #
|
---|
341 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
342 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
343 | #
|
---|
344 | # Include a touch of the target name so make can check if it's already been made.
|
---|
345 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
346 | #
|
---|
347 | #--------------------------------------------------------------------#
|
---|
348 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
349 | #--------------------------------------------------------------------#
|
---|
350 | #
|
---|
351 | # Keep the script file name for Makefile dependencies.
|
---|
352 | PREV=$this_script
|
---|
353 |
|
---|
354 | done # for file in...
|
---|
355 | }
|
---|
356 |
|
---|
357 |
|
---|
358 | #-----------------------------#
|
---|
359 | testsuite_tools_Makefiles() { #
|
---|
360 | #-----------------------------#
|
---|
361 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
362 |
|
---|
363 | for file in testsuite-tools/* ; do
|
---|
364 | # Keep the script file name
|
---|
365 | this_script=`basename $file`
|
---|
366 |
|
---|
367 | # First append each name of the script files to a list (this will become
|
---|
368 | # the names of the targets in the Makefile
|
---|
369 | testsuitetools="$testsuitetools $this_script"
|
---|
370 |
|
---|
371 | # Grab the name of the target, strip id number, XXX-script
|
---|
372 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
373 | -e 's@-64bit@@' \
|
---|
374 | -e 's@-64@@' \
|
---|
375 | -e 's@64@@' \
|
---|
376 | -e 's@n32@@'`
|
---|
377 |
|
---|
378 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
379 |
|
---|
380 | #--------------------------------------------------------------------#
|
---|
381 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
382 | #--------------------------------------------------------------------#
|
---|
383 | #
|
---|
384 | # Drop in the name of the target on a new line, and the previous target
|
---|
385 | # as a dependency. Also call the echo_message function.
|
---|
386 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
387 | #
|
---|
388 | case $name in
|
---|
389 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
390 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
391 | esac
|
---|
392 | #
|
---|
393 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
394 | #
|
---|
395 | wrt_remove_build_dirs "${name}"
|
---|
396 | #
|
---|
397 | # Include a touch of the target name so make can check if it's already been made.
|
---|
398 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
399 | #
|
---|
400 | #--------------------------------------------------------------------#
|
---|
401 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
402 | #--------------------------------------------------------------------#
|
---|
403 | #
|
---|
404 | # Keep the script file name for Makefile dependencies.
|
---|
405 | PREV=$this_script
|
---|
406 |
|
---|
407 | done
|
---|
408 | }
|
---|
409 |
|
---|
410 |
|
---|
411 | #--------------------------------#
|
---|
412 | bm_testsuite_tools_Makefiles() { #
|
---|
413 | #--------------------------------#
|
---|
414 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
415 |
|
---|
416 | for file in testsuite-tools/* ; do
|
---|
417 | # Keep the script file name
|
---|
418 | this_script=`basename $file`
|
---|
419 |
|
---|
420 | # First append each name of the script files to a list (this will become
|
---|
421 | # the names of the targets in the Makefile
|
---|
422 | PREV=
|
---|
423 | testsuitetools="$testsuitetools $this_script"
|
---|
424 |
|
---|
425 | # Grab the name of the target, strip id number, XXX-script
|
---|
426 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
427 | -e 's@-64bit@@' \
|
---|
428 | -e 's@-64@@' \
|
---|
429 | -e 's@64@@' \
|
---|
430 | -e 's@n32@@'`
|
---|
431 |
|
---|
432 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
433 |
|
---|
434 | #--------------------------------------------------------------------#
|
---|
435 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
436 | #--------------------------------------------------------------------#
|
---|
437 | #
|
---|
438 | # Drop in the name of the target on a new line, and the previous target
|
---|
439 | # as a dependency. Also call the echo_message function.
|
---|
440 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
441 | #
|
---|
442 | case $name in
|
---|
443 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
444 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
445 | esac
|
---|
446 | #
|
---|
447 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
448 | #
|
---|
449 | wrt_remove_build_dirs2 "${name}"
|
---|
450 | #
|
---|
451 | # Include a touch of the target name so make can check if it's already been made.
|
---|
452 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
453 | #
|
---|
454 | #--------------------------------------------------------------------#
|
---|
455 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
456 | #--------------------------------------------------------------------#
|
---|
457 | #
|
---|
458 | # Keep the script file name for Makefile dependencies.
|
---|
459 | PREV=$this_script
|
---|
460 |
|
---|
461 | done
|
---|
462 | }
|
---|
463 |
|
---|
464 |
|
---|
465 | #-----------------------------#
|
---|
466 | final_system_Makefiles() { #
|
---|
467 | #-----------------------------#
|
---|
468 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
|
---|
469 |
|
---|
470 | for file in final-system/* ; do
|
---|
471 | # Keep the script file name
|
---|
472 | this_script=`basename $file`
|
---|
473 |
|
---|
474 | # Test if the stripping phase must be skipped
|
---|
475 | case $this_script in
|
---|
476 | *stripping*) [[ "$STRIP" = "0" ]] && continue
|
---|
477 | ;;
|
---|
478 | esac
|
---|
479 |
|
---|
480 | # First append each name of the script files to a list (this will become
|
---|
481 | # the names of the targets in the Makefile
|
---|
482 | basicsystem="$basicsystem $this_script"
|
---|
483 |
|
---|
484 | # Grab the name of the target, strip id number, XXX-script
|
---|
485 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
486 | -e 's@temp-@@' \
|
---|
487 | -e 's@-64bit@@' \
|
---|
488 | -e 's@-64@@' \
|
---|
489 | -e 's@64@@' \
|
---|
490 | -e 's@n32@@'`
|
---|
491 |
|
---|
492 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
493 |
|
---|
494 | #--------------------------------------------------------------------#
|
---|
495 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
496 | #--------------------------------------------------------------------#
|
---|
497 | #
|
---|
498 | # Drop in the name of the target on a new line, and the previous target
|
---|
499 | # as a dependency. Also call the echo_message function.
|
---|
500 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
501 |
|
---|
502 | # If $vrs isn't empty, we've got a package...
|
---|
503 | if [ "$vrs" != "" ] ; then
|
---|
504 | case $name in
|
---|
505 | temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
|
---|
506 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
507 | esac
|
---|
508 | fi
|
---|
509 | #
|
---|
510 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
511 | #
|
---|
512 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
513 | #
|
---|
514 | # Include a touch of the target name so make can check if it's already been made.
|
---|
515 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
516 | #
|
---|
517 | #--------------------------------------------------------------------#
|
---|
518 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
519 | #--------------------------------------------------------------------#
|
---|
520 | #
|
---|
521 | # Keep the script file name for Makefile dependencies.
|
---|
522 | PREV=$this_script
|
---|
523 |
|
---|
524 | done # for file in final-system/* ...
|
---|
525 | }
|
---|
526 |
|
---|
527 |
|
---|
528 | #-----------------------------#
|
---|
529 | bm_final_system_Makefiles() { #
|
---|
530 | #-----------------------------#
|
---|
531 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
|
---|
532 |
|
---|
533 | # The makesys phase was initiated in bm_testsuite_tools_makefile
|
---|
534 | [[ "$TEST" = 0 ]] && PREV=""
|
---|
535 |
|
---|
536 | for file in final-system/* ; do
|
---|
537 | # Keep the script file name
|
---|
538 | this_script=`basename $file`
|
---|
539 |
|
---|
540 | # Test if the stripping phase must be skipped
|
---|
541 | case $this_script in
|
---|
542 | *stripping*) [[ "$STRIP" = "0" ]] && continue
|
---|
543 | ;;
|
---|
544 | esac
|
---|
545 |
|
---|
546 | # First append each name of the script files to a list (this will become
|
---|
547 | # the names of the targets in the Makefile
|
---|
548 | basicsystem="$basicsystem $this_script"
|
---|
549 |
|
---|
550 | # Grab the name of the target, strip id number, XXX-script
|
---|
551 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
552 | -e 's@temp-@@' \
|
---|
553 | -e 's@-64bit@@' \
|
---|
554 | -e 's@-64@@' \
|
---|
555 | -e 's@64@@' \
|
---|
556 | -e 's@n32@@'`
|
---|
557 |
|
---|
558 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
559 |
|
---|
560 | #--------------------------------------------------------------------#
|
---|
561 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
562 | #--------------------------------------------------------------------#
|
---|
563 | #
|
---|
564 | # Drop in the name of the target on a new line, and the previous target
|
---|
565 | # as a dependency. Also call the echo_message function.
|
---|
566 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
567 |
|
---|
568 | # If $vrs isn't empty, we've got a package...
|
---|
569 | if [ "$vrs" != "" ] ; then
|
---|
570 | case $name in
|
---|
571 | temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
---|
572 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
573 | esac
|
---|
574 | fi
|
---|
575 | #
|
---|
576 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
577 | #
|
---|
578 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
579 | #
|
---|
580 | # Include a touch of the target name so make can check if it's already been made.
|
---|
581 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
582 | #
|
---|
583 | #--------------------------------------------------------------------#
|
---|
584 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
585 | #--------------------------------------------------------------------#
|
---|
586 | #
|
---|
587 | # Keep the script file name for Makefile dependencies.
|
---|
588 | PREV=$this_script
|
---|
589 |
|
---|
590 | done # for file in final-system/* ...
|
---|
591 | }
|
---|
592 |
|
---|
593 |
|
---|
594 | #-----------------------------#
|
---|
595 | bootscripts_Makefiles() { #
|
---|
596 | #-----------------------------#
|
---|
597 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
|
---|
598 |
|
---|
599 | for file in bootscripts/* ; do
|
---|
600 | # Keep the script file name
|
---|
601 | this_script=`basename $file`
|
---|
602 |
|
---|
603 | case $this_script in
|
---|
604 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
605 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
606 | *) ;;
|
---|
607 | esac
|
---|
608 |
|
---|
609 | # First append each name of the script files to a list (this will become
|
---|
610 | # the names of the targets in the Makefile
|
---|
611 | bootscripttools="$bootscripttools $this_script"
|
---|
612 |
|
---|
613 | # Grab the name of the target, strip id number, XXX-script
|
---|
614 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
615 | -e 's@-64bit@@' \
|
---|
616 | -e 's@-64@@' \
|
---|
617 | -e 's@64@@' \
|
---|
618 | -e 's@n32@@'`
|
---|
619 | case $name in
|
---|
620 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
621 | *udev-rules) name=udev-cross-lfs ;;
|
---|
622 | esac
|
---|
623 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
624 |
|
---|
625 | #--------------------------------------------------------------------#
|
---|
626 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
627 | #--------------------------------------------------------------------#
|
---|
628 | #
|
---|
629 | # Drop in the name of the target on a new line, and the previous target
|
---|
630 | # as a dependency. Also call the echo_message function.
|
---|
631 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
632 | #
|
---|
633 | # If $vrs isn't empty, we've got a package...
|
---|
634 | #
|
---|
635 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
636 | #
|
---|
637 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
638 | #
|
---|
639 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
640 | #
|
---|
641 | # Include a touch of the target name so make can check if it's already been made.
|
---|
642 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
643 | #
|
---|
644 | #--------------------------------------------------------------------#
|
---|
645 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
646 | #--------------------------------------------------------------------#
|
---|
647 | #
|
---|
648 | # Keep the script file name for Makefile dependencies.
|
---|
649 | PREV=$this_script
|
---|
650 |
|
---|
651 | done # for file in bootscripts/* ...
|
---|
652 |
|
---|
653 | }
|
---|
654 |
|
---|
655 | #-----------------------------#
|
---|
656 | bm_bootscripts_Makefiles() { #
|
---|
657 | #-----------------------------#
|
---|
658 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
|
---|
659 |
|
---|
660 | for file in bootscripts/* ; do
|
---|
661 | # Keep the script file name
|
---|
662 | this_script=`basename $file`
|
---|
663 |
|
---|
664 | case $this_script in
|
---|
665 | *udev*) continue ;; # This is not a script but a commentary
|
---|
666 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
667 | *) ;;
|
---|
668 | esac
|
---|
669 |
|
---|
670 | # First append each name of the script files to a list (this will become
|
---|
671 | # the names of the targets in the Makefile
|
---|
672 | bootscripttools="$bootscripttools $this_script"
|
---|
673 |
|
---|
674 | # Grab the name of the target, strip id number, XXX-script
|
---|
675 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
676 | -e 's@-64bit@@' \
|
---|
677 | -e 's@-64@@' \
|
---|
678 | -e 's@64@@' \
|
---|
679 | -e 's@n32@@'`
|
---|
680 | case $name in
|
---|
681 | *bootscripts*) name=bootscripts-cross-lfs
|
---|
682 | ;;
|
---|
683 | esac
|
---|
684 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
685 |
|
---|
686 | #--------------------------------------------------------------------#
|
---|
687 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
688 | #--------------------------------------------------------------------#
|
---|
689 | #
|
---|
690 | # Drop in the name of the target on a new line, and the previous target
|
---|
691 | # as a dependency. Also call the echo_message function.
|
---|
692 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
693 | #
|
---|
694 | # If $vrs isn't empty, we've got a package...
|
---|
695 | #
|
---|
696 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
697 | #
|
---|
698 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
699 | #
|
---|
700 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
701 | #
|
---|
702 | # Include a touch of the target name so make can check if it's already been made.
|
---|
703 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
704 | #
|
---|
705 | #--------------------------------------------------------------------#
|
---|
706 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
707 | #--------------------------------------------------------------------#
|
---|
708 | #
|
---|
709 | # Keep the script file name for Makefile dependencies.
|
---|
710 | PREV=$this_script
|
---|
711 |
|
---|
712 | done # for file in bootscripts/* ...
|
---|
713 |
|
---|
714 | }
|
---|
715 |
|
---|
716 |
|
---|
717 |
|
---|
718 | #-----------------------------#
|
---|
719 | bootable_Makefiles() { #
|
---|
720 | #-----------------------------#
|
---|
721 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
|
---|
722 |
|
---|
723 | for file in bootable/* ; do
|
---|
724 | # Keep the script file name
|
---|
725 | this_script=`basename $file`
|
---|
726 |
|
---|
727 | # A little housekeeping on the scripts
|
---|
728 | case $this_script in
|
---|
729 | *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
|
---|
730 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
731 | [[ -z $CONFIG ]] && continue
|
---|
732 | # Copy the config file to /sources with a standardized name
|
---|
733 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
734 | ;;
|
---|
735 | esac
|
---|
736 | #
|
---|
737 | # First append each name of the script files to a list (this will become
|
---|
738 | # the names of the targets in the Makefile
|
---|
739 | bootabletools="$bootabletools $this_script"
|
---|
740 | #
|
---|
741 | # Grab the name of the target, strip id number and misc words.
|
---|
742 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
743 | case $this_script in
|
---|
744 | *kernel*) name=linux
|
---|
745 | ;;
|
---|
746 | esac
|
---|
747 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
748 |
|
---|
749 | #--------------------------------------------------------------------#
|
---|
750 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
751 | #--------------------------------------------------------------------#
|
---|
752 | #
|
---|
753 | # Drop in the name of the target on a new line, and the previous target
|
---|
754 | # as a dependency. Also call the echo_message function.
|
---|
755 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
756 | #
|
---|
757 | # If $vrs isn't empty, we've got a package...
|
---|
758 | # Insert instructions for unpacking the package and changing directories
|
---|
759 | #
|
---|
760 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
761 | #
|
---|
762 | # Select a script execution method
|
---|
763 | case $this_script in
|
---|
764 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
765 | wrt_copy_fstab "${this_script}"
|
---|
766 | else
|
---|
767 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
768 | fi
|
---|
769 | ;;
|
---|
770 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
771 | esac
|
---|
772 | #
|
---|
773 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
774 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
775 | #
|
---|
776 | # Include a touch of the target name so make can check if it's already been made.
|
---|
777 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
778 | #
|
---|
779 | #--------------------------------------------------------------------#
|
---|
780 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
781 | #--------------------------------------------------------------------#
|
---|
782 | #
|
---|
783 | # Keep the script file name for Makefile dependencies.
|
---|
784 | PREV=$this_script
|
---|
785 |
|
---|
786 | done
|
---|
787 |
|
---|
788 | }
|
---|
789 |
|
---|
790 |
|
---|
791 |
|
---|
792 | #-----------------------------#
|
---|
793 | bm_bootable_Makefiles() { #
|
---|
794 | #-----------------------------#
|
---|
795 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
|
---|
796 |
|
---|
797 | for file in bootable/* ; do
|
---|
798 | # Keep the script file name
|
---|
799 | this_script=`basename $file`
|
---|
800 |
|
---|
801 | # A little housekeeping on the scripts
|
---|
802 | case $this_script in
|
---|
803 | *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
|
---|
804 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
805 | [[ -z $CONFIG ]] && continue
|
---|
806 | # Copy the named config file to /sources with a standardized name
|
---|
807 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
808 | ;;
|
---|
809 | esac
|
---|
810 | #
|
---|
811 | # First append each name of the script files to a list (this will become
|
---|
812 | # the names of the targets in the Makefile
|
---|
813 | bootabletools="$bootabletools $this_script"
|
---|
814 | #
|
---|
815 | # Grab the name of the target, strip id number and misc words.
|
---|
816 | case $this_script in
|
---|
817 | *kernel) name=linux
|
---|
818 | ;;
|
---|
819 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
820 | esac
|
---|
821 |
|
---|
822 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
823 |
|
---|
824 | #--------------------------------------------------------------------#
|
---|
825 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
826 | #--------------------------------------------------------------------#
|
---|
827 | #
|
---|
828 | # Drop in the name of the target on a new line, and the previous target
|
---|
829 | # as a dependency. Also call the echo_message function.
|
---|
830 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
831 | #
|
---|
832 | # If $vrs isn't empty, we've got a package...
|
---|
833 | # Insert instructions for unpacking the package and changing directories
|
---|
834 | #
|
---|
835 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
836 | #
|
---|
837 | # Select a script execution method
|
---|
838 | case $this_script in
|
---|
839 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
840 | # Minimal boot mode has no access to original file, store in /sources
|
---|
841 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
842 | wrt_copy_fstab2 "${this_script}"
|
---|
843 | else
|
---|
844 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
845 | fi
|
---|
846 | ;;
|
---|
847 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
848 | esac
|
---|
849 | #
|
---|
850 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
851 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
852 | #
|
---|
853 | # Include a touch of the target name so make can check if it's already been made.
|
---|
854 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
855 | #
|
---|
856 | #--------------------------------------------------------------------#
|
---|
857 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
858 | #--------------------------------------------------------------------#
|
---|
859 | #
|
---|
860 | # Keep the script file name for Makefile dependencies.
|
---|
861 | PREV=$this_script
|
---|
862 |
|
---|
863 | done
|
---|
864 |
|
---|
865 | }
|
---|
866 |
|
---|
867 |
|
---|
868 |
|
---|
869 | #-----------------------------#
|
---|
870 | the_end_Makefiles() { #
|
---|
871 | #-----------------------------#
|
---|
872 | echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
|
---|
873 | }
|
---|
874 |
|
---|
875 |
|
---|
876 | #-----------------------------#
|
---|
877 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
878 | #-----------------------------#
|
---|
879 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
880 |
|
---|
881 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
882 | # Start with a clean Makefile.tmp file
|
---|
883 | >$MKFILE.tmp
|
---|
884 |
|
---|
885 | host_prep_Makefiles
|
---|
886 | cross_tools_Makefiles # $cross_tools
|
---|
887 | temptools_Makefiles # $temptools
|
---|
888 | if [[ $METHOD = "chroot" ]]; then
|
---|
889 | chroot_Makefiles # $chroottools
|
---|
890 | if [[ ! $TEST = "0" ]]; then
|
---|
891 | testsuite_tools_Makefiles # $testsuitetools
|
---|
892 | fi
|
---|
893 | final_system_Makefiles # $basicsystem
|
---|
894 | bootscripts_Makefiles # $bootscripttools
|
---|
895 | bootable_Makefiles # $bootabletools
|
---|
896 | else
|
---|
897 | boot_Makefiles # $boottools
|
---|
898 | if [[ ! $TEST = "0" ]]; then
|
---|
899 | bm_testsuite_tools_Makefiles # $testsuitetools
|
---|
900 | fi
|
---|
901 | bm_final_system_Makefiles # $basicsystem
|
---|
902 | bm_bootscripts_Makefiles # $bootscipttools
|
---|
903 | bm_bootable_Makefiles # $bootabletoosl
|
---|
904 | fi
|
---|
905 | # the_end_Makefiles
|
---|
906 |
|
---|
907 |
|
---|
908 | # Add a header, some variables and include the function file
|
---|
909 | # to the top of the real Makefile.
|
---|
910 | (
|
---|
911 | cat << EOF
|
---|
912 | $HEADER
|
---|
913 |
|
---|
914 | SRC= /sources
|
---|
915 | MOUNT_PT= $BUILDDIR
|
---|
916 |
|
---|
917 | include makefile-functions
|
---|
918 |
|
---|
919 | EOF
|
---|
920 | ) > $MKFILE
|
---|
921 |
|
---|
922 | # Add chroot commands
|
---|
923 | if [ "$METHOD" = "chroot" ] ; then
|
---|
924 | chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
---|
925 | -e '/^export/d' \
|
---|
926 | -e '/^logout/d' \
|
---|
927 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
928 | -e 's|\\$|&&|g' \
|
---|
929 | -e 's|exit||g' \
|
---|
930 | -e 's|$| -c|' \
|
---|
931 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
932 | -e 's|set -e||'`
|
---|
933 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
934 | fi
|
---|
935 |
|
---|
936 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
937 | # as a dependency.
|
---|
938 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
939 | (
|
---|
940 | cat << EOF
|
---|
941 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
942 | @\$(call echo_finished,$VERSION)
|
---|
943 |
|
---|
944 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
945 |
|
---|
946 | chapter3: chapter2 $cross_tools
|
---|
947 |
|
---|
948 | chapter4: chapter3 $temptools
|
---|
949 |
|
---|
950 | chapter5: chapter4 $chroottools $testsuitetools
|
---|
951 |
|
---|
952 | chapter6: chapter5 $basicsystem
|
---|
953 |
|
---|
954 | chapter7: chapter6 $bootscripttools
|
---|
955 |
|
---|
956 | chapter8: chapter7 $bootabletools
|
---|
957 |
|
---|
958 | clean-all: clean
|
---|
959 | rm -rf ./{${PROGNAME}-commands,logs,${PROGNAME}-Makefile,clfs.xsl,makefile-functions,packages,patches}
|
---|
960 |
|
---|
961 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
962 |
|
---|
963 | clean-chapter2:
|
---|
964 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
965 | userdel lfs; \\
|
---|
966 | rm -rf /home/lfs; \\
|
---|
967 | fi;
|
---|
968 | rm -rf \$(MOUNT_PT)/tools
|
---|
969 | rm -f /tools
|
---|
970 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
971 | rm -f /cross-tools
|
---|
972 | rm -f envars user-lfs-exist
|
---|
973 | rm -f 02* logs/02*.log
|
---|
974 |
|
---|
975 | clean-chapter3:
|
---|
976 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
977 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
978 | cd logs && rm -f $cross_tools && cd ..
|
---|
979 |
|
---|
980 | clean-chapter4:
|
---|
981 | -umount \$(MOUNT_PT)/sys
|
---|
982 | -umount \$(MOUNT_PT)/proc
|
---|
983 | -umount \$(MOUNT_PT)/dev/shm
|
---|
984 | -umount \$(MOUNT_PT)/dev/pts
|
---|
985 | -umount \$(MOUNT_PT)/dev
|
---|
986 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
987 | rm -f $temptools
|
---|
988 | cd logs && rm -f $temptools && cd ..
|
---|
989 |
|
---|
990 |
|
---|
991 | restore-lfs-env:
|
---|
992 | @\$(call echo_message, Building)
|
---|
993 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
994 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
995 | fi;
|
---|
996 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
997 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
998 | fi;
|
---|
999 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1000 | touch \$@
|
---|
1001 |
|
---|
1002 | EOF
|
---|
1003 | ) >> $MKFILE
|
---|
1004 | fi
|
---|
1005 |
|
---|
1006 |
|
---|
1007 | if [[ "${METHOD}" = "boot" ]]; then
|
---|
1008 | (
|
---|
1009 | cat << EOF
|
---|
1010 |
|
---|
1011 | all: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
1012 | $cross_tools \
|
---|
1013 | $temptools \
|
---|
1014 | $chroottools \
|
---|
1015 | $boottools
|
---|
1016 | @\$(call echo_boot_finished,$VERSION)
|
---|
1017 |
|
---|
1018 | makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
1019 | $cross_tools\
|
---|
1020 | $temptools \
|
---|
1021 | $chroottools \
|
---|
1022 | $boottools
|
---|
1023 | @\$(call echo_boot_finished,$VERSION)
|
---|
1024 |
|
---|
1025 | makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
1026 | @\$(call echo_finished,$VERSION)
|
---|
1027 |
|
---|
1028 |
|
---|
1029 | clean-all: clean
|
---|
1030 | rm -rf ./{${PROGNAME}-commands,logs,${PROGNAME}-Makefile,clfs.xsl,makefile-functions,packages,patches}
|
---|
1031 |
|
---|
1032 | clean: clean-makesys clean-makeboot clean-jhalfs
|
---|
1033 |
|
---|
1034 | clean-jhalfs:
|
---|
1035 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1036 | userdel lfs; \\
|
---|
1037 | rm -rf /home/lfs; \\
|
---|
1038 | fi;
|
---|
1039 | rm -rf \$(MOUNT_PT)/tools
|
---|
1040 | rm -f /tools
|
---|
1041 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1042 | rm -f /cross-tools
|
---|
1043 | rm -f envars user-lfs-exist
|
---|
1044 | rm -f 02* logs/02*.log
|
---|
1045 |
|
---|
1046 | clean-makeboot:
|
---|
1047 | rm -rf /tools/*
|
---|
1048 | rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
---|
1049 | rm -f restore-lfs-env sources-dir
|
---|
1050 | cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
---|
1051 |
|
---|
1052 | clean-makesys:
|
---|
1053 | -umount \$(MOUNT_PT)/sys
|
---|
1054 | -umount \$(MOUNT_PT)/proc
|
---|
1055 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1056 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1057 | -umount \$(MOUNT_PT)/dev
|
---|
1058 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1059 | rm -f $basicsystem
|
---|
1060 | rm -f $bootscripttools
|
---|
1061 | rm -f $bootabletools
|
---|
1062 | cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
---|
1063 |
|
---|
1064 |
|
---|
1065 | restore-lfs-env:
|
---|
1066 | @\$(call echo_message, Building)
|
---|
1067 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1068 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1069 | fi;
|
---|
1070 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1071 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1072 | fi;
|
---|
1073 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1074 | touch \$@
|
---|
1075 |
|
---|
1076 | EOF
|
---|
1077 | ) >> $MKFILE
|
---|
1078 | fi
|
---|
1079 |
|
---|
1080 | # Bring over the items from the Makefile.tmp
|
---|
1081 | cat $MKFILE.tmp >> $MKFILE
|
---|
1082 | rm $MKFILE.tmp
|
---|
1083 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
1084 |
|
---|
1085 | }
|
---|
1086 |
|
---|