xref: /freebsd/release/Makefile (revision 9a14aa017b21c292740c00ee098195cd46642730)
1# $FreeBSD$
2#
3# Makefile for building releases and release media.
4#
5# User-driven targets:
6#  cdrom: Builds release CD-ROM media (release.iso)
7#  memstick: Builds memory stick image (memstick)
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
23WORLDDIR?=	${.CURDIR}/..
24PORTSDIR?=	/usr/ports
25DOCDIR?=	/usr/doc
26RELNOTES_LANG?= en_US.ISO8859-1
27
28TARGET?=	${MACHINE}
29.if ${TARGET} == ${MACHINE}
30TARGET_ARCH?=	${MACHINE_ARCH}
31.else
32TARGET_ARCH?=	${TARGET}
33.endif
34IMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
35DISTDIR=	${.OBJDIR}/dist
36
37.if !exists(${DOCDIR})
38NODOC= true
39.endif
40.if !exists(${PORTSDIR})
41NOPORTS= true
42.endif
43
44EXTRA_PACKAGES=
45.if !defined(NOPORTS)
46EXTRA_PACKAGES+= ports.txz
47.endif
48.if !defined(NOSRC)
49EXTRA_PACKAGES+= src.txz
50.endif
51.if !defined(NODOC)
52EXTRA_PACKAGES+= reldoc
53.endif
54
55RELEASE_TARGETS= ftp
56.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
57RELEASE_TARGETS+= cdrom
58.endif
59.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
60RELEASE_TARGETS+= memstick
61.endif
62
63.include <bsd.obj.mk>
64
65base.txz:
66	-mkdir ${DISTDIR}
67	cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${DISTDIR}
68# Set up mergemaster root database
69	sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \
70	    "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${DISTDIR}/base"
71# Package all components
72	cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${DISTDIR}
73	mv ${DISTDIR}/*.txz ${.OBJDIR}
74
75kernel.txz:
76	-mkdir ${DISTDIR}
77	cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${DISTDIR}
78	mv ${DISTDIR}/kernel*.txz ${.OBJDIR}
79
80src.txz:
81	-mkdir -p ${DISTDIR}/usr
82	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
83	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn \
84	    --exclude CVS usr/src
85
86ports.txz:
87	-mkdir -p ${DISTDIR}/usr
88	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
89	cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \
90	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
91	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports
92
93reldoc:
94	cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \
95	    INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc
96	-mkdir ${.OBJDIR}/reldoc
97.for i in hardware readme relnotes errata
98	ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.txt \
99	    ${.OBJDIR}/reldoc/${i:U}.TXT
100	ln -f ${.OBJDIR}/rdoc/${RELNOTES_LANG}/${i}/article.html \
101	    ${.OBJDIR}/reldoc/${i:U}.HTM
102.endfor
103	cp ${.OBJDIR}/rdoc/${RELNOTES_LANG}/readme/docbook.css ${.OBJDIR}/reldoc
104
105system: packagesystem
106# Install system
107	-mkdir ${.OBJDIR}/release
108	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
109	    DESTDIR=${.OBJDIR}/release WITHOUT_RESCUE=1 WITHOUT_KERNEL_SYMBOLS=1
110# Copy distfiles
111	mkdir ${.OBJDIR}/release/usr/freebsd-dist
112	cp ${.OBJDIR}/*.txz ${.OBJDIR}/MANIFEST \
113	    ${.OBJDIR}/release/usr/freebsd-dist
114# Copy documentation, if generated
115.if !defined(NODOC)
116	cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/release
117.endif
118# Set up installation environment
119	ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/release/etc/resolv.conf
120	echo sendmail_enable=\"NONE\" > ${.OBJDIR}/release/etc/rc.conf
121	echo hostid_enable=\"NO\" >> ${.OBJDIR}/release/etc/rc.conf
122	cp ${.CURDIR}/rc.local ${.OBJDIR}/release/etc
123	touch ${.OBJDIR}/${.TARGET}
124
125bootonly: packagesystem
126# Install system
127	mkdir ${.OBJDIR}/bootonly
128	cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \
129	    DESTDIR=${.OBJDIR}/bootonly WITHOUT_AMD=1 WITHOUT_AT=1 \
130	    WITHOUT_BIND_DNSSEC=1 WITHOUT_BIND_ETC=1 WITHOUT_BIND_MTREE=1 \
131	    WITHOUT_BIND_NAMED=1 WITHOUT_GAMES=1 WITHOUT_GROFF=1 \
132	    WITHOUT_INSTALLLIB=1 WITHOUT_LIB32=1 WITHOUT_MAIL=1 \
133	    WITHOUT_NCP=1 WITHOUT_TOOLCHAIN=1 WITHOUT_PROFILE=1 \
134	    WITHOUT_INSTALLIB=1 WITHOUT_RESCUE=1 WITHOUT_DICT=1 \
135	    WITHOUT_KERNEL_SYMBOLS=1
136# Copy manifest only (no distfiles) to get checksums
137	mkdir ${.OBJDIR}/bootonly/usr/freebsd-dist
138	cp ${.OBJDIR}/MANIFEST ${.OBJDIR}/bootonly/usr/freebsd-dist
139# Copy documentation, if generated
140.if !defined(NODOC)
141	cp ${.OBJDIR}/reldoc/* ${.OBJDIR}/bootonly
142.endif
143# Set up installation environment
144	ln -s /tmp/bsdinstall_etc/resolv.conf ${.OBJDIR}/bootonly/etc/resolv.conf
145	echo sendmail_enable=\"NONE\" > ${.OBJDIR}/bootonly/etc/rc.conf
146	echo hostid_enable=\"NO\" >> ${.OBJDIR}/bootonly/etc/rc.conf
147	cp ${.CURDIR}/rc.local ${.OBJDIR}/bootonly/etc
148
149release.iso: system
150	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/release.iso ${.OBJDIR}/release
151
152bootonly.iso: bootonly
153	sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.OBJDIR}/bootonly.iso ${.OBJDIR}/bootonly
154
155memstick: system
156	sh ${.CURDIR}/${TARGET}/make-memstick.sh ${.OBJDIR}/release ${.OBJDIR}/memstick
157
158packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
159	sh ${.CURDIR}/scripts/make-manifest.sh ${.OBJDIR}/*.txz > ${.OBJDIR}/MANIFEST
160	touch ${.TARGET}
161
162cdrom: release.iso bootonly.iso
163ftp: packagesystem
164	rm -rf ftp
165	mkdir ftp
166	cp *.txz MANIFEST ftp
167
168release:
169	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
170	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
171
172clean:
173	chflags -R noschg ${.OBJDIR}
174	rm -rf dist ftp
175	rm -f packagesystem
176	rm -f *.txz MANIFEST
177	rm -f system
178	rm -rf release bootonly
179	rm -f release.iso bootonly.iso memstick
180
181install:
182	-mkdir ${DESTDIR}
183	cp -a *.iso memstick ftp ${DESTDIR}/
184
185