]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - release/Makefile
MFC r258305, r258307, r258308, r258309, r258310, r258314, r258317,
[FreeBSD/stable/10.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 . if(!defined(NODVD))
75 RELEASE_TARGETS+= dvdrom
76 IMAGES+=        dvd1.iso
77 . endif
78 .endif
79 .if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
80 RELEASE_TARGETS+= memstick.img
81 IMAGES+=        memstick.img
82 .endif
83
84 .include <bsd.obj.mk>
85
86 base.txz:
87         mkdir -p ${DISTDIR}
88         cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR}
89 # Set up mergemaster root database
90         sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
91             "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base"
92 # Package all components
93         cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR}
94         mv ${DISTDIR}/*.txz .
95
96 kernel.txz:
97         mkdir -p ${DISTDIR}
98         cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR}
99         mv ${DISTDIR}/kernel*.txz .
100
101 src.txz:
102         mkdir -p ${DISTDIR}/usr
103         ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
104         cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \
105             --exclude CVS --exclude @ --exclude usr/src/release/dist usr/src
106
107 ports.txz:
108         mkdir -p ${DISTDIR}/usr
109         ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
110         cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
111             --exclude CVS --exclude .svn \
112             --exclude usr/ports/distfiles --exclude usr/ports/packages \
113             --exclude 'usr/ports/INDEX*' --exclude work usr/ports
114
115 reldoc:
116         cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
117             INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
118         mkdir -p reldoc
119 .for i in hardware readme relnotes errata
120         ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT
121         ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM
122 .endfor
123         cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc
124
125 system: packagesystem
126 # Install system
127         mkdir -p release
128         cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
129             DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
130 # Copy distfiles
131         mkdir -p release/usr/freebsd-dist
132         cp *.txz MANIFEST release/usr/freebsd-dist
133 # Copy documentation, if generated
134 .if !defined(NODOC)
135         cp reldoc/* release
136 .endif
137 # Set up installation environment
138         ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
139         echo sendmail_enable=\"NONE\" > release/etc/rc.conf
140         echo hostid_enable=\"NO\" >> release/etc/rc.conf
141         cp ${.CURDIR}/rc.local release/etc
142         touch ${.TARGET}
143
144 bootonly: packagesystem
145 # Install system
146         mkdir -p bootonly
147         cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
148             DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
149             WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
150             WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
151             WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
152             WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
153             WITHOUT_KERNEL_SYMBOLS=1
154 # Copy manifest only (no distfiles) to get checksums
155         mkdir -p bootonly/usr/freebsd-dist
156         cp MANIFEST bootonly/usr/freebsd-dist
157 # Copy documentation, if generated
158 .if !defined(NODOC)
159         cp reldoc/* bootonly
160 .endif
161 # Set up installation environment
162         ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
163         echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
164         echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
165         cp ${.CURDIR}/rc.local bootonly/etc
166
167 dvd:
168 # Install system
169         mkdir -p ${.TARGET}
170         cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
171                 DESTDIR=${.OBJDIR}/${.TARGET} WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
172 # Copy distfiles
173         mkdir -p ${.TARGET}/usr/freebsd-dist
174         cp *.txz MANIFEST ${.TARGET}/usr/freebsd-dist
175 # Copy documentation, if generated
176 .if !defined(NODOC)
177         cp reldoc/* ${.TARGET}
178 .endif
179 # Set up installation environment
180         ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
181         echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
182         echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
183         cp ${.CURDIR}/rc.local ${.TARGET}/etc
184         touch ${.TARGET}
185
186 release.iso: disc1.iso
187 disc1.iso: system
188         sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release
189
190 dvd1.iso: dvd pkg-stage
191         sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd
192
193 bootonly.iso: bootonly
194         sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly
195
196 memstick: memstick.img
197 memstick.img: system
198         sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET}
199
200 packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
201         sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST
202         touch ${.TARGET}
203
204 pkg-stage:
205 .if(exists(${.CURDIR}/${TARGET}/pkg-stage.conf))
206         sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \
207                 ${REVISION}
208 .endif
209
210 cdrom: disc1.iso bootonly.iso
211 dvdrom: dvd1.iso
212 ftp: packagesystem
213         rm -rf ftp
214         mkdir -p ftp
215         cp *.txz MANIFEST ftp
216
217 release:
218         ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
219         ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
220
221 clean:
222         chflags -R noschg .
223         rm -rf dist ftp
224         rm -f packagesystem
225         rm -f *.txz MANIFEST
226         rm -f system
227         rm -rf release bootonly dvd
228         rm -f ${IMAGES}
229
230 install:
231 .if defined(DESTDIR) && !empty(DESTDIR)
232         mkdir -p ${DESTDIR}
233 .endif
234         cp -a ftp ${DESTDIR}/
235 .for I in ${IMAGES}
236         cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
237 .endfor
238         cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
239         cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5