Make this WARNS?=6 clean by explicitly using __DECONST for the write
[dragonfly.git] / nrelease / Makefile
CommitLineData
a0ecab1b 1# $DragonFly: src/nrelease/Makefile,v 1.14 2004/07/16 21:33:16 dillon 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#
14REQ_PACKAGES= cdrtools-2.0.3_3 cvsup-without-gui-16.1h
15PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16PACKAGES_LOC?= /usr/ports/packages/All
17
18# Specify which root skeletons are required, and let the user include
19# their own. They are copied into ISODIR during the `pkgcustomizeiso'
20# target; each overwrites the last.
21#
22REQ_ROOTSKELS= ${.CURDIR}/root
23ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
24
5b22b655
MD
25# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
26# the additional '/nrelease' manually, as a safety measure.
27#
28NRLOBJDIR?= /usr/obj
29
acc392b5
JS
30WORLD_CCVER ?= ${CCVER}
31KERNEL_CCVER ?= ${CCVER}
32
8188de86
MD
33#########################################################################
34# BASE ISO TARGETS #
35#########################################################################
36
37release: check clean buildworld1 buildkernel1 \
38 buildiso customizeiso pkgaddiso mkiso
39
40quickrel: check clean buildworld2 buildkernel2 \
41 buildiso customizeiso pkgaddiso mkiso
42
43realquickrel: check clean \
44 buildiso customizeiso pkgaddiso mkiso
6ca9a59c 45
8188de86
MD
46#########################################################################
47# ISO TARGETS WITH INSTALLER #
48#########################################################################
6ca9a59c 49
59cdb3ba 50INSTALLER_PKGS= dfuibe_installer-1.0.1 dfuife_curses-1.0 libdfui-1.0 \
f14ef665 51 thttpd-notimeout-2.24 dfuife_cgi-1.0
8188de86
MD
52INSTALLER_SKELS= installer
53
54INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS}" \
55 EXTRA_ROOTSKELS="${INSTALLER_SKELS}"
56
57installer_check:
58 @${INSTALLER_ENV} ${MAKE} check
59
60installer_release:
61 ${INSTALLER_ENV} ${MAKE} release
62
63installer_quickrel:
64 ${INSTALLER_ENV} ${MAKE} quickrel
65
66installer_realquickrel:
67 ${INSTALLER_ENV} ${MAKE} realquickrel
68
69#########################################################################
70# HELPER TARGETS #
71#########################################################################
6ca9a59c 72
17d0fefe 73check:
8188de86 74 @if [ ! -f /usr/local/bin/mkisofs ]; then \
17d0fefe 75 echo "You need to install the mkisofs port for this target"; \
8188de86
MD
76 exit 1; \
77 fi
78.for PKG in ${PACKAGES}
79 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
80 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz. This is"; \
81 echo "typically accomplished by cd'ing into the appropriate"; \
82 echo "port and typing 'make package'"; \
83 echo ""; \
84 echo "If you are trying to build the installer, the"; \
85 echo "required packages can be obtained from:"; \
a0ecab1b 86 echo "http://www.bsdinstaller.org/packages/"; \
8188de86
MD
87 exit 1; \
88 fi
89.endfor
90 @echo "check: all preqs found"
6ca9a59c
MD
91
92buildworld1:
acc392b5 93 ( cd ${.CURDIR}/..; make buildworld CCVER=${WORLD_CCVER} )
6ca9a59c
MD
94
95buildworld2:
acc392b5 96 ( cd ${.CURDIR}/..; make -DNOTOOLS -DNOCLEAN buildworld CCVER=${WORLD_CCVER} )
6ca9a59c
MD
97
98buildkernel1:
acc392b5 99 ( cd ${.CURDIR}/..; make buildkernel KERNCONF=${KERNCONF} CCVER=${KERNEL_CCVER} )
6ca9a59c
MD
100
101buildkernel2:
acc392b5 102 ( cd ${.CURDIR}/..; make -DNOCLEAN buildkernel KERNCONF=${KERNCONF} CCVER=${KERNEL_CCVER} )
6ca9a59c 103
5b22b655
MD
104# note that we do not want to mess with any /usr/obj directories not related
105# to buildworld, buildkernel, or nrelease, so we must supply the proper
106# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
107# buildkernel mechanism.
108#
6ca9a59c
MD
109buildiso:
110 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 111 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 112 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
5b22b655 113 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution )
6ca9a59c
MD
114 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
115 installkernel KERNCONF=${KERNCONF} )
116 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
117 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
118 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
119
120customizeiso:
121.for ROOTSKEL in ${ROOTSKELS}
122 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
123.endfor
124 rm -rf `find ${ISOROOT} -type d -name CVS -print`
7249926b 125 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
126
127pkgcleaniso:
128 rm -f ${ISOROOT}/tmp/chrootscript
129 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
130.for PKG in ${PACKAGES}
131 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
132.endfor
133 chmod a+x ${ISOROOT}/tmp/chrootscript
134 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
135 rm ${ISOROOT}/tmp/chrootscript
136
137pkgaddiso:
138 rm -f ${ISOROOT}/tmp/chrootscript
139 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
140.for PKG in ${PACKAGES}
141 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz
142 echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript
143 echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript
144.endfor
145 chmod a+x ${ISOROOT}/tmp/chrootscript
146 chroot ${ISOROOT}/ /tmp/chrootscript
147 rm ${ISOROOT}/tmp/chrootscript
148.for PKG in ${PACKAGES}
149 rm -f ${ISOROOT}/tmp/${PKG}.tgz
150.endfor
6ca9a59c
MD
151
152mkiso:
153 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 154 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
155
156clean:
157 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 158 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 159 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
160
161realclean: clean
3ebedc5e 162 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
163
164.include <bsd.prog.mk>