source: BLFS/master.sh@ 4845f38

experimental
Last change on this file since 4845f38 was a46ada0, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added Id key to some file to see in what of them is expanded and in what not.

  • Property mode set to 100755
File size: 2.3 KB
Line 
1#!/bin/sh
2
3# $Id$
4
5#----------------------------#
6build_Makefile() {
7#----------------------------#
8 echo -n "Creating Makefile... "
9 cd $JHALFSDIR/${PROGNAME}-commands
10
11 # Start with a clean Makefile file
12 >$MKFILE
13
14
15 # Add a header, some variables and include the function file
16 # to the top of the real Makefile.
17(
18 cat << EOF
19$HEADER
20
21include makefile-functions
22
23EOF
24) > $MKFILE
25
26 # Drop in a dummy target 'all:'.
27(
28 cat << EOF
29all:
30 @echo -e "\nThere is no default target predefined"
31 @echo -e "You must to tell what package(s) you want to install"
32 @echo -e "or edit the \"all\" Makefile target to create your own"
33 @echo -e "defualt target.\n"
34 @exit
35EOF
36) >> $MKFILE
37
38 # Bring over the build targets.
39 for file in */* ; do
40 # Keep the script file name
41 case $file in
42 gnome/config )
43 this_script=config-gnome
44 ;;
45 gnome/pre-install-config )
46 this_script=pre-intall-config-gnome
47 ;;
48 kde/config )
49 this_script=config-kde
50 ;;
51 kde/pre-install-config )
52 this_script=pre-intall-config-kde
53 ;;
54 * )
55 this_script=`basename $file`
56 ;;
57 esac
58
59 # Dump the package dependencies.
60 REQUIRED=`grep "REQUIRED" $file | sed 's/# REQUIRED://' | tr -d '\n'`
61 if [ "$DEPEND" != "0" ] ; then
62 RECOMMENDED=`grep "RECOMMENDED" $file | sed 's/# RECOMMENDED://' | tr -d '\n'`
63 fi
64 if [ "$DEPEND" = "2" ] ; then
65 OPTIONAL=`grep "OPTIONAL" $file | sed 's/# OPTIONAL://' | tr -d '\n'`
66 fi
67
68 # Drop in the name of the target on a new line plus its dependencies
69 # and call the echo_message function.
70(
71 cat << EOF
72
73$this_script: $REQUIRED $RECOMMENDED $OPTIONAL
74 @\$(call echo_message, Building)
75EOF
76) >> $MKFILE
77
78 # Insert date and disk usage at the top of the log file, the script run
79 # and date and disk usage again at the bottom of the log file.
80(
81 cat << EOF
82 @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >logs/$this_script && \\
83 $JHALFSDIR/${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
84 echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >>logs/$this_script
85EOF
86) >> $MKFILE
87
88 # Include a touch of the target name so make can check
89 # if it's already been made.
90(
91 cat << EOF
92 @touch \$@
93EOF
94) >> $MKFILE
95
96 done
97 echo -ne "done\n"
98}
99
100
101
Note: See TracBrowser for help on using the repository browser.