Clean up some register keyword usage.
[dragonfly.git] / nrelease / Makefile
CommitLineData
dce74944 1# $DragonFly: src/nrelease/Makefile,v 1.31 2005/04/10 20:27:32 drhodus Exp $
6ca9a59c 2#
5b22b655 3
6ca9a59c
MD
4ISODIR ?= /usr/release
5ISOFILE ?= ${ISODIR}/dfly.iso
6ISOROOT = ${ISODIR}/root
7OBJSYS= ${.OBJDIR}/../sys
8KERNCONF ?= GENERIC
9
8188de86
MD
10# Specify which packages are required on the ISO, and let the user
11# specify additional packages to include. During the `pkgaddiso'
12# target, the packages are obtained from PACKAGES_LOC.
13#
3b4d7f2d 14REQ_PACKAGES= cdrtools-2.01 cvsup-without-gui-16.1h
bf9b513b
JS
15REL_PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16.if defined(PACKAGES)
17PACKAGES_LOC?= ${PACKAGES}/All
18.else
8188de86 19PACKAGES_LOC?= /usr/ports/packages/All
bf9b513b 20.endif
8188de86
MD
21
22# Specify which root skeletons are required, and let the user include
23# their own. They are copied into ISODIR during the `pkgcustomizeiso'
24# target; each overwrites the last.
25#
26REQ_ROOTSKELS= ${.CURDIR}/root
27ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
28
5b22b655
MD
29# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
30# the additional '/nrelease' manually, as a safety measure.
31#
32NRLOBJDIR?= /usr/obj
33
acc392b5
JS
34WORLD_CCVER ?= ${CCVER}
35KERNEL_CCVER ?= ${CCVER}
36
8188de86
MD
37#########################################################################
38# BASE ISO TARGETS #
39#########################################################################
40
41release: check clean buildworld1 buildkernel1 \
8398ca17 42 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
43
44quickrel: check clean buildworld2 buildkernel2 \
8398ca17 45 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
46
47realquickrel: check clean \
8398ca17 48 buildiso customizeiso pkgaddiso mklocatedb mkiso
6ca9a59c 49
dce74944
DR
50livecd: check_mkisofs clean buildiso mkiso
51
8188de86
MD
52#########################################################################
53# ISO TARGETS WITH INSTALLER #
54#########################################################################
6ca9a59c 55
e94931c5
MD
56INSTALLER_PKGS= libaura-3.1 libdfui-4.1 libinstaller-5.1 \
57 dfuibe_installer-1.1.6 dfuife_curses-1.5 \
58 thttpd-notimeout-2.24 dfuife_cgi-1.4
8188de86
MD
59INSTALLER_SKELS= installer
60
10dd2a9b
CP
61INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
62 EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
8188de86
MD
63
64installer_check:
65 @${INSTALLER_ENV} ${MAKE} check
66
2e3f8f38
MD
67installer_fetchpkgs:
68 @${INSTALLER_ENV} ${MAKE} fetchpkgs
69
8188de86
MD
70installer_release:
71 ${INSTALLER_ENV} ${MAKE} release
72
73installer_quickrel:
74 ${INSTALLER_ENV} ${MAKE} quickrel
75
76installer_realquickrel:
77 ${INSTALLER_ENV} ${MAKE} realquickrel
78
79#########################################################################
80# HELPER TARGETS #
81#########################################################################
6ca9a59c 82
dce74944
DR
83check: check_mkisofs check_installer
84
85check_mkisofs:
8188de86 86 @if [ ! -f /usr/local/bin/mkisofs ]; then \
755f2cbd
MD
87 echo "You need to install the sysutils/cdrtools port for"; \
88 echo "this target"; \
8188de86
MD
89 exit 1; \
90 fi
dce74944
DR
91
92check_installer:
bf9b513b 93.for PKG in ${REL_PACKAGES}
8188de86
MD
94 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
95 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz. This is"; \
96 echo "typically accomplished by cd'ing into the appropriate"; \
7ac6de67 97 echo "port and typing 'make installer_fetchpkgs'"; \
8188de86
MD
98 echo ""; \
99 echo "If you are trying to build the installer, the"; \
100 echo "required packages can be obtained from:"; \
a0ecab1b 101 echo "http://www.bsdinstaller.org/packages/"; \
8188de86
MD
102 exit 1; \
103 fi
104.endfor
105 @echo "check: all preqs found"
6ca9a59c 106
2e3f8f38 107fetchpkgs:
bf9b513b 108.for PKG in ${REL_PACKAGES}
2e3f8f38
MD
109 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
110 cd ${PACKAGES_LOC} && \
111 echo "fetching ${PKG}..." && \
112 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \
113 fi
114.endfor
115
6ca9a59c 116buildworld1:
c3f3fe6d 117 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
118
119buildworld2:
c3f3fe6d 120 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make -DNOTOOLS -DNOCLEAN buildworld )
6ca9a59c
MD
121
122buildkernel1:
c3f3fe6d 123 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
124
125buildkernel2:
c3f3fe6d 126 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} )
6ca9a59c 127
5b22b655
MD
128# note that we do not want to mess with any /usr/obj directories not related
129# to buildworld, buildkernel, or nrelease, so we must supply the proper
130# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
131# buildkernel mechanism.
132#
6ca9a59c
MD
133buildiso:
134 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 135 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 136 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
5b22b655 137 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution )
21aa02d0 138 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
139 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
140 installkernel KERNCONF=${KERNCONF} )
26ef3385 141 ln -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
142 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
143 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
144 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
145
146customizeiso:
147.for ROOTSKEL in ${ROOTSKELS}
148 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
149.endfor
150 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 151 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 152 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
153
154pkgcleaniso:
155 rm -f ${ISOROOT}/tmp/chrootscript
156 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 157.for PKG in ${REL_PACKAGES}
8188de86
MD
158 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
159.endfor
160 chmod a+x ${ISOROOT}/tmp/chrootscript
161 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
162 rm ${ISOROOT}/tmp/chrootscript
163
164pkgaddiso:
165 rm -f ${ISOROOT}/tmp/chrootscript
166 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 167.for PKG in ${REL_PACKAGES}
8188de86
MD
168 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz
169 echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript
170 echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript
171.endfor
172 chmod a+x ${ISOROOT}/tmp/chrootscript
173 chroot ${ISOROOT}/ /tmp/chrootscript
174 rm ${ISOROOT}/tmp/chrootscript
bf9b513b 175.for PKG in ${REL_PACKAGES}
8188de86
MD
176 rm -f ${ISOROOT}/tmp/${PKG}.tgz
177.endfor
6ca9a59c 178
8398ca17
SW
179mklocatedb:
180 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
181 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
182 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
183 /usr/libexec/locate.mklocatedb \
184 -presort >${ISOROOT}/var/db/locate.database )
185
6ca9a59c
MD
186mkiso:
187 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 188 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
189
190clean:
191 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 192 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 193 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
194
195realclean: clean
3ebedc5e 196 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
197
198.include <bsd.prog.mk>