| 1 |
# |
|---|
| 2 |
# Makefiles for automating the LFS LiveCD build |
|---|
| 3 |
# |
|---|
| 4 |
# Written by Jeremy Huntwork | jhuntwork AT linuxfromscratch DOT org |
|---|
| 5 |
# Several additions and edits by Alexander Patrakov, Justin Knierim and |
|---|
| 6 |
# Thomas Pegg |
|---|
| 7 |
# |
|---|
| 8 |
# These scripts are published under the GNU General Public License, version 2 |
|---|
| 9 |
# |
|---|
| 10 |
#============================================================================== |
|---|
| 11 |
# |
|---|
| 12 |
# Unless otherwise noted, please try to keep all line lengths below 80 chars. |
|---|
| 13 |
# |
|---|
| 14 |
|
|---|
| 15 |
# Machine architecure, LiveCD version, and specific arch variables. |
|---|
| 16 |
#============================================================================== |
|---|
| 17 |
|
|---|
| 18 |
# Place your personal customizations in Makefile.personal |
|---|
| 19 |
# instead of editing this Makefile. |
|---|
| 20 |
# Makefile.personal is deliberately not in SVN. |
|---|
| 21 |
|
|---|
| 22 |
-include Makefile.personal |
|---|
| 23 |
|
|---|
| 24 |
# LFS-ARCH: architecture for which the CD should be built. |
|---|
| 25 |
# MP: mount point |
|---|
| 26 |
# timezone: default timezone |
|---|
| 27 |
# pagesize: default paper size for groff. |
|---|
| 28 |
# ROOT: name of this directory, as seen from chroot |
|---|
| 29 |
# PM: Parallel Build Level |
|---|
| 30 |
# HTTP: Default http server for the lfs-base packages |
|---|
| 31 |
# HTTPBLFS: Default http server for the BLFS packages |
|---|
| 32 |
|
|---|
| 33 |
export LFS-ARCH ?= x86 |
|---|
| 34 |
export MPBASE ?= /mnt/lfs |
|---|
| 35 |
export MP ?= $(MPBASE)/image |
|---|
| 36 |
export timezone ?= GMT |
|---|
| 37 |
export pagesize ?= letter |
|---|
| 38 |
export ROOT ?= /lfs-livecd |
|---|
| 39 |
#export PM ?= -j3 |
|---|
| 40 |
export HTTP ?= http://ftp.lfs-matrix.net/pub/lfs/conglomeration |
|---|
| 41 |
export HTTPBLFS ?= http://ftp.lfs-matrix.net/pub/blfs/conglomeration |
|---|
| 42 |
|
|---|
| 43 |
# Directory variables |
|---|
| 44 |
#============================================================================== |
|---|
| 45 |
export HOSTNAME := lfslivecd |
|---|
| 46 |
export WD := /tools |
|---|
| 47 |
export SRC := /sources |
|---|
| 48 |
export LFSSRC := /lfs-sources |
|---|
| 49 |
export PKG := packages |
|---|
| 50 |
export MKTREE := $(MP)$(ROOT) |
|---|
| 51 |
export CONFIG_SITE := $(ROOT)/scripts/config.site |
|---|
| 52 |
|
|---|
| 53 |
ROOTFS_MEGS := 1536 |
|---|
| 54 |
|
|---|
| 55 |
export ARCHVARS := vars/vars.$(LFS-ARCH) |
|---|
| 56 |
|
|---|
| 57 |
include $(ARCHVARS) |
|---|
| 58 |
|
|---|
| 59 |
# Environment Variables |
|---|
| 60 |
# The following lines need to be all on one line - no newlines. |
|---|
| 61 |
#=============================================================================== |
|---|
| 62 |
export lfsenv := exec env -i HOME=$$HOME CFLAGS='$(CFLAGS)' CXXFLAGS='$(CXXFLAGS)' LFS=$(MP) LC_ALL=POSIX PATH=$(WD)/bin:/bin:/usr/bin /bin/bash -c |
|---|
| 63 |
|
|---|
| 64 |
export chenv-pre-bash := $(WD)/bin/env -i HOME=/root CFLAGS='$(CFLAGS)' CXXFLAGS='$(CXXFLAGS)' TERM=$(TERM) PS1='\u:\w\$$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:$(WD)/bin $(WD)/bin/bash -c |
|---|
| 65 |
|
|---|
| 66 |
export chenv-post-bash := $(WD)/bin/env -i HOME=/root CFLAGS='$(CFLAGS)' CXXFLAGS='$(CXXFLAGS)' TERM=$(TERM) PS1='\u:\w\$$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:$(WD)/bin /bin/bash -c |
|---|
| 67 |
|
|---|
| 68 |
export lfsbash := set +h && umask 022 && cd $(MKTREE) |
|---|
| 69 |
|
|---|
| 70 |
export chenv-blfs := /usr/bin/env -i HOME=/root CFLAGS='$(CFLAGS)' TERM=$(TERM) PS1='\u:\w\$$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin INPUTRC=/etc/inputrc XML_CATALOG_FILES="/usr/share/xml/docbook/xsl-stylesheets-1.69.1/catalog.xml /etc/xml/catalog" /bin/bash -c |
|---|
| 71 |
|
|---|
| 72 |
# More Environment Variables |
|---|
| 73 |
#============================================================================== |
|---|
| 74 |
export CXXFLAGS := $(CFLAGS) |
|---|
| 75 |
|
|---|
| 76 |
export chbash-pre-bash := SHELL=$(WD)/bin/bash |
|---|
| 77 |
export chbash-post-bash := SHELL=/bin/bash |
|---|
| 78 |
export WHICH ?= $(WD)/bin/which |
|---|
| 79 |
export WGET ?= wget |
|---|
| 80 |
|
|---|
| 81 |
export BRW= "[0;1m" |
|---|
| 82 |
export RED= "[0;31m" |
|---|
| 83 |
export GREEN= "[0;32m" |
|---|
| 84 |
export ORANGE= "[0;33m" |
|---|
| 85 |
export BLUE= "[0;44m" |
|---|
| 86 |
export WHITE= "[00m" |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
# TARGETS |
|---|
| 90 |
#============================================================================== |
|---|
| 91 |
# |
|---|
| 92 |
# The build starts and ends here, first building the dependency targets, |
|---|
| 93 |
# lfs-base, extend-lfs and iso, then it echoes a notice that it's finished. :) |
|---|
| 94 |
|
|---|
| 95 |
all: test-host lfs-base extend-lfs iso |
|---|
| 96 |
@echo "The LiveCD, $(MPBASE)$(ROOT)/lfslivecd-$(VERSION).iso, is ready!" |
|---|
| 97 |
|
|---|
| 98 |
minimal: test-host lfs-base extend-minimal iso |
|---|
| 99 |
@echo "The LiveCD, $(MPBASE)$(ROOT)/lfslivecd-$(VERSION).iso, is ready!" |
|---|
| 100 |
|
|---|
| 101 |
test-host: |
|---|
| 102 |
@if [ `whoami` != "root" ] ; then \ |
|---|
| 103 |
echo "You must be logged in as root." && exit 1 ; fi |
|---|
| 104 |
|
|---|
| 105 |
# This image should be kept as clean as possible, i.e.: |
|---|
| 106 |
# avoid creating files on it that you will later delete, |
|---|
| 107 |
# preserve as many zeroed sectors as possible. |
|---|
| 108 |
root.ext2: |
|---|
| 109 |
dd if=/dev/null of=root.ext2 bs=1M seek=$(ROOTFS_MEGS) |
|---|
| 110 |
echo y | mke2fs root.ext2 |
|---|
| 111 |
tune2fs -c 0 -i 0 root.ext2 |
|---|
| 112 |
|
|---|
| 113 |
# This target populates the root.ext2 image and sets up some mounts |
|---|
| 114 |
# Basically, replaces the prep-chroot and createdirs targets |
|---|
| 115 |
$(MKTREE): root.ext2 |
|---|
| 116 |
mkdir -p $(MP) $(MPBASE)$(SRC) $(MPBASE)$(WD)/bin $(MPBASE)/iso/boot |
|---|
| 117 |
mount -o loop root.ext2 $(MP) |
|---|
| 118 |
-rm $(MP)/boot |
|---|
| 119 |
mkdir -p $(MKTREE) $(MP)$(SRC) $(MP)$(WD) $(MP)/boot |
|---|
| 120 |
mount --bind $(MPBASE)$(ROOT) $(MP)$(ROOT) |
|---|
| 121 |
mount --bind $(MPBASE)$(WD) $(MP)$(WD) |
|---|
| 122 |
mount --bind $(MPBASE)$(SRC) $(MP)$(SRC) |
|---|
| 123 |
mount --bind $(MPBASE)/iso/boot $(MP)/boot |
|---|
| 124 |
mkdir -p $(MP)$(LFSSRC) |
|---|
| 125 |
-ln -nsf $(MPBASE)$(WD) / |
|---|
| 126 |
-ln -nsf $(MPBASE)$(SRC) / |
|---|
| 127 |
-ln -nsf $(MPBASE)$(ROOT) / |
|---|
| 128 |
-ln -nsf $(MP)$(LFSSRC) / |
|---|
| 129 |
-mkdir -p $(MP)/{proc,sys,dev/shm,dev/pts} |
|---|
| 130 |
-mount -t proc proc $(MP)/proc |
|---|
| 131 |
-mount -t sysfs sysfs $(MP)/sys |
|---|
| 132 |
-mount -t tmpfs tmpfs $(MP)/dev/shm |
|---|
| 133 |
-mount -t devpts -o gid=4,mode=620 devpts $(MP)/dev/pts |
|---|
| 134 |
-install -d $(MP)/{bin,etc/opt,home,lib,mnt} |
|---|
| 135 |
-install -d $(MP)/{sbin,srv,usr/local,var,opt} |
|---|
| 136 |
-install -d $(MP)/root -m 0750 |
|---|
| 137 |
-install -d $(MP)/tmp $(MP)/var/tmp -m 1777 |
|---|
| 138 |
-install -d $(MP)/media/{floppy,cdrom} |
|---|
| 139 |
-install -d $(MP)/usr/{bin,include,lib,sbin,share,src} |
|---|
| 140 |
-ln -s share/{man,doc,info} $(MP)/usr |
|---|
| 141 |
-install -d $(MP)/usr/share/{doc,info,locale,man} |
|---|
| 142 |
-install -d $(MP)/usr/share/{misc,terminfo,zoneinfo} |
|---|
| 143 |
-install -d $(MP)/usr/share/man/man{1,2,3,4,5,6,7,8} |
|---|
| 144 |
-install -d $(MP)/usr/local/{bin,etc,include,lib,sbin,share,src} |
|---|
| 145 |
-ln -s share/{man,doc,info} $(MP)/usr/local |
|---|
| 146 |
-install -d $(MP)/usr/local/share/{doc,info,locale,man} |
|---|
| 147 |
-install -d $(MP)/usr/local/share/{misc,terminfo,zoneinfo} |
|---|
| 148 |
-install -d $(MP)/usr/local/share/man/man{1,2,3,4,5,6,7,8} |
|---|
| 149 |
-install -d $(MP)/var/{lock,log,mail,run,spool} |
|---|
| 150 |
-install -d $(MP)/var/{opt,cache,lib/{misc,locate},local} |
|---|
| 151 |
-install -d $(MP)/opt/{bin,doc,include,info} |
|---|
| 152 |
-install -d $(MP)/opt/{lib,man/man{1,2,3,4,5,6,7,8}} |
|---|
| 153 |
-mknod -m 600 $(MP)/dev/console c 5 1 |
|---|
| 154 |
-mknod -m 666 $(MP)/dev/null c 1 3 |
|---|
| 155 |
-mknod -m 666 $(MP)/dev/zero c 1 5 |
|---|
| 156 |
-mknod -m 666 $(MP)/dev/ptmx c 5 2 |
|---|
| 157 |
-mknod -m 666 $(MP)/dev/tty c 5 0 |
|---|
| 158 |
-mknod -m 444 $(MP)/dev/random c 1 8 |
|---|
| 159 |
-mknod -m 444 $(MP)/dev/urandom c 1 9 |
|---|
| 160 |
-ln -s /proc/self/fd $(MP)/dev/fd |
|---|
| 161 |
-ln -s /proc/self/fd/0 $(MP)/dev/stdin |
|---|
| 162 |
-ln -s /proc/self/fd/1 $(MP)/dev/stdout |
|---|
| 163 |
-ln -s /proc/self/fd/2 $(MP)/dev/stderr |
|---|
| 164 |
-ln -s /proc/kcore $(MP)/dev/core |
|---|
| 165 |
|
|---|
| 166 |
# This target builds just a base LFS system, minus the kernel and bootscripts |
|---|
| 167 |
#============================================================================== |
|---|
| 168 |
lfs-base: $(MKTREE) lfsuser |
|---|
| 169 |
@-chown -R lfs $(WD) $(MP)$(WD) $(WD)/bin \ |
|---|
| 170 |
$(LFSSRC) $(MP)$(LFSSRC) $(SRC) $(MP)$(SRC) $(MKTREE) |
|---|
| 171 |
@cp $(ROOT)/scripts/unpack $(WD)/bin |
|---|
| 172 |
@su - lfs -c "$(lfsenv) '$(lfsbash) && $(MAKE) tools'" |
|---|
| 173 |
@touch $(PKG)/wget/.pass2 |
|---|
| 174 |
@install -m644 -oroot -groot $(ROOT)/etc/{group,passwd} $(MP)/etc |
|---|
| 175 |
@-ln -s $(WD)/bin/bash $(MP)/bin/bash |
|---|
| 176 |
@chroot "$(MP)" $(chenv-pre-bash) 'set +h && \ |
|---|
| 177 |
chown -R 0:0 $(WD) $(SRC) $(ROOT) && \ |
|---|
| 178 |
cd $(ROOT) && make pre-bash $(chbash-pre-bash)' |
|---|
| 179 |
@chroot "$(MP)" $(chenv-post-bash) 'set +h && cd $(ROOT) && \ |
|---|
| 180 |
make post-bash $(chbash-post-bash)' |
|---|
| 181 |
@-ln -s $(WD)/bin/wget $(MP)/usr/bin/wget |
|---|
| 182 |
|
|---|
| 183 |
stop-here: |
|---|
| 184 |
exit 1 |
|---|
| 185 |
|
|---|
| 186 |
extend-lfs: $(MKTREE) |
|---|
| 187 |
@cp $(WD)/bin/which $(MP)/usr/bin |
|---|
| 188 |
@cp $(ROOT)/scripts/unpack $(MP)/bin |
|---|
| 189 |
@chroot "$(MP)" $(chenv-blfs) 'set +h && cd $(ROOT) && \ |
|---|
| 190 |
make blfs $(chbash-post-bash)' |
|---|
| 191 |
@install -m644 etc/issue $(MP)/etc/issue |
|---|
| 192 |
|
|---|
| 193 |
extend-minimal: $(MKTREE) |
|---|
| 194 |
@cp $(WD)/bin/which $(MP)/usr/bin |
|---|
| 195 |
@cp $(ROOT)/scripts/unpack $(MP)/bin |
|---|
| 196 |
@chroot "$(MP)" $(chenv-blfs) 'set +h && cd $(ROOT) && \ |
|---|
| 197 |
make blfs-minimal $(chbash-post-bash)' |
|---|
| 198 |
@rm -rf $(LFSSRC) $(MP)$(LFSSRC) |
|---|
| 199 |
@sed '/sources/d' etc/issue >$(MP)/etc/issue |
|---|
| 200 |
@chmod 644 $(MP)/etc/issue |
|---|
| 201 |
|
|---|
| 202 |
lfsuser: |
|---|
| 203 |
@-groupadd lfs |
|---|
| 204 |
@-useradd -s /bin/bash -g lfs -m -k /dev/null lfs |
|---|
| 205 |
@touch $@ |
|---|
| 206 |
|
|---|
| 207 |
pre-which: |
|---|
| 208 |
@echo "#!/bin/sh" > $(WHICH) |
|---|
| 209 |
@echo 'type -pa "$$@" | head -n 1 ; exit $${PIPESTATUS[0]}' >> $(WHICH) |
|---|
| 210 |
@chmod 755 $(WHICH) |
|---|
| 211 |
|
|---|
| 212 |
pre-wget: |
|---|
| 213 |
@make -C $(PKG)/wget prebuild |
|---|
| 214 |
@touch $@ |
|---|
| 215 |
|
|---|
| 216 |
tools: pre-which pre-wget lfs-binutils-pass1 lfs-gcc-pass1 \ |
|---|
| 217 |
lfs-linux-libc-headers-scpt lfs-glibc-scpt lfs-adjust-toolchain \ |
|---|
| 218 |
lfs-tcl-scpt lfs-expect-scpt lfs-dejagnu-scpt lfs-gcc-pass2 \ |
|---|
| 219 |
lfs-binutils-pass2 lfs-ncurses-scpt lfs-bash-scpt lfs-bzip2-scpt \ |
|---|
| 220 |
lfs-coreutils-scpt lfs-diffutils-scpt lfs-findutils-scpt \ |
|---|
| 221 |
lfs-gawk-scpt lfs-gettext-scpt lfs-grep-scpt lfs-gzip-scpt \ |
|---|
| 222 |
lfs-m4-scpt lfs-make-scpt lfs-patch-scpt lfs-perl-scpt lfs-sed-scpt \ |
|---|
| 223 |
lfs-tar-scpt lfs-texinfo-scpt lfs-util-linux-scpt lfs-wget-scpt |
|---|
| 224 |
@cp /etc/resolv.conf $(WD)/etc |
|---|
| 225 |
|
|---|
| 226 |
pre-bash: createfiles ch-linux-libc-headers ch-man-pages \ |
|---|
| 227 |
ch-glibc re-adjust-toolchain ch-binutils ch-gcc ch-db ch-coreutils \ |
|---|
| 228 |
ch-iana-etc ch-m4 ch-bison ch-gpm ch-ncurses ch-procps ch-sed ch-libtool \ |
|---|
| 229 |
ch-perl ch-readline ch-zlib ch-autoconf ch-automake ch-bash |
|---|
| 230 |
|
|---|
| 231 |
post-bash: ch-bzip2 ch-diffutils ch-e2fsprogs ch-file ch-findutils ch-flex \ |
|---|
| 232 |
ch-grub ch-gawk ch-gettext ch-grep ch-groff ch-gzip ch-inetutils \ |
|---|
| 233 |
ch-iproute2 ch-kbd ch-less ch-make ch-man-db ch-mktemp \ |
|---|
| 234 |
ch-module-init-tools ch-patch ch-psmisc ch-shadow ch-sysklogd \ |
|---|
| 235 |
ch-sysvinit ch-tar ch-texinfo ch-udev ch-util-linux ch-vim \ |
|---|
| 236 |
final-environment |
|---|
| 237 |
|
|---|
| 238 |
blfs: ch-openssl ch-wget ch-reiserfsprogs ch-xfsprogs ch-nano ch-joe \ |
|---|
| 239 |
ch-screen ch-pkgconfig ch-libidn ch-curl ch-zip ch-unzip ch-lynx ch-libxml2 ch-expat \ |
|---|
| 240 |
ch-subversion ch-lfs-bootscripts ch-livecd-bootscripts ch-docbook-xml ch-libxslt \ |
|---|
| 241 |
ch-docbook-xsl ch-html_tidy ch-LFS-BOOK ch-libpng ch-freetype \ |
|---|
| 242 |
ch-fontconfig ch-Xorg-modular ch-synaptics ch-inputattach \ |
|---|
| 243 |
ch-freefont ch-fonts-dejavu ch-fonts-kochi ch-fonts-firefly ch-fonts-baekmuk \ |
|---|
| 244 |
ch-libjpeg ch-libtiff ch-openssh ch-glib2 ch-giflib ch-imlib ch-imlib2 \ |
|---|
| 245 |
ch-gc ch-w3m ch-cairo ch-hicolor-icon-theme \ |
|---|
| 246 |
ch-pango ch-atk ch-gtk2 ch-cvs ch-popt ch-samba ch-libIDL ch-seamonkey \ |
|---|
| 247 |
ch-librsvg ch-startup-notification chroot-gvim ch-xfce ch-vte ch-exo \ |
|---|
| 248 |
ch-XML-Parser ch-Terminal ch-mousepad ch-irssi ch-libgpg-error \ |
|---|
| 249 |
ch-libgcrypt ch-gnutls ch-gaim \ |
|---|
| 250 |
ch-xchat ch-wireless_tools ch-tcpwrappers ch-portmap ch-nfs-utils \ |
|---|
| 251 |
ch-traceroute ch-rsync ch-jhalfs ch-sudo ch-bc \ |
|---|
| 252 |
ch-dialog ch-ncftp ch-pciutils ch-device-mapper ch-LVM2 ch-dmraid \ |
|---|
| 253 |
ch-dhcpcd ch-distcc ch-ppp ch-rp-pppoe ch-libaal ch-reiser4progs \ |
|---|
| 254 |
ch-cpio ch-mutt ch-msmtp ch-tin ch-mdadm ch-which ch-BRLTTY \ |
|---|
| 255 |
ch-strace ch-iptables ch-eject ch-xlockmore ch-hdparm ch-linux \ |
|---|
| 256 |
ch-sysfsutils ch-pcmcia-cs ch-pcmciautils ch-ddccontrol ch-ddccontrol-db \ |
|---|
| 257 |
ch-initramfs ch-zisofs-tools ch-cdrtools ch-blfs-bootscripts ch-oui-data \ |
|---|
| 258 |
ch-man-fr ch-man-pages-es ch-man-pages-it ch-manpages-de ch-manpages-ru \ |
|---|
| 259 |
ch-anthy ch-scim ch-scim-tables ch-scim-anthy ch-scim-hangul \ |
|---|
| 260 |
ch-libchewing ch-scim-chewing ch-scim-pinyin ch-scim-input-pad \ |
|---|
| 261 |
ch-hibernate-script ch-parted |
|---|
| 262 |
ifeq ($(LFS-ARCH),x86) |
|---|
| 263 |
make ch-vbetool |
|---|
| 264 |
make ch-bin86 |
|---|
| 265 |
make ch-lilo |
|---|
| 266 |
make ch-syslinux |
|---|
| 267 |
make ch-gcc33 |
|---|
| 268 |
make ch-proprietary-drivers |
|---|
| 269 |
endif |
|---|
| 270 |
ifeq ($(LFS-ARCH),ppc) |
|---|
| 271 |
make ch-yaboot |
|---|
| 272 |
make ch-hfsutils |
|---|
| 273 |
make ch-mac-fdisk |
|---|
| 274 |
endif |
|---|
| 275 |
make update-caches |
|---|
| 276 |
|
|---|
| 277 |
blfs-minimal: ch-openssl ch-wget ch-reiserfsprogs ch-xfsprogs ch-nano ch-joe \ |
|---|
| 278 |
ch-screen ch-pkgconfig ch-libidn ch-curl ch-zip ch-unzip ch-lynx ch-libxml2 \ |
|---|
| 279 |
ch-expat ch-subversion ch-lfs-bootscripts ch-livecd-bootscripts ch-docbook-xml ch-libxslt \ |
|---|
| 280 |
ch-docbook-xsl ch-html_tidy ch-LFS-BOOK ch-openssh ch-glib2 ch-cvs \ |
|---|
| 281 |
ch-popt ch-samba ch-irssi ch-wireless_tools ch-tcpwrappers ch-portmap \ |
|---|
| 282 |
ch-nfs-utils ch-traceroute ch-rsync ch-jhalfs ch-sudo ch-dialog ch-ncftp \ |
|---|
| 283 |
ch-pciutils ch-device-mapper ch-LVM2 ch-dmraid \ |
|---|
| 284 |
ch-dhcpcd ch-distcc ch-ppp ch-rp-pppoe ch-libaal ch-reiser4progs \ |
|---|
| 285 |
ch-cpio ch-mutt ch-msmtp ch-tin ch-mdadm ch-which ch-BRLTTY \ |
|---|
| 286 |
ch-strace ch-iptables ch-eject ch-hdparm ch-linux \ |
|---|
| 287 |
ch-initramfs ch-cdrtools ch-zisofs-tools ch-blfs-bootscripts \ |
|---|
| 288 |
ch-man-fr ch-man-pages-es ch-man-pages-it ch-manpages-de ch-manpages-ru \ |
|---|
| 289 |
ch-bin86 ch-lilo ch-syslinux |
|---|
| 290 |
ifeq ($(LFS-ARCH),ppc) |
|---|
| 291 |
make ch-yaboot |
|---|
| 292 |
make ch-hfsutils |
|---|
| 293 |
make ch-parted |
|---|
| 294 |
make ch-mac-fdisk |
|---|
| 295 |
endif |
|---|
| 296 |
|
|---|
| 297 |
wget-list: |
|---|
| 298 |
@>wget-list ; \ |
|---|
| 299 |
for DIR in packages/* ; do \ |
|---|
| 300 |
make -C $${DIR} wget-list-entry || echo Never mind. ; \ |
|---|
| 301 |
done ; \ |
|---|
| 302 |
sed -i '/^$$/d' wget-list |
|---|
| 303 |
|
|---|
| 304 |
# Targets for building packages individually. Useful for troubleshooting. |
|---|
| 305 |
# These do not generally get used as part of the script. They're for manual |
|---|
| 306 |
# use only ie, 'make [target]' |
|---|
| 307 |
#============================================================================== |
|---|
| 308 |
|
|---|
| 309 |
# The following takes the form 'make lfs-[package name]-only' |
|---|
| 310 |
lfs-%-only: lfsuser |
|---|
| 311 |
@su - lfs -c "$(lfsenv) '$(lfsbash) && $(MAKE) lfs-$*-scpt'" |
|---|
| 312 |
|
|---|
| 313 |
# The following two take the form 'make lfs-[package name]-only-pass#' |
|---|
| 314 |
lfs-%-only-pass1: lfsuser |
|---|
| 315 |
@su - lfs -c "$(lfsenv) '$(lfsbash) && $(MAKE) lfs-$*-pass1'" |
|---|
| 316 |
|
|---|
| 317 |
lfs-%-only-pass2: lfsuser |
|---|
| 318 |
@su - lfs -c "$(lfsenv) '$(lfsbash) && $(MAKE) lfs-$*-pass2'" |
|---|
| 319 |
|
|---|
| 320 |
# The following takes the form 'make [package name]-only-ch' |
|---|
| 321 |
%-only-ch: $(MKTREE) |
|---|
| 322 |
make -C $(PKG)/$* chroot |
|---|
| 323 |
|
|---|
| 324 |
gvim: $(MKTREE) |
|---|
| 325 |
make -C $(PKG)/vim chroot3 |
|---|
| 326 |
|
|---|
| 327 |
# The following takes the form 'make [package name]-clean' |
|---|
| 328 |
# Cleans the build directory of a single package. |
|---|
| 329 |
|
|---|
| 330 |
%-clean: |
|---|
| 331 |
make -C $(PKG)/$* clean |
|---|
| 332 |
|
|---|
| 333 |
# The targets below can be called manually, but are also used by the |
|---|
| 334 |
# scripts internally. |
|---|
| 335 |
#============================================================================== |
|---|
| 336 |
|
|---|
| 337 |
createfiles: |
|---|
| 338 |
@-$(WD)/bin/ln -s $(WD)/bin/{bash,cat,pwd,stty} /bin |
|---|
| 339 |
@-$(WD)/bin/ln -s $(WD)/bin/perl /usr/bin |
|---|
| 340 |
@-$(WD)/bin/ln -s $(WD)/lib/libgcc_s.so{,.1} /usr/lib |
|---|
| 341 |
@-$(WD)/bin/ln -s bash /bin/sh |
|---|
| 342 |
@touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} |
|---|
| 343 |
@chgrp utmp /var/run/utmp /var/log/lastlog |
|---|
| 344 |
@chmod 664 /var/run/utmp /var/log/lastlog |
|---|
| 345 |
@cp $(WD)/etc/resolv.conf /etc |
|---|
| 346 |
|
|---|
| 347 |
# Do not call the targets below manually! They are used internally and must be |
|---|
| 348 |
# called by other targets. |
|---|
| 349 |
#============================================================================== |
|---|
| 350 |
|
|---|
| 351 |
lfs-%-scpt: |
|---|
| 352 |
$(MAKE) -C $(PKG)/$* stage1 |
|---|
| 353 |
|
|---|
| 354 |
lfs-%-pass1: |
|---|
| 355 |
$(MAKE) -C $(PKG)/$* pass1 |
|---|
| 356 |
|
|---|
| 357 |
lfs-%-pass2: |
|---|
| 358 |
$(MAKE) -C $(PKG)/$* pass2 |
|---|
| 359 |
|
|---|
| 360 |
lfs-adjust-toolchain: |
|---|
| 361 |
$(MAKE) -C $(PKG)/binutils adjust-toolchain |
|---|
| 362 |
|
|---|
| 363 |
ch-%: |
|---|
| 364 |
make -C $(PKG)/$* stage2 |
|---|
| 365 |
|
|---|
| 366 |
re-adjust-toolchain: |
|---|
| 367 |
make -C $(PKG)/binutils re-adjust-toolchain |
|---|
| 368 |
|
|---|
| 369 |
final-environment: |
|---|
| 370 |
@cp -ra $(ROOT)/etc/sysconfig /etc |
|---|
| 371 |
@rm -rf /etc/sysconfig/.svn |
|---|
| 372 |
@-cp $(ROOT)/etc/inputrc /etc |
|---|
| 373 |
@-cp $(ROOT)/etc/bashrc /etc |
|---|
| 374 |
@-cp $(ROOT)/etc/profile /etc |
|---|
| 375 |
@-dircolors -p > /etc/dircolors |
|---|
| 376 |
@-cp $(ROOT)/etc/hosts /etc |
|---|
| 377 |
@-cp $(ROOT)/etc/fstab /etc |
|---|
| 378 |
|
|---|
| 379 |
update-caches: |
|---|
| 380 |
cd /usr/share/fonts ; mkfontscale ; mkfontdir ; fc-cache -f |
|---|
| 381 |
mandb -c 2>/dev/null |
|---|
| 382 |
echo 'dummy / ext2 defaults 0 0' >/etc/mtab |
|---|
| 383 |
updatedb --prunepaths='/sources /tools /lfs-livecd /proc /sys /dev /tmp /var/tmp' |
|---|
| 384 |
echo >/etc/mtab |
|---|
| 385 |
|
|---|
| 386 |
chroot-gvim: |
|---|
| 387 |
make -C $(PKG)/vim stage3 |
|---|
| 388 |
|
|---|
| 389 |
# Targets to create the iso |
|---|
| 390 |
#============================================================================== |
|---|
| 391 |
|
|---|
| 392 |
prepiso: $(MKTREE) |
|---|
| 393 |
@-rm $(MP)/root/.bash_history |
|---|
| 394 |
@-rm $(MP)/etc/resolv.conf |
|---|
| 395 |
@>$(MP)/var/log/btmp |
|---|
| 396 |
@>$(MP)/var/log/wtmp |
|---|
| 397 |
@>$(MP)/var/log/lastlog |
|---|
| 398 |
ifeq ($(LFS-ARCH),x86) |
|---|
| 399 |
@install -m644 isolinux/{isolinux.cfg,*.msg,splash.lss} $(MP)/boot/isolinux |
|---|
| 400 |
@sed -i "s/Version:/Version: $(VERSION)/" $(MP)/boot/isolinux/boot.msg |
|---|
| 401 |
endif |
|---|
| 402 |
@sed -i "s/Version:/Version: $(VERSION)/" $(MP)/etc/issue |
|---|
| 403 |
@install -m644 doc/README $(MP)/root/README |
|---|
| 404 |
@sed -i "s/\[version\]/$(VERSION)/" $(MP)/root/README |
|---|
| 405 |
@install -m600 root/.bashrc $(MP)/root/.bashrc |
|---|
| 406 |
@install -m755 scripts/{net-setup,greeting,livecd-login,ll} $(MP)/usr/bin/ |
|---|
| 407 |
@sed 's|_LINKER_|$(LINKER)|' scripts/shutdown-helper > $(MP)/usr/bin/shutdown-helper |
|---|
| 408 |
@chmod 755 $(MP)/usr/bin/shutdown-helper |
|---|
| 409 |
@cp -ra root $(MP)/etc/skel |
|---|
| 410 |
|
|---|
| 411 |
iso: prepiso |
|---|
| 412 |
@make unmount |
|---|
| 413 |
@sync |
|---|
| 414 |
@$(WD)/bin/mkzftree -F root.ext2 $(MPBASE)/iso/root.ext2 |
|---|
| 415 |
ifeq ($(LFS-ARCH),x86) |
|---|
| 416 |
@cd $(MPBASE)/iso ; $(WD)/bin/mkisofs -z -R -l --allow-leading-dots -D -o \ |
|---|
| 417 |
$(MPBASE)$(ROOT)/lfslivecd-$(VERSION).iso -b boot/isolinux/isolinux.bin \ |
|---|
| 418 |
-c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ |
|---|
| 419 |
-V "lfslivecd-$(VERSION)" ./ |
|---|
| 420 |
endif |
|---|
| 421 |
ifeq ($(LFS-ARCH),ppc) |
|---|
| 422 |
@cd $(MPBASE) ; $(WD)/bin/mkisofs -z -hfs -part -l --allow-leading-dots \ |
|---|
| 423 |
-map $(MPBASE)/$(ROOT)/$(PKG)/yaboot/map.hfs -no-desktop \ |
|---|
| 424 |
-hfs-volid "lfslivecd-$(VERSION)" -V "lfslivecd-$(VERSION)" \ |
|---|
| 425 |
-hfs-bless iso/boot -r -v -o $(MPBASE)$(ROOT)/lfslivecd-$(VERSION).iso iso \ |
|---|
| 426 |
>$(MPBASE)$(ROOT)/iso.log 2>&1 |
|---|
| 427 |
@if ! grep -q "Blessing" $(MPBASE)$(ROOT)/iso.log ; then \ |
|---|
| 428 |
echo "Iso incorrectly made! Boot directory not blessed." ; fi |
|---|
| 429 |
endif |
|---|
| 430 |
|
|---|
| 431 |
# Targets to clean your tree. |
|---|
| 432 |
#============================================================================== |
|---|
| 433 |
|
|---|
| 434 |
clean: unmount |
|---|
| 435 |
@-rm -rf $(WD) $(MPBASE)$(WD) |
|---|
| 436 |
@-userdel lfs |
|---|
| 437 |
@-groupdel lfs |
|---|
| 438 |
@-rm -rf /home/lfs |
|---|
| 439 |
@-rm {prepiso,lfsuser,lfs-base,extend-lfs,pre-wget} |
|---|
| 440 |
@-rm $(PKG)/binutils/{,re-}adjust-toolchain |
|---|
| 441 |
@-for i in `ls $(PKG)` ; do $(MAKE) -C $(PKG)/$$i clean ; done |
|---|
| 442 |
@find $(PKG) -name "pass*" -exec rm -rf \{} \; |
|---|
| 443 |
@find $(PKG) -name "stage*" -exec rm -rf \{} \; |
|---|
| 444 |
@find $(PKG) -name "*.log" -exec rm -rf \{} \; |
|---|
| 445 |
@echo find $(PKG)/binutils/* ! -path '$(PKG)/binutils/vars*' -xtype d -exec rm -rf \{} \; |
|---|
| 446 |
@rm -f $(PKG)/wget/prebuild |
|---|
| 447 |
@rm -f $(PKG)/binutils/{a.out,dummy.c,.spectest} |
|---|
| 448 |
@-rm -f $(SRC) $(ROOT) $(LFSSRC) |
|---|
| 449 |
|
|---|
| 450 |
scrub: clean |
|---|
| 451 |
@-rm root.ext2 |
|---|
| 452 |
@-rm lfslivecd-$(VERSION).iso |
|---|
| 453 |
|
|---|
| 454 |
clean_sources: |
|---|
| 455 |
@-rm $(SRC) ; rm -rf $(LFSSRC) $(MP)$(LFSSRC) |
|---|
| 456 |
@find packages/* -xtype l -exec rm -f \{} \; |
|---|
| 457 |
|
|---|
| 458 |
mount: $(MKTREE) |
|---|
| 459 |
|
|---|
| 460 |
unmount: |
|---|
| 461 |
-umount $(MP)/dev/shm |
|---|
| 462 |
-umount $(MP)/dev/pts |
|---|
| 463 |
-umount $(MP)/proc |
|---|
| 464 |
-umount $(MP)/sys |
|---|
| 465 |
-umount $(MP)/boot |
|---|
| 466 |
-umount $(MP)$(SRC) |
|---|
| 467 |
-umount $(MP)$(WD) |
|---|
| 468 |
-umount $(MP)$(ROOT) |
|---|
| 469 |
-rmdir $(MP)$(SRC) $(MP)$(WD) $(MP)$(ROOT) |
|---|
| 470 |
-rmdir $(MP)/boot |
|---|
| 471 |
-ln -s /dev/shm/.cdrom/boot $(MP) |
|---|
| 472 |
-umount $(MP) |
|---|
| 473 |
|
|---|
| 474 |
zeroes: $(MKTREE) |
|---|
| 475 |
-dd if=/dev/zero of=$(MP)/zeroes |
|---|
| 476 |
-rm $(MP)/zeroes |
|---|
| 477 |
-make unmount |
|---|
| 478 |
|
|---|
| 479 |
.PHONY: mount unmount clean_sources scrub clean iso chroot-gvim update-caches \ |
|---|
| 480 |
final-environment re-adjust-toolchain ch-% ch-glibc-32 lfs-adjust-toolchain \ |
|---|
| 481 |
lfs-%-scpt lfs-%-scpt-32 lfs-%-pass1 lfs-%-pass2 createfiles \ |
|---|
| 482 |
gvim %-only-ch lfs-%-only lfs-%-only-pass1 lfs-%-only-pass2 lfs-wget \ |
|---|
| 483 |
lfs-rm-wget blfs post-bash pre-bash tools pre-which zeroes |
|---|