source: common/makefile-functions@ f222bb8

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since f222bb8 was fc6076c, checked in by George Boudreau <georgeb@…>, 18 years ago

Who knew make would not like embedded control codes in its strings. For now tab_ works but nl_ doesn't

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