]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - release/Makefile
Reduce the disc1.iso image size by setting WITHOUT_CLANG=1 for the
[FreeBSD/releng/9.2.git] / release / Makefile
1 # $FreeBSD$
2 #
3 # Makefile for building releases and release media.
4
5 # User-driven targets:
6 #  cdrom: Builds release CD-ROM media (disc1.iso)
7 #  memstick: Builds memory stick image (memstick.img)
8 #  ftp: Sets up FTP distribution area (ftp)
9 #  release: Build all media and FTP distribution area
10 #  install: Copies all release media into ${DESTDIR}
11 #
12 # Variables affecting the build process:
13 #  WORLDDIR: location of src tree -- must have built world and default kernel
14 #            (by default, the directory above this one) 
15 #  PORTSDIR: location of ports tree to distribute (default: /usr/ports)
16 #  DOCDIR:   location of doc tree (default: /usr/doc)
17 #  NOPORTS:  if set, do not distribute ports tree
18 #  NOSRC:    if set, do not distribute source tree
19 #  NODOC:    if set, do not generate release documentation
20 #  TARGET/TARGET_ARCH: architecture of built release 
21 #
22
23 WORLDDIR?=      ${.CURDIR}/..
24 PORTSDIR?=      /usr/ports
25 DOCDIR?=        /usr/doc
26 RELNOTES_LANG?= en_US.ISO8859-1
27
28 TARGET?=        ${MACHINE}
29 .if ${TARGET} == ${MACHINE}
30 TARGET_ARCH?=   ${MACHINE_ARCH}
31 .else
32 TARGET_ARCH?=   ${TARGET}
33 .endif
34 IMAKE=          ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
35 DISTDIR=        dist
36
37 # Define OSRELEASE by using newvars.sh
38 .if !defined(OSRELEASE) || empty(OSRELEASE)
39 .for _V in TYPE BRANCH REVISION
40 ${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
41 .endfor
42 .for _V in ${TARGET_ARCH}
43 .if !empty(TARGET:M${_V})
44 OSRELEASE=      ${TYPE}-${REVISION}-${BRANCH}-${TARGET}
45 .else
46 OSRELEASE=      ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
47 .endif
48 .endfor
49 .endif
50
51 .if !exists(${DOCDIR})
52 NODOC= true
53 .endif
54 .if !exists(${PORTSDIR})
55 NOPORTS= true
56 .endif
57
58 EXTRA_PACKAGES= 
59 .if !defined(NOPORTS)
60 EXTRA_PACKAGES+= ports.txz
61 .endif
62 .if !defined(NOSRC)
63 EXTRA_PACKAGES+= src.txz
64 .endif
65 .if !defined(NODOC)
66 EXTRA_PACKAGES+= reldoc
67 .endif
68
69 RELEASE_TARGETS= ftp
70 IMAGES=
71 .if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
72 RELEASE_TARGETS+= cdrom
73 IMAGES+=        disc1.iso bootonly.iso
74 .endif
75 .if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
76 RELEASE_TARGETS+= memstick.img
77 IMAGES+=        memstick.img
78 .endif
79
80 .include <bsd.obj.mk>
81
82 base.txz:
83         mkdir -p ${DISTDIR}
84         cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR}
85 # Set up mergemaster root database
86         sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
87             "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base"
88 # Package all components
89         cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
90         mv ${DISTDIR}/*.txz .
91
92 kernel.txz:
93         mkdir -p ${DISTDIR}
94         cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
95         mv ${DISTDIR}/kernel*.txz .
96
97 src.txz:
98         mkdir -p ${DISTDIR}/usr
99         ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
100         cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
101             --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src
102
103 ports.txz:
104         mkdir -p ${DISTDIR}/usr
105         ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
106         cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
107             --exclude CVS --exclude .svn \
108             --exclude usr/ports/distfiles --exclude usr/ports/packages \
109             --exclude 'usr/ports/INDEX*' --exclude work usr/ports
110
111 reldoc:
112         cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
113             INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
114         mkdir -p reldoc
115 .for i in hardware readme relnotes errata
116         ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:U}.TXT
117         ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:U}.HTM
118 .endfor
119         cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
120
121 system: packagesystem
122 # Install system
123         mkdir -p release
124         cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
125             DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1 \
126                 WITHOUT_CLANG=1
127 # Copy distfiles
128         mkdir -p release/usr/freebsd-dist
129         cp *.txz MANIFEST release/usr/freebsd-dist
130 # Copy documentation, if generated
131 .if !defined(NODOC)
132         cp reldoc/* release
133 .endif
134 # Set up installation environment
135         ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
136         echo sendmail_enable=\"NONE\" > release/etc/rc.conf
137         echo hostid_enable=\"NO\" >> release/etc/rc.conf
138         cp ${.CURDIR}/rc.local release/etc
139         touch ${.TARGET}
140
141 bootonly: packagesystem
142 # Install system
143         mkdir -p bootonly
144         cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
145             DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
146             WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \
147             WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
148             WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
149             WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
150             WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
151             WITHOUT_KERNEL_SYMBOLS=1
152 # Copy manifest only (no distfiles) to get checksums
153         mkdir -p bootonly/usr/freebsd-dist
154         cp MANIFEST bootonly/usr/freebsd-dist
155 # Copy documentation, if generated
156 .if !defined(NODOC)
157         cp reldoc/* bootonly
158 .endif
159 # Set up installation environment
160         ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
161         echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
162         echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
163         cp ${.CURDIR}/rc.local bootonly/etc
164
165 release/cdrom.inf: system
166         echo "CD_VERSION = ${REVISION}-${BRANCH}" > ${.TARGET}
167         echo "CD_VOLUME = 1" >> ${.TARGET}
168
169 release.iso: disc1.iso
170 disc1.iso: system release/cdrom.inf
171         sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release
172
173 bootonly/cdrom.inf: bootonly
174         echo "CD_VERSION = ${REVISION}-${BRANCH}" > ${.TARGET}
175         echo "CD_VOLUME = 1" >> ${.TARGET}
176
177 bootonly.iso: bootonly bootonly/cdrom.inf
178         sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
179
180 memstick: memstick.img
181 memstick.img: system
182         sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
183
184 packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
185         sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
186         touch ${.TARGET}
187
188 cdrom: disc1.iso bootonly.iso
189 ftp: packagesystem
190         rm -rf ftp
191         mkdir -p ftp
192         cp *.txz MANIFEST ftp
193
194 release:
195         ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
196         ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
197
198 clean:
199         chflags -R noschg .
200         rm -rf dist ftp
201         rm -f packagesystem
202         rm -f *.txz MANIFEST
203         rm -f system
204         rm -rf release bootonly
205         rm -f disc1.iso bootonly.iso memstick.img
206
207 install:
208 .if defined(DESTDIR) && !empty(DESTDIR)
209         mkdir -p ${DESTDIR}
210 .endif
211         cp -a ftp ${DESTDIR}/
212 .for I in ${IMAGES}
213         cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
214 .endfor
215         cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
216         cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5