6da86c1c69f1c517200ba61867beeba12238f8ff
[dragonfly.git] / nrelease / Makefile
1 #########################################################################
2 #                               ENHANCEMENTS                            #
3 #########################################################################
4
5 # New method e.g. 'make gui release'.  A series of enhancement
6 # targes may be specified which set make variables which enhance
7 # the build in various ways.
8 #
9 # img is now the default (produces both the .iso and .img)
10 #
11 gui installer img nopkgs:
12
13 #########################################################################
14 #                                SETUP                                  #
15 #########################################################################
16
17 ISODIR?=        /usr/release
18 ISOROOT?=       ${ISODIR}/root
19 OBJSYS=         ${.OBJDIR}/../sys
20 GITHOST?=       git.dragonflybsd.org
21
22 MAKE_JOBS?=     $$(sysctl -n hw.ncpu)
23
24 # temporary until everybody has converted to x86_64
25 .if ${MACHINE_ARCH} == "amd64"
26 MACHINE_ARCH=   x86_64
27 .if defined(.PARSEDIR)
28 .export MACHINE_ARCH
29 .else
30 # LEGACY MAKE - REMOVE FOR DFLY 3.6
31 .makeenv MACHINE_ARCH
32 .endif
33 .endif
34
35 # XXX makeshift fix to build the right kernel for the (target) architecture
36 # We should configure this in the platform files somehow
37 .if ${MACHINE_ARCH} == "i386"
38 KERNCONF ?= GENERIC
39 .else
40 KERNCONF ?= X86_64_GENERIC
41 .endif
42
43 PKGSRC_PREFIX?=         /usr/pkg
44 PKGBIN_PKG_ADD?=        ${PKGSRC_PREFIX}/sbin/pkg_add
45 PKGBIN_PKG_DELETE?=     ${PKGSRC_PREFIX}/sbin/pkg_delete
46 PKGBIN_PKG_ADMIN?=      ${PKGSRC_PREFIX}/sbin/pkg_admin
47 PKGBIN_MKISOFS?=        ${PKGSRC_PREFIX}/bin/mkisofs
48
49 # We use env -i in the chroot, so that environment variables won't
50 # disturb any (pkgsrc) build.  This has happened for TARGET_ARCH,
51 # which is used by gmake in completely different context.
52 #
53 CHROOT_CMD?=            env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
54
55 # User may specify extra packages in addition to the defaults
56 #
57 PKGSRC_EXTRA_PACKAGES?=
58
59 # Pkgsrc packages to be built and installed on the release ISO
60 #
61 PKGSRC_PACKAGES?=       pkgtools/pkg_leaves \
62                         pkgtools/pkg_tarup \
63                         pkgtools/pkgin \
64                         devel/scmgit-base \
65                         devel/scmgit-docs \
66                         net/bind96 \
67                         net/isc-dhcp4 \
68                         net/isc-dhcpd4 \
69                         sysutils/cdrtools \
70                         net/csup \
71                         ${PKGSRC_EXTRA_PACKAGES}
72
73 # dports packages to be built and installed on the release ISO
74 #
75 DPORTS_PACKAGES+=       ports-mgmt/pkg
76
77 # pkgsrc options to use when building packages
78 #
79 PKGSRC_OPTIONS+=        MAKE_JOBS=${MAKE_JOBS}
80 PKGSRC_OPTIONS+=        WRKOBJDIR=/usr/pkgobj
81 PKGSRC_OPTIONS+=        PKG_DEFAULT_OPTIONS='dri inet6'
82 .if !make(gui)
83 PKGSRC_OPTIONS+=        PKG_OPTIONS.scmgit='-python'
84 .endif
85
86 # Even though buildiso wipes the packages, our check target has to run
87 # first and old packages (listed as they appear in pkg_info) must be
88 # cleaned out in order for the pkg_add -n test we use in the check target
89 # to operate properly.
90 #
91 OLD_PKGSRC_PACKAGES?=   cdrtools-2.01.01.27nb1 \
92                         cdrecord-2.00.3nb2 \
93                         bootstrap-kit-20070205 \
94                         dfuibe_installer-1.1.6 \
95                         gettext-lib-0.14.5 \
96                         dfuibe_installer-1.1.7nb1 \
97                         dfuife_curses-1.5 \
98                         gettext-lib-0.14.6 \
99                         gettext-tools-0.14.6nb1 \
100                         libaura-3.1 \
101                         libdfui-4.2 \
102                         libinstaller-5.1 \
103                         bootstrap-kit-20080211 \
104                         cdrtools-ossdvd-2.01.1.36nb2 \
105                         isc-dhcp-base-4.0.0 \
106                         isc-dhcp-server-4.0.0
107
108 # Specify which root skeletons are required, and let the user include
109 # their own.  They are copied into ISODIR during the `customizeiso'
110 # target; each overwrites the last.
111 #
112 REQ_ROOTSKELS=  ${.CURDIR}/root
113 ROOTSKELS?=     ${REQ_ROOTSKELS}
114
115 # LIST OF PACKAGES NOT INCLUDED DUE TO BUILD ISSUES:
116 #       chat/pidgin             textproc/enchant dependency is broken
117 #       x11/rxvt-unicode        broken configure
118 #       net/nmap                tries to access openssl/md2.h which does not
119 #                               exist.
120 #       sysutils/idesk          dying on link __sync_fetch_and_add_4
121 #
122 .if make(gui)
123 ISOFILE?=               ${ISODIR}/dfly-gui.iso
124 IMGFILE?=               ${ISODIR}/dfly-gui.img
125
126 # NOTE: order important, do not sort package list
127 #
128 # Apps we want in the gui build but which have problems building:
129 #       chat/xchat      link error on x86-64, something about ___progname
130 #
131 #
132 .if !make(nopkgs)
133 PKGSRC_PACKAGES+=       meta-pkgs/modular-xorg-libs \
134                         meta-pkgs/modular-xorg-fonts \
135                         meta-pkgs/modular-xorg-apps \
136                         meta-pkgs/modular-xorg-drivers \
137                         x11/libXinerama \
138                         wm/fluxbox \
139                         wm/fvwm \
140                         www/firefox \
141                         print/xpdf \
142                         shells/zsh \
143                         editors/emacs \
144                         editors/vim \
145                         chat/irssi \
146                         x11/modular-xorg-server \
147                         x11/eterm \
148                         lang/perl5 \
149                         editors/nano \
150                         shells/bash \
151                         devel/exctags \
152                         archivers/zip \
153                         security/sudo \
154                         www/links-gui \
155                         net/wget \
156                         fonts/terminus-font \
157                         net/rsync \
158                         time/asclock \
159                         misc/screen \
160                         devel/scmgit-gitk
161 .endif
162
163 ROOTSKELS+=             ${.CURDIR}/gui
164 .endif
165
166 ISOFILE ?= ${ISODIR}/dfly.iso
167 IMGFILE ?= ${ISODIR}/dfly.img
168
169 IMGMNT ?= ${ISODIR}/mnt
170
171 # USB umass now probes starting at da8, so the usb stick is
172 # probably sitting on da8.
173 #
174 IMGUSBDEV ?= da8
175
176 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
177 # the additional '/nrelease' manually, as a safety measure.
178 #
179 NRLOBJDIR?= /usr/obj
180
181 #########################################################################
182 #                               BASE ISO TARGETS                        #
183 #########################################################################
184
185 release:        check clean buildworld1 buildkernel1 \
186                 buildiso srcs customizeiso mkiso mkimg
187
188 quickrel:       check clean buildworld2 buildkernel2 \
189                 buildiso srcs customizeiso mkiso mkimg
190
191 realquickrel:   check clean \
192                 buildiso srcs customizeiso mkiso mkimg
193
194 restartpkgs:    check customizeiso mkiso mkimg
195
196 quick:          quickrel
197
198 realquick:      realquickrel
199
200
201 #########################################################################
202 #                          CORE SUPPORT TARGETS                         #
203 #########################################################################
204
205 check:
206 .if !exists(${PKGBIN_PKG_ADMIN})
207         @echo "You never bootstrapped pkgsrc on your machine.  You can install it with:"
208         @echo "    make pkgsrc_bootstrap"
209 .endif
210 .if !exists (${PKGBIN_MKISOFS})
211         @echo
212         @echo "Your machine does not have cdrtools installed.  You can install it with:"
213         @echo "    make pkgsrc_cdrecord"
214 .endif
215 .if !defined(PKGSRC_PATH)
216         @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
217         @echo "package building.  For example /usr/pkgsrc.  See the Makefile"
218         @echo "in /usr if you are unfamiliar with pkgsrc."
219 .endif
220 .if !defined(DPORTS_PATH)
221         @echo "Please set DPORTS_PATH to the dports tree that shall be used for"
222         @echo "package building.  For example /usr/dports.  See the Makefile"
223         @echo "in /usr if you are unfamiliar with dports."
224 .endif
225 .if !exists (${PKGBIN_MKISOFS})
226         @/usr/bin/false
227 .endif
228 .if !defined(PKGSRC_PATH)
229         @/usr/bin/false
230 .endif
231 .if !defined(DPORTS_PATH)
232         @/usr/bin/false
233 .endif
234
235 buildworld1 buildworld2:
236         cd ${.CURDIR}/..; \
237         ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
238                 make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
239
240 buildkernel1 buildkernel2:
241         cd ${.CURDIR}/..; \
242         for kernconf in ${KERNCONF}; do \
243                 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
244                         make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
245                         KERNCONF=$${kernconf}; \
246         done
247
248 # note that we do not want to mess with any /usr/obj directories not related
249 # to buildworld, buildkernel, or nrelease, so we must supply the proper
250 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and 
251 # buildkernel mechanism.
252 #
253 # Unconditionally clean out ${ISOROOT} so a previous img build
254 # does not blow up a future quick iso build
255 #
256 # We install with INSTALLSTRIPPEDMODULES to make things fit into the ISO.
257 # We leave the kernel's debug variables intact.
258 #
259 buildiso:
260         -rm -rf ${ISOROOT}
261         -chflags -R noschg ${ISOROOT}
262         rm -rf ${ISOROOT}
263         mkdir -p ${ISOROOT}
264         if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
265         ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
266         ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
267                 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
268         cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
269         cd ${.CURDIR}/..; \
270         for kernconf in ${KERNCONF}; do \
271                 make DESTDIR=${ISOROOT} installkernel KERNCONF=$${kernconf}; \
272         done
273         rm -rf ${ISOROOT}/boot/kernel.old
274         ln -s kernel ${ISOROOT}/boot/kernel/kernel.BOOTP
275         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
276         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
277         dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
278
279 # The GUI build includes the pkgsrc tree (~1G+) while the nominal release
280 # build does not.
281 #
282 # The GUI build includes full sources while the nominal release build
283 # only includes kernel sources (~27MB).
284 #
285 srcs:
286 .if !defined(WITHOUT_SRCS)
287 .if make(gui)
288         rm -f ${ISOROOT}/usr/src-sys.tgz
289         rm -f ${ISOROOT}/usr/src-sys.tar.bz2
290         cd ${ISOROOT}/usr && make pkgsrc-create-repo GITHOST=${GITHOST}
291         # NOTE: Adding the git gc --aggressive helps by significantly
292         #       reducing the disk space required.
293         #
294         cd ${ISOROOT}/usr/pkgsrc && git gc --aggressive
295         cd ${ISOROOT}/usr && make src-create-repo GITHOST=${GITHOST}
296 .else
297         rm -f ${ISOROOT}/usr/src-sys.tgz
298         rm -f ${ISOROOT}/usr/src-sys.tar.bz2
299         cd ${.CURDIR}/.. && tar --exclude .git -s '/^\./src/' \
300                 -cf - ./Makefile ./Makefile.inc1 ./sys | \
301                 bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2
302 .endif
303 .endif
304
305 # Customize the ISO by copying rootskels in reverse priority order,
306 # building packages, and doing other post-install tasks.
307 #
308 customizeiso:
309         # Copy the rootskels.  Allow sources to be owned by someone other
310         # than root (as is common when checked out via git).
311         #
312 .for ROOTSKEL in ${ROOTSKELS}
313         cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
314         @test -O ${.CURDIR} || echo "chowning copied files to root:wheel"
315         @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel))
316 .endfor
317         pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
318 .for UPGRADE_ITEM in Makefile                   \
319                      etc.${MACHINE_ARCH}        \
320                      rc.d/Makefile              \
321                      periodic/Makefile          \
322                      periodic/daily/Makefile    \
323                      periodic/security/Makefile \
324                      periodic/weekly/Makefile   \
325                      periodic/monthly/Makefile
326         cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
327 .endfor
328         #
329         # Setup some things & mount pkgsrc tree.  Use defensive umounts and
330         # rm -rf's to allow restarts.  Allow /usr/pkgsrc to be read-only.
331         #
332         # If we did not get past the bootstrap we clean out the entire
333         # /usr/pkg infrastructure.  Otherwise we attempt to pick up where
334         # we left off.
335         #
336         cp -p /etc/resolv.conf ${ISOROOT}/etc
337         ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
338         -@umount ${ISOROOT}/usr/pkgsrc/distfiles
339         -@umount ${ISOROOT}/usr/pkgsrc
340         -@umount ${ISOROOT}/usr/dports
341         -@umount ${ISOROOT}/dev
342         mkdir -p ${ISODIR}/distfiles
343         rm -rf ${ISOROOT}/usr/pkgobj
344         rm -rf ${ISOROOT}/usr/obj/dports
345         #
346         # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable.
347         # Make /usr/pkgsrc read-only for safety, else a failed umount and
348         # our rm -rf will do bad things.
349         #
350         mkdir -p ${ISOROOT}/usr/pkgobj
351         mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
352         mkdir -p ${ISOROOT}/usr/pkgsrc
353         mkdir -p ${ISOROOT}/usr/dports
354         mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
355         mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports
356         mount_null /dev ${ISOROOT}/dev
357         cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
358             || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
359         #
360         # Bootstrap, if not already installed, and add licenses needed
361         # for the gui release
362         #
363         test -e ${ISODIR}/.didbootstrap || \
364             rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \
365                     ${ISOROOT}/var/db/pkg.refcount
366         test -e ${ISODIR}/.didbootstrap || \
367             ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap;    \
368                 export share_dir=/usr/pkgobj/bootstrap/work/share; \
369                 env USE_DESTDIR=no ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
370         test -e ${ISODIR}/.didbootstrap || \
371             echo ".ifdef BSD_PKG_MK     # added by nrelease" \
372                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
373         test -e ${ISODIR}/.didbootstrap || \
374             echo "PKG_DEFAULT_OPTIONS=dri inet6" \
375                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
376 .if make(gui)
377         test -e ${ISODIR}/.didbootstrap || \
378             echo "ACCEPTABLE_LICENSES+=openmotif-license" \
379                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
380         test -e ${ISODIR}/.didbootstrap || \
381             echo "ACCEPTABLE_LICENSES+=vim-license" \
382                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
383 .endif
384         test -e ${ISODIR}/.didbootstrap || \
385             echo ".endif                        # added by nrelease" \
386                 >> ${ISOROOT}/usr/pkg/etc/mk.conf
387         test -e ${ISODIR}/.didbootstrap || sync
388         test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap
389         #
390         # Build and install packages, skip packages already installed
391         #
392 .for PKG in ${PKGSRC_PACKAGES}
393         ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
394             (bmake check > /dev/null 2>&1 || \
395             env USE_DESTDIR=no bmake ${PKGSRC_OPTIONS} clean build install)"
396 .endfor
397 .for PKG in ${DPORTS_PACKAGES}
398         chroot ${ISOROOT} sh -c "cd /usr/dports/${PKG} && make && make install"
399 .endfor
400 .for PKG in ${DPORTS_PACKAGES}
401         chroot ${ISOROOT} sh -c "cd /usr/dports/${PKG} && make clean"
402 .endfor
403         #
404         # Remove packages which nothing depends on, add a whatis database
405         # for pkgsrc manual pages, create an initial locate database and
406         # clean up
407         #
408         ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
409         ${CHROOT_CMD} "yes | pkg autoremove"
410         ${CHROOT_CMD} "makewhatis /usr/pkg/man"
411         -umount ${ISOROOT}/usr/pkgsrc/distfiles
412         umount ${ISOROOT}/usr/pkgsrc
413         umount ${ISOROOT}/usr/dports
414         rm -rf ${ISOROOT}/usr/pkgobj
415         rm -rf ${ISOROOT}/usr/obj/dports
416         rm -f ${ISOROOT}/etc/resolv.conf
417         #
418         # Add a pkg.conf
419         #
420         ${CHROOT_CMD} "echo PACKAGESITE: http://avalon.dragonflybsd.org/dports/$$\\{ABI\\}/RELEASE >/usr/local/etc/pkg.conf"
421         #
422         # Finally, update the locate(8) database
423         #
424         ${CHROOT_CMD} /etc/periodic/weekly/310.locate
425         umount ${ISOROOT}/dev
426         #
427         # Recopy files that pkgsrc may have updated in /etc into /etc.hdd
428         #
429         cpdup ${ISOROOT}/etc/shells ${ISOROOT}/etc.hdd/shells
430         cpdup ${ISOROOT}/etc/group ${ISOROOT}/etc.hdd/group
431
432 mkiso:
433         ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
434                 -R -J -o ${ISOFILE} \
435                 -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . )
436
437 mkimg:
438         if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
439         -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT};           \
440             vnconfig -u `cat ${ISODIR}/vn.which`; fi
441 .ifdef IMGSIZE
442         @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors"
443         rm -f ${IMGFILE}
444         sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; truncate -s $${sz} ${IMGFILE}
445 .else
446         @echo "STEP: Determine required image size in 1GB steps"
447         @echo "      Leave ~600MB of unused space"
448         sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`;                  \
449             sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \
450             cut -f1 -d.`;                                               \
451             sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`;         \
452             rm -f ${IMGFILE};                                           \
453             truncate -s $${sz}M ${IMGFILE};
454 .endif
455         fdisk -IB -p ${IMGFILE}
456         @echo "STEP: determine free vn device"
457         vnconfig -l | grep "not in use" | head -n 1 |                   \
458             cut -f 1 -d: > ${ISODIR}/vn.which
459         vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE}
460         @echo "STEP: write standard disklabel"
461         disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto
462         @echo "STEP: read disklabel back"
463         disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label
464         @echo "STEP: determine number of sectors of whole disk"
465         secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`;                \
466             echo "  a:  $${secs} 0 4.2BSD" >> ${IMGFILE}.label;
467         @echo "STEP: write modified disklabel back"
468         disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label
469         rm ${IMGFILE}.label
470         @echo "STEP: write bootsector"
471         disklabel -B `cat ${ISODIR}/vn.which`s1
472         boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which`
473         newfs /dev/`cat ${ISODIR}/vn.which`s1a
474         mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT}
475         cpdup ${ISOROOT} ${IMGMNT}
476         @echo "STEP: fixup ${IMGMNT}/etc/fstab"
477         echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab
478         echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
479         echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
480         echo "dummy /var/run tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
481         echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
482         echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab
483         @echo "STEP: fixup ${IMGMNT}/boot/loader.conf"
484         -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new
485         echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new
486         mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf
487         @echo "STEP: cleanup"
488         df ${IMGMNT}
489         umount ${IMGMNT}
490         vnconfig -u `cat ${ISODIR}/vn.which`
491         rm -f ${ISODIR}/vn.which
492         rmdir ${IMGMNT}
493         @echo "STEP: done"
494
495 clean:
496         -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
497         -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
498         -umount ${ISOROOT}/usr/dports > /dev/null 2>&1
499         -umount ${ISOROOT}/dev > /dev/null 2>&1
500         -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT};           \
501             vnconfig -u `cat ${ISODIR}/vn.which`; fi
502         if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
503         rm -rf ${ISOROOT}
504         rm -rf ${NRLOBJDIR}/nrelease
505         rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which
506
507 realclean:      clean
508         rm -rf ${OBJSYS}/${KERNCONF}
509         rm -rf ${ISODIR}/packages
510         rm -rf ${ISODIR}/distfiles
511
512 pkgsrc_bootstrap:
513         mkdir -p ${ISODIR}/bootstrap
514         (cd ${PKGSRC_PATH}/bootstrap; \
515             export share_dir=${ISODIR}/bootstrap/share; \
516             ./bootstrap --workdir ${ISODIR}/bootstrap)
517
518 pkgsrc_cdrecord:
519 .if !exists (${PKGBIN_MKISOFS})
520         (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install)
521 .endif
522
523 help all:
524         @echo "make [gui] release   - complete build from scratch"
525         @echo "make [gui] quick     - attempt to do an incremental rebuild"
526         @echo "make [gui] realquick - attempt to restart after world & kernel"
527         @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage"
528         @echo ""
529         @echo "PKGSRC_EXTRA_PACKAGES may be used to add additional pkgs"
530         @echo "GITHOST may be used to override git.dragonflybsd.org"
531         @echo "IMGSIZE may be used to override the .img (in 512-byte sectors)"
532
533 .PHONY: release quickrel realquickrel
534 .PHONY: installer
535 .PHONY: quick realquick
536 .PHONY: check buildworld1 buildworld2
537 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg
538 .PHONY: clean realclean help all srcs
539
540 .include <bsd.prog.mk>