1 | #!/bin/sh
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | ###################################
|
---|
5 | ### FUNCTIONS ###
|
---|
6 | ###################################
|
---|
7 |
|
---|
8 |
|
---|
9 | #----------------------------#
|
---|
10 | host_prep_Makefiles() { # Initialization of the system
|
---|
11 | #----------------------------#
|
---|
12 | local CLFS_HOST
|
---|
13 |
|
---|
14 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
15 |
|
---|
16 | # defined here, only for ease of reading
|
---|
17 | CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
---|
18 | (
|
---|
19 | cat << EOF
|
---|
20 | 023-creatingtoolsdir:
|
---|
21 | @\$(call echo_message, Building)
|
---|
22 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
23 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
24 | fi;
|
---|
25 | @chmod a+wt \$(MOUNT_PT)/sources
|
---|
26 | @touch \$@ && \\
|
---|
27 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
28 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
29 |
|
---|
30 | 025-addinguser: 023-creatingtoolsdir
|
---|
31 | @\$(call echo_message, Building)
|
---|
32 | @if [ ! -d /home/\$(LUSER) ]; then \\
|
---|
33 | groupadd \$(LGROUP); \\
|
---|
34 | useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
---|
35 | else \\
|
---|
36 | touch luser-exist; \\
|
---|
37 | fi;
|
---|
38 | @chown \$(LUSER) \$(MOUNT_PT) && \\
|
---|
39 | chown \$(LUSER) \$(MOUNT_PT)/sources
|
---|
40 | @touch \$@ && \\
|
---|
41 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
42 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
43 |
|
---|
44 | 026-settingenvironment: 025-addinguser
|
---|
45 | @\$(call echo_message, Building)
|
---|
46 | @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
47 | mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
---|
48 | fi;
|
---|
49 | @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
50 | mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
---|
51 | fi;
|
---|
52 | @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
---|
53 | echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
---|
54 | echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
---|
55 | echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
---|
56 | echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
---|
57 | echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
---|
58 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
59 | echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
60 | echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
61 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
62 | echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
63 | echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
64 | echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
65 | echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
---|
66 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
---|
67 | touch envars
|
---|
68 | @touch \$@ && \\
|
---|
69 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
70 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
71 |
|
---|
72 | 027-create-directories: 026-settingenvironment
|
---|
73 | @\$(call echo_message, Building)
|
---|
74 |
|
---|
75 | @mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
|
---|
76 | @mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
|
---|
77 | @mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
|
---|
78 | @mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
|
---|
79 | @install -d -m 0750 \$(MOUNT_PT)/root
|
---|
80 | @install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
|
---|
81 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
|
---|
82 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
|
---|
83 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
|
---|
84 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
|
---|
85 | @for dir in \$(MOUNT_PT)/usr{,/local}; do \\
|
---|
86 | ln -s share/{man,doc,info} \$\$dir ; \\
|
---|
87 | done
|
---|
88 |
|
---|
89 | @touch \$@ && \\
|
---|
90 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
91 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
92 |
|
---|
93 | 028-creating-sysfile: 027-create-directories
|
---|
94 | @\$(call echo_message, Building)
|
---|
95 |
|
---|
96 | @touch \$(MOUNT_PT)/etc/mtab
|
---|
97 | @echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd
|
---|
98 | @echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
|
---|
99 | @echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
|
---|
100 | @echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
|
---|
101 | @echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
|
---|
102 | @echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
|
---|
103 | @echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
|
---|
104 | @echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
|
---|
105 | @echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
|
---|
106 | @echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
|
---|
107 | @echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
|
---|
108 | @echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
|
---|
109 | @echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
|
---|
110 | @echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
|
---|
111 | @echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
|
---|
112 | @echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
|
---|
113 | @echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
|
---|
114 |
|
---|
115 | @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
---|
116 | @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
---|
117 | @chown -R \$(LUSER) \$(MOUNT_PT)
|
---|
118 |
|
---|
119 | @touch \$@ && \\
|
---|
120 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
121 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
122 |
|
---|
123 | EOF
|
---|
124 | ) >> $MKFILE.tmp
|
---|
125 | }
|
---|
126 |
|
---|
127 |
|
---|
128 | #-----------------------------#
|
---|
129 | cross_tools_Makefiles() { #
|
---|
130 | #-----------------------------#
|
---|
131 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
132 |
|
---|
133 | for file in cross-tools/* ; do
|
---|
134 | # Keep the script file name
|
---|
135 | this_script=`basename $file`
|
---|
136 | #
|
---|
137 | # Skip this script...
|
---|
138 | # NOTE.. the book indicated you only needed to install groff or file if the host
|
---|
139 | # had older versions. The packages would be installed in the target directory
|
---|
140 | # and not the host.
|
---|
141 | case $this_script in
|
---|
142 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
143 | continue ;;
|
---|
144 | *file ) FileVer=`file --version | head -n1 | cut -d " " -f1`
|
---|
145 | [[ "$FileVer" = "file-4.17" ]] && continue
|
---|
146 | ;;
|
---|
147 | *groff) GroffVer=`groff --version | head -n1 | cut -d " " -f4`
|
---|
148 | [[ "$GroffVer" = "1.19.2" ]] && continue
|
---|
149 | ;;
|
---|
150 | *) ;;
|
---|
151 | esac
|
---|
152 |
|
---|
153 | #
|
---|
154 | # Set the dependency for the first target.
|
---|
155 | if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
|
---|
156 |
|
---|
157 | # First append each name of the script files to a list (this will become
|
---|
158 | # the names of the targets in the Makefile
|
---|
159 | cross_tools="$cross_tools $this_script"
|
---|
160 |
|
---|
161 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
162 | # and binutils in chapter 5)
|
---|
163 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
164 | -e 's@-static@@' \
|
---|
165 | -e 's@-final@@' \
|
---|
166 | -e 's@-64@@' \
|
---|
167 | -e 's@-n32@@'`
|
---|
168 | case $name in
|
---|
169 | glibc-headers) name="glibc" ;;
|
---|
170 | esac
|
---|
171 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
172 | #--------------------------------------------------------------------#
|
---|
173 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
174 | #--------------------------------------------------------------------#
|
---|
175 | #
|
---|
176 | # Drop in the name of the target on a new line, and the previous target
|
---|
177 | # as a dependency. Also call the echo_message function.
|
---|
178 | wrt_target "${this_script}" "$PREV"
|
---|
179 | #
|
---|
180 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
181 | if [ "$pkg_tarball" != "" ] ; then
|
---|
182 | wrt_unpack "$pkg_tarball"
|
---|
183 | # If using optimizations, write the instructions
|
---|
184 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
185 | fi
|
---|
186 | #
|
---|
187 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
188 | #
|
---|
189 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
190 | #
|
---|
191 | # Include a touch of the target name so make can check if it's already been made.
|
---|
192 | wrt_touch
|
---|
193 | #
|
---|
194 | #--------------------------------------------------------------------#
|
---|
195 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
196 | #--------------------------------------------------------------------#
|
---|
197 | #
|
---|
198 | # Keep the script file name for Makefile dependencies.
|
---|
199 | PREV=$this_script
|
---|
200 |
|
---|
201 | done # for file in ....
|
---|
202 | }
|
---|
203 |
|
---|
204 |
|
---|
205 |
|
---|
206 | #-----------------------------#
|
---|
207 | final_system_Makefiles() { #
|
---|
208 | #-----------------------------#
|
---|
209 | echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
|
---|
210 |
|
---|
211 | for file in final-system/* ; do
|
---|
212 | # Keep the script file name
|
---|
213 | this_script=`basename $file`
|
---|
214 |
|
---|
215 | # Test if the stripping phase must be skipped.
|
---|
216 | # Skip alsp temp-perl for iterative runs
|
---|
217 | case $this_script in
|
---|
218 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
219 | esac
|
---|
220 |
|
---|
221 | # Grab the name of the target, strip id number, XXX-script
|
---|
222 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
223 | -e 's@temp-@@' \
|
---|
224 | -e 's@-64bit@@' \
|
---|
225 | -e 's@-64@@' \
|
---|
226 | -e 's@64@@' \
|
---|
227 | -e 's@n32@@'`
|
---|
228 |
|
---|
229 | # Find the version of the command files, if it corresponds with the building of
|
---|
230 | # a specific package.
|
---|
231 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
232 |
|
---|
233 | # Append each name of the script files to a list (this will become
|
---|
234 | # the names of the targets in the Makefile
|
---|
235 | basicsystem="$basicsystem ${this_script}"
|
---|
236 |
|
---|
237 | #--------------------------------------------------------------------#
|
---|
238 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
239 | #--------------------------------------------------------------------#
|
---|
240 | #
|
---|
241 | # Drop in the name of the target on a new line, and the previous target
|
---|
242 | # as a dependency. Also call the echo_message function.
|
---|
243 | wrt_target "${this_script}" "$PREV"
|
---|
244 | #
|
---|
245 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
246 | if [ "$pkg_tarball" != "" ] ; then
|
---|
247 | wrt_unpack "$pkg_tarball"
|
---|
248 | # If using optimizations, write the instructions
|
---|
249 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
250 | fi
|
---|
251 | #
|
---|
252 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
253 | #
|
---|
254 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
255 | #
|
---|
256 | # Include a touch of the target name so make can check if it's already been made.
|
---|
257 | wrt_touch
|
---|
258 | #
|
---|
259 | #--------------------------------------------------------------------#
|
---|
260 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
261 | #--------------------------------------------------------------------#
|
---|
262 | #
|
---|
263 | # Keep the script file name for Makefile dependencies.
|
---|
264 | PREV=${this_script}
|
---|
265 | done # for file in final-system/* ...
|
---|
266 | }
|
---|
267 |
|
---|
268 |
|
---|
269 |
|
---|
270 | #-----------------------------#
|
---|
271 | bootscripts_Makefiles() { #
|
---|
272 | #-----------------------------#
|
---|
273 | echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
|
---|
274 |
|
---|
275 | for file in bootscripts/* ; do
|
---|
276 | # Keep the script file name
|
---|
277 | this_script=`basename $file`
|
---|
278 |
|
---|
279 | case $this_script in
|
---|
280 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
281 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
282 | *) ;;
|
---|
283 | esac
|
---|
284 |
|
---|
285 | # First append each name of the script files to a list (this will become
|
---|
286 | # the names of the targets in the Makefile
|
---|
287 | bootscripttools="$bootscripttools $this_script"
|
---|
288 |
|
---|
289 | # Grab the name of the target, strip id number, XXX-script
|
---|
290 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
291 | -e 's@-64bit@@' \
|
---|
292 | -e 's@-64@@' \
|
---|
293 | -e 's@64@@' \
|
---|
294 | -e 's@n32@@'`
|
---|
295 | case $name in
|
---|
296 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
297 | *udev-rules) name=udev-cross-lfs ;;
|
---|
298 | esac
|
---|
299 |
|
---|
300 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
301 |
|
---|
302 | #--------------------------------------------------------------------#
|
---|
303 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
304 | #--------------------------------------------------------------------#
|
---|
305 | #
|
---|
306 | # Drop in the name of the target on a new line, and the previous target
|
---|
307 | # as a dependency. Also call the echo_message function.
|
---|
308 | wrt_target "${this_script}" "$PREV"
|
---|
309 | #
|
---|
310 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
311 | [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
---|
312 | #
|
---|
313 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
314 | #
|
---|
315 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
316 | #
|
---|
317 | # Include a touch of the target name so make can check if it's already been made.
|
---|
318 | wrt_touch
|
---|
319 | #
|
---|
320 | #--------------------------------------------------------------------#
|
---|
321 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
322 | #--------------------------------------------------------------------#
|
---|
323 | #
|
---|
324 | # Keep the script file name for Makefile dependencies.
|
---|
325 | PREV=$this_script
|
---|
326 |
|
---|
327 | done # for file in bootscripts/* ...
|
---|
328 |
|
---|
329 | }
|
---|
330 |
|
---|
331 |
|
---|
332 | #-----------------------------#
|
---|
333 | bootable_Makefiles() { #
|
---|
334 | #-----------------------------#
|
---|
335 | echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
|
---|
336 |
|
---|
337 | for file in bootable/* ; do
|
---|
338 | # Keep the script file name
|
---|
339 | this_script=`basename $file`
|
---|
340 |
|
---|
341 | # A little housekeeping on the scripts
|
---|
342 | case $this_script in
|
---|
343 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
344 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
345 | [[ -z $CONFIG ]] && continue
|
---|
346 | # Copy the config file to /sources with a standardized name
|
---|
347 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
348 | ;;
|
---|
349 | esac
|
---|
350 | #
|
---|
351 | # First append each name of the script files to a list (this will become
|
---|
352 | # the names of the targets in the Makefile
|
---|
353 | bootable="$bootable $this_script"
|
---|
354 | #
|
---|
355 | # Grab the name of the target, strip id number and misc words.
|
---|
356 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
357 | case $this_script in
|
---|
358 | *kernel*) name=linux
|
---|
359 | ;;
|
---|
360 | esac
|
---|
361 |
|
---|
362 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
363 |
|
---|
364 | #--------------------------------------------------------------------#
|
---|
365 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
366 | #--------------------------------------------------------------------#
|
---|
367 | #
|
---|
368 | # Drop in the name of the target on a new line, and the previous target
|
---|
369 | # as a dependency. Also call the echo_message function.
|
---|
370 | wrt_target "${this_script}" "$PREV"
|
---|
371 | #
|
---|
372 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
373 | [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
---|
374 | #
|
---|
375 | # Select a script execution method
|
---|
376 | case $this_script in
|
---|
377 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
378 | wrt_copy_fstab "${this_script}"
|
---|
379 | else
|
---|
380 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
381 | fi
|
---|
382 | ;;
|
---|
383 | *chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
---|
384 | ;;
|
---|
385 | *) wrt_RunAsUser "${this_script}" "${file}"
|
---|
386 | ;;
|
---|
387 | esac
|
---|
388 | #
|
---|
389 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
390 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
391 | #
|
---|
392 | # Include a touch of the target name so make can check if it's already been made.
|
---|
393 | wrt_touch
|
---|
394 | #
|
---|
395 | #--------------------------------------------------------------------#
|
---|
396 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
397 | #--------------------------------------------------------------------#
|
---|
398 | #
|
---|
399 | # Keep the script file name for Makefile dependencies.
|
---|
400 | PREV=$this_script
|
---|
401 |
|
---|
402 | done
|
---|
403 |
|
---|
404 | # Add SBU-disk_usage report target if required
|
---|
405 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
406 |
|
---|
407 | }
|
---|
408 |
|
---|
409 |
|
---|
410 | #-----------------------------#
|
---|
411 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
412 | #-----------------------------#
|
---|
413 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
414 |
|
---|
415 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
416 | # Start with a clean Makefile.tmp file
|
---|
417 | >$MKFILE.tmp
|
---|
418 |
|
---|
419 | host_prep_Makefiles
|
---|
420 | cross_tools_Makefiles # $cross_tools
|
---|
421 | final_system_Makefiles # $basicsystem
|
---|
422 | bootscripts_Makefiles # $bootscripttools
|
---|
423 | bootable_Makefiles # $bootable
|
---|
424 |
|
---|
425 | # Add a header, some variables and include the function file
|
---|
426 | # to the top of the real Makefile.
|
---|
427 | (
|
---|
428 | cat << EOF
|
---|
429 | $HEADER
|
---|
430 |
|
---|
431 | SRC= /sources
|
---|
432 | MOUNT_PT= $BUILDDIR
|
---|
433 | PKG_LST= $PKG_LST
|
---|
434 | LUSER= $LUSER
|
---|
435 | LGROUP= $LGROUP
|
---|
436 |
|
---|
437 | include makefile-functions
|
---|
438 |
|
---|
439 | EOF
|
---|
440 | ) > $MKFILE
|
---|
441 |
|
---|
442 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
443 | # as a dependency.
|
---|
444 | (
|
---|
445 | cat << EOF
|
---|
446 | all: chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping
|
---|
447 | @\$(call echo_finished,$VERSION)
|
---|
448 |
|
---|
449 | chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
|
---|
450 |
|
---|
451 | chapter3: chapter2 $cross_tools
|
---|
452 |
|
---|
453 | chapter4: chapter3 $basicsystem
|
---|
454 |
|
---|
455 | chapter5: chapter4 $bootscripttools
|
---|
456 |
|
---|
457 | chapter6: chapter5 $bootable
|
---|
458 |
|
---|
459 | clean-all: clean
|
---|
460 | rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
461 |
|
---|
462 | clean:
|
---|
463 |
|
---|
464 | restart:
|
---|
465 | @echo "This feature does not exist for the CLFS makefile. (yet)"
|
---|
466 |
|
---|
467 | restore-luser-env:
|
---|
468 | @\$(call echo_message, Building)
|
---|
469 | @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
470 | mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
---|
471 | fi;
|
---|
472 | @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
473 | mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
---|
474 | fi;
|
---|
475 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
---|
476 | touch \$@ && \\
|
---|
477 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
478 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
479 |
|
---|
480 | do-housekeeping:
|
---|
481 | @-if [ ! -f luser-exist ]; then \\
|
---|
482 | userdel \$(LUSER); \\
|
---|
483 | rm -rf /home/\$(LUSER); \\
|
---|
484 | fi;
|
---|
485 |
|
---|
486 | EOF
|
---|
487 | ) >> $MKFILE
|
---|
488 |
|
---|
489 | # Bring over the items from the Makefile.tmp
|
---|
490 | cat $MKFILE.tmp >> $MKFILE
|
---|
491 | rm $MKFILE.tmp
|
---|
492 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
493 |
|
---|
494 | }
|
---|
495 |
|
---|