source: common/makefile-functions@ 08a4953

experimental
Last change on this file since 08a4953 was 50fb011, checked in by George Boudreau <georgeb@…>, 18 years ago

First commit of changes to makefile generation. Makefile now does recursive calls to itself for the different phases..SETUP,LUSER,CHROOT,ROOT

  • Property mode set to 100644
File size: 6.7 KB
RevLine 
[c3c4e1d]1
2# $Id$
3
[50fb011]4BOLD = "[0;1m"
5RED = "[1;31m"
6GREEN = "[0;32m"
7ORANGE = "[0;33m"
8BLUE = "[1;34m"
9WHITE = "[00m"
10YELLOW = "[1;33m"
11
12OFF = "[0m"
13BOLD = "[1m"
14REVERSE = "[7m"
15
16
17define echo_SU_request
18 @echo $(BOLD)--------------------------------------------------------------------------------
19 @echo $(BLUE)$@
20 @echo $(WHITE)ROOT privilege is required to perform a number commands
21 @echo sudo will request a password to all high privelege cmds to execut correctly
22endef
23
24define echo_SULUSER_request
25 @clear
26 @echo $(BOLD)--------------------------------------------------------------------------------
27 @echo $(BOLD)$(BLUE)$@
28 @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF)
29 @echo su requires a password
30endef
31
32define echo_CHROOT_request
33 @clear
34 @echo $(BOLD)--------------------------------------------------------------------------------
35 @echo $(BOLD)$(BLUE)$@
36 @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF)
37 @echo a password is required
38endef
[0170229]39
40define echo_message
[50fb011]41 @echo $(BOLD)--------------------------------------------------------------------------------
42 @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
[0170229]43endef
44
[398a037]45define remove_existing_dirs
46 @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
47 ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
48 rm -rf $(SRCSDIR)/$$ROOT && \
49 rm -rf $(SRCSDIR)/$${ROOT%-*}-build
50endef
51
52define remove_existing_dirs2
[50fb011]53 @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
[398a037]54 ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
55 rm -rf $(SRC)/$$ROOT && \
[b7654ff]56 rm -rf $(SRC)/$${ROOT%-*}-build
[398a037]57endef
58
59define remove_build_dirs
60 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
61 rm -rf $(SRCSDIR)/$$ROOT && \
62 rm -rf $(SRCSDIR)/$(1)-build
63endef
64
65define remove_build_dirs2
66 @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
67 rm -rf $(SRC)/$$ROOT && \
68 rm -rf $(SRC)/$(1)-build
69endef
70
71define housekeeping
72 @touch $@ && \
73 sleep .25 && \
[50fb011]74 echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \
[398a037]75 echo --------------------------------------------------------------------------------$(WHITE)
76
77endef
78
79define get_pkg_root
80 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
81 if [ "$(1)" != "nouser" ]; then \
82 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars; \
83 chown -R $(LUSER) $(SRCSDIR)/$$ROOT; \
84 else \
85 echo "export PKGDIR=$(crSRCSDIR)/$$ROOT" > envars; \
86 fi;
87endef
88
89define get_pkg_root2
90 @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
91 echo "export PKGDIR=$(SRC)/$$ROOT" > envars
92endef
93
[50fb011]94define get_pkg_root_LUSER
95 @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
96 echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars
97endef
98
[0170229]99define unpack
[398a037]100 @cd $(SRCSDIR) && \
[460ea63]101 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
[0170229]102endef
103
104define unpack2
[398a037]105 @cd $(SRCSDIR) && \
[460ea63]106 /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
[0170229]107endef
108
109define unpack3
[c3c4e1d]110 @cd $(SRC) && \
[460ea63]111 tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
[0170229]112endef
113
[9e4b9a1]114define echo_report
115 @echo
116 @echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created
117 @echo
118 @echo ${WHITE}Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE)
119 @echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE)
120 @echo
121 @echo That will help us to keep more accurate SBU and
122 @echo disk usage values into the book. Thanks.
123endef
124
[0170229]125define echo_finished
126 @echo $(BOLD)
127 @echo --------------------------------------------------------------------------------
128 @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
129 @echo --------------------------------------------------------------------------------
130 @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
131 @echo --------------------------------------------------------------------------------
132 @echo
[769a219]133 @echo To be able to boot your new system you need to follow
[0170229]134 @echo the next steps:$(WHITE)
135 @echo
136 @echo -e \\t- Enter to the chroot using the command found
[67e3bc3]137 @echo -e \\tin the section -Entering the Chroot Environment-
[3b63c8c]138 @echo -e \\texcept if building CLFS with METHOD=boot.
[0170229]139 @echo
[9199a13]140 @echo -e \\t- Set a password for the root user.
[0170229]141 @echo
[3b63c8c]142 @echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
[0170229]143 @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
144 @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
145 @echo -e \\tany other configuration file required to suit your needs.
146 @echo
[9199a13]147 @echo -e \\t- Exit from the chroot.
[0170229]148 @echo
[3b63c8c]149 @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot.
[9199a13]150 @echo -e \\tYou can set-up the host bootloader or the new boot-loader
151 @echo -e \\tinstalled on the new system.
152 @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter
[3b63c8c]153 @echo -e \\tthe chroot and be sure that /dev is populated with the
[9199a13]154 @echo -e \\trequired devices before configure the boot-loader. When ready,
155 @echo -e \\texit from the chroot and umount the filesystems
[0170229]156 @echo
157 @echo If you are an experienced LFS user, several of those steps can be
158 @echo skipped or done in a different way. But then, that is something
159 @echo that you already know and there is no need to discuss it here.
160 @echo $(BOLD)
161 @echo --------------------------------------------------------------------------------
162 @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
163 @echo --------------------------------------------------------------------------------$(WHITE)
164endef
165
166define echo_boot_finished
167 @echo $(BOLD)
168 @echo --------------------------------------------------------------------------------
169 @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
170 @echo --------------------------------------------------------------------------------
171 @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
172 @echo --------------------------------------------------------------------------------
173 @echo
174 @echo The build is not complete. Follow the next steps:$(WHITE)
175 @echo
[3b63c8c]176 @echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab
[f80c1e0]177 @echo -e \\t and any other configuration file required to suit your needs.
[0170229]178 @echo $(BOLD)
179 @echo $(BOLD)$(YELLOW)
[623c323]180 @echo 1.If it is necessary, transfer the newly created partition to the target machine
[769a219]181 @echo 2.Boot the new partition.
182 @echo 3.Once you are logged in issue the following commands
183 @echo -e \\t $(BOLD})cd /jhalfs
[f80c1e0]184 @echo -e \\t $(BOLD)make makesys
[0170229]185 @echo The build process should resume. Follow any instructions that appear.
186 @echo --------------------------------------------------------------------------------
187 @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
188 @echo --------------------------------------------------------------------------------$(WHITE)
189endef
Note: See TracBrowser for help on using the repository browser.