source: common/makefile-functions@ 9adff0e

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 9adff0e was 045b2dc, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Merged r3043:3145 from experimental:
New Makefile code and other improvements.

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