Add an UPDATING entry and warning about the change in r274807 to help users
[freebsd-src.git] / release / Makefile
blob6d9b5e2639d691534b0c6d185c944f1fbf7740ed
1 # $FreeBSD$
3 # Makefile for building releases and release media.
5 # User-driven targets:
6 # cdrom: Builds release CD-ROM media (disc1.iso)
7 # dvdrom: Builds release DVD-ROM media (dvd1.iso)
8 # memstick: Builds memory stick image (memstick.img)
9 # mini-memstick: Builds minimal memory stick image (mini-memstick.img)
10 # ftp: Sets up FTP distribution area (ftp)
11 # release: Build all media and FTP distribution area
12 # install: Copies all release media into ${DESTDIR}
14 # Variables affecting the build process:
15 # WORLDDIR: location of src tree -- must have built world and default kernel
16 # (by default, the directory above this one)
17 # PORTSDIR: location of ports tree to distribute (default: /usr/ports)
18 # DOCDIR: location of doc tree (default: /usr/doc)
19 # NOPKG: if set, do not distribute third-party packages
20 # NOPORTS: if set, do not distribute ports tree
21 # NOSRC: if set, do not distribute source tree
22 # NODOC: if set, do not generate release documentation
23 # WITH_DVD: if set, generate dvd1.iso
24 # WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1)
25 # (uncompressed images are not removed)
26 # WITH_VMIMAGES: if set, build virtual machine images with the release
27 # WITH_COMPRESSED_VMIMAGES: if set, compress virtual machine disk images
28 # with xz(1) (extremely time consuming)
29 # TARGET/TARGET_ARCH: architecture of built release
32 WORLDDIR?= ${.CURDIR}/..
33 PORTSDIR?= /usr/ports
34 DOCDIR?= /usr/doc
35 RELNOTES_LANG?= en_US.ISO8859-1
36 XZCMD?= /usr/bin/xz
38 .if !defined(TARGET) || empty(TARGET)
39 TARGET= ${MACHINE}
40 .endif
41 .if !defined(TARGET_ARCH) || empty(TARGET_ARCH)
42 .if ${TARGET} == ${MACHINE}
43 TARGET_ARCH= ${MACHINE_ARCH}
44 .else
45 TARGET_ARCH= ${TARGET}
46 .endif
47 .endif
48 IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
49 DISTDIR= dist
51 # Define OSRELEASE by using newvars.sh
52 .if !defined(OSRELEASE) || empty(OSRELEASE)
53 .for _V in TYPE BRANCH REVISION
54 ${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
55 .endfor
56 .for _V in ${TARGET_ARCH}
57 .if !empty(TARGET:M${_V})
58 OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}
59 VOLUME_LABEL= ${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET}
60 .else
61 OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
62 VOLUME_LABEL= ${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET_ARCH}
63 .endif
64 .endfor
65 .endif
67 .if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL)
68 VOLUME_LABEL= FreeBSD_Install
69 .endif
71 .if !exists(${DOCDIR})
72 NODOC= true
73 .endif
74 .if !exists(${PORTSDIR})
75 NOPORTS= true
76 .endif
78 EXTRA_PACKAGES=
79 .if !defined(NOPORTS)
80 EXTRA_PACKAGES+= ports.txz
81 .endif
82 .if !defined(NOSRC)
83 EXTRA_PACKAGES+= src.txz
84 .endif
85 .if !defined(NODOC)
86 EXTRA_PACKAGES+= reldoc
87 .endif
89 RELEASE_TARGETS= ftp
90 IMAGES=
91 .if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
92 RELEASE_TARGETS+= cdrom
93 IMAGES+= disc1.iso bootonly.iso
94 . if defined(WITH_DVD) && !empty(WITH_DVD)
95 RELEASE_TARGETS+= dvdrom
96 IMAGES+= dvd1.iso
97 . endif
98 .endif
99 .if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
100 RELEASE_TARGETS+= memstick.img
101 RELEASE_TARGETS+= mini-memstick.img
102 IMAGES+= memstick.img
103 IMAGES+= mini-memstick.img
104 .endif
106 VMTARGETS= vm-base vm-image
107 VMFORMATS?= vhd vmdk qcow2 raw
108 VMSIZE?= 20G
109 VMBASE?= vm
110 AZURECONF?= ${.CURDIR}/tools/azure.conf
112 CLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES}
113 .if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES)
114 . for I in ${IMAGES}
115 CLEANFILES+= ${I}.xz
116 . endfor
117 .endif
118 .if defined(WITH_DVD) && !empty(WITH_DVD)
119 CLEANFILES+= pkg-stage
120 .endif
121 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
122 CLEANFILES+= ${VMBASE}.img
123 . for FORMAT in ${VMFORMATS}
124 CLEANFILES+= ${VMBASE}.${FORMAT}
125 . endfor
126 .endif
127 CLEANDIRS= dist ftp release bootonly dvd
128 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
129 CLEANDIRS+= ${VMTARGETS}
130 .endif
131 .if exists(${.CURDIR}/${TARGET}/mk-azure.sh)
132 CLEANFILES+= ${OSRELEASE}.vhd \
133 ${OSRELEASE}.vhd.raw \
134 azure.img
135 CLEANDIRS+= vm-azure
136 .endif
137 beforeclean:
138 chflags -R noschg .
139 .include <bsd.obj.mk>
140 clean: beforeclean
142 base.txz:
143 mkdir -p ${DISTDIR}
144 cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR}
145 # Set up mergemaster root database
146 sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
147 "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base"
148 etcupdate extract -B -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \
149 -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate"
150 # Package all components
151 cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
152 mv ${DISTDIR}/*.txz .
154 kernel.txz:
155 mkdir -p ${DISTDIR}
156 cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
157 mv ${DISTDIR}/kernel*.txz .
159 src.txz:
160 mkdir -p ${DISTDIR}/usr
161 ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
162 cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
163 --exclude .git --exclude @ --exclude usr/src/release/dist usr/src
165 ports.txz:
166 mkdir -p ${DISTDIR}/usr
167 ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
168 cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
169 --exclude .git --exclude .svn \
170 --exclude usr/ports/distfiles --exclude usr/ports/packages \
171 --exclude 'usr/ports/INDEX*' --exclude work usr/ports
173 reldoc:
174 cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
175 INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
176 mkdir -p reldoc
177 .for i in hardware readme relnotes errata
178 ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT
179 ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM
180 .endfor
181 cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
183 system: packagesystem
184 # Install system
185 mkdir -p release
186 cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
187 DESTDIR=${.OBJDIR}/release MK_RESCUE=no MK_KERNEL_SYMBOLS=no \
188 MK_PROFILE=no MK_SENDMAIL=no MK_TESTS=no MK_LIB32=no \
189 MK_DEBUG_FILES=no
190 # Copy distfiles
191 mkdir -p release/usr/freebsd-dist
192 for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \
193 do cp $${dist} release/usr/freebsd-dist; \
194 done
195 # Copy documentation, if generated
196 .if !defined(NODOC)
197 cp reldoc/* release
198 .endif
199 # Set up installation environment
200 ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
201 echo sendmail_enable=\"NONE\" > release/etc/rc.conf
202 echo hostid_enable=\"NO\" >> release/etc/rc.conf
203 echo debug.witness.trace=0 >> release/etc/sysctl.conf
204 cp ${.CURDIR}/rc.local release/etc
205 touch ${.TARGET}
207 bootonly: packagesystem
208 # Install system
209 mkdir -p bootonly
210 cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
211 DESTDIR=${.OBJDIR}/bootonly MK_AMD=no MK_AT=no \
212 MK_GAMES=no MK_GROFF=no \
213 MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \
214 MK_NCP=no MK_TOOLCHAIN=no MK_PROFILE=no \
215 MK_INSTALLIB=no MK_RESCUE=no MK_DICT=no \
216 MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no
217 # Copy manifest only (no distfiles) to get checksums
218 mkdir -p bootonly/usr/freebsd-dist
219 cp MANIFEST bootonly/usr/freebsd-dist
220 # Copy documentation, if generated
221 .if !defined(NODOC)
222 cp reldoc/* bootonly
223 .endif
224 # Set up installation environment
225 ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
226 echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
227 echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
228 echo debug.witness.trace=0 >> bootonly/etc/sysctl.conf
229 cp ${.CURDIR}/rc.local bootonly/etc
231 dvd:
232 # Install system
233 mkdir -p ${.TARGET}
234 cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
235 DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \
236 MK_TESTS=no MK_DEBUG_FILES=no
237 # Copy distfiles
238 mkdir -p ${.TARGET}/usr/freebsd-dist
239 for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \
240 do cp $${dist} ${.TARGET}/usr/freebsd-dist; \
241 done
242 # Copy documentation, if generated
243 .if !defined(NODOC)
244 cp reldoc/* ${.TARGET}
245 .endif
246 # Set up installation environment
247 ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
248 echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
249 echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
250 echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf
251 cp ${.CURDIR}/rc.local ${.TARGET}/etc
252 touch ${.TARGET}
254 release.iso: disc1.iso
255 disc1.iso: system
256 sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} release
258 dvd1.iso: dvd pkg-stage
259 sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd
261 bootonly.iso: bootonly
262 sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly
264 memstick: memstick.img
265 memstick.img: system
266 sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
268 mini-memstick: mini-memstick.img
269 mini-memstick.img: system
270 sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET}
272 packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
273 sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
274 touch ${.TARGET}
276 pkg-stage:
277 .if !defined(NOPKG)
278 env REPOS_DIR=${.CURDIR}/pkg_repos/ \
279 sh ${.CURDIR}/scripts/pkg-stage.sh
280 mkdir -p ${.OBJDIR}/dvd/packages/repos/
281 cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \
282 ${.OBJDIR}/dvd/packages/repos/
283 .endif
284 touch ${.TARGET}
286 cdrom: disc1.iso bootonly.iso
287 dvdrom: dvd1.iso
288 ftp: packagesystem
289 rm -rf ftp
290 mkdir -p ftp
291 cp *.txz MANIFEST ftp
293 release:
294 ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
295 ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
296 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
297 ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${VMTARGETS}
298 .endif
300 install:
301 .if defined(DESTDIR) && !empty(DESTDIR)
302 mkdir -p ${DESTDIR}
303 .endif
304 cp -a ftp ${DESTDIR}/
305 .for I in ${IMAGES}
306 cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
307 . if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES)
308 ${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I}
309 . endif
310 .endfor
311 cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
312 cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
313 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
314 mkdir -p ${DESTDIR}/vmimages
315 . for FORMAT in ${VMFORMATS}
316 cp -p ${VMBASE}.${FORMAT} \
317 ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
318 . endfor
319 . if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES)
320 # This is very time consuming, so defer it after the images are moved to
321 # the DESTDIR.
322 . for FORMAT in ${VMFORMATS}
323 # Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
324 ${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
325 . endfor
326 . endif
327 cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \
328 ${DESTDIR}/vmimages/CHECKSUM.SHA256
329 cd ${DESTDIR}/vmimages && md5 ${OSRELEASE}* > \
330 ${DESTDIR}/vmimages/CHECKSUM.MD5
331 .endif
333 vm-base:
334 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
335 . if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
336 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
337 ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \
338 ${VMBASE}.img ${WORLDDIR} ${.OBJDIR}/${.TARGET} ${VMSIZE}
339 . endif
340 .endif
341 touch ${.TARGET}
343 vm-image: vm-base
344 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
345 . if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh)
346 . for FORMAT in ${VMFORMATS}
347 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
348 ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \
349 ${VMBASE}.img ${FORMAT} ${VMBASE}.${FORMAT}
350 . endfor
351 . endif
352 .endif
353 touch ${.TARGET}
355 vm-azure:
356 .if exists(${.CURDIR}/${TARGET}/mk-azure.sh)
357 env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} AZURECONF=${AZURECONF} \
358 ${.CURDIR}/${TARGET}/mk-azure.sh ${.TARGET} azure.img \
359 ${WORLDDIR} ${.TARGET} ${VMSIZE} ${OSRELEASE}.vhd
360 .endif
361 touch ${.TARGET}