Fix taskqueues to truely work on SMP systems.
[dragonfly.git] / nrelease / Makefile
blob0de49a7c9fa4e49bf0a5f98f443d456b03517dfd
1 # $DragonFly: src/nrelease/Makefile,v 1.60 2007/02/22 21:02:48 corecode Exp $
4 # compat target
5 installer_release: release
6 installer_quickrel: quickrel
7 installer_realquickrel: realquickrel
8 installer_fetch: fetch
10 .if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel) || make(installer_fetch)
11 WITH_INSTALLER=
12 .endif
14 ISODIR ?= /usr/release
15 ISOFILE ?= ${ISODIR}/dfly.iso
16 ISOROOT = ${ISODIR}/root
17 OBJSYS= ${.OBJDIR}/../sys
18 KERNCONF ?= GENERIC NATA
20 PKGSRC_PREFIX?= /usr/pkg
21 PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
22 PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
23 PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
24 PKGSRC_PKG_PATH?= ${ISODIR}/packages
25 PKGSRC_DB?= /var/db/pkg
26 PKGSRC_BOOTSTRAP_URL?= http://pkgbox.dragonflybsd.org/DragonFly-pkgsrc-packages/i386/1.9.0-DEVELOPMENT
28 ENVCMD?= env
29 TAR?= tar
31 PKGSRC_CDRECORD?= cdrecord-2.00.3nb2.tgz
32 PKGSRC_BOOTSTRAP_KIT?= bootstrap-kit-20070205
33 CVSUP_BOOTSTRAP_KIT?= cvsup-bootstrap-20051229
35 PKGSRC_PACKAGES?= cdrecord-2.00.3nb2.tgz
37 # Specify which root skeletons are required, and let the user include
38 # their own. They are copied into ISODIR during the `pkgcustomizeiso'
39 # target; each overwrites the last.
41 REQ_ROOTSKELS= ${.CURDIR}/root
42 ROOTSKELS?= ${REQ_ROOTSKELS}
44 .if defined(WITH_INSTALLER)
45 PKGSRC_PACKAGES+= dfuibe_installer-1.1.6a.tgz dfuife_curses-1.5.tgz
46 PKGSRC_PACKAGES+= gettext-lib-0.14.5.tgz libaura-3.1.tgz \
47 libdfui-4.2.tgz libinstaller-5.1.tgz
48 ROOTSKELS+= ${.CURDIR}/installer
49 .endif
51 # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
52 # the additional '/nrelease' manually, as a safety measure.
54 NRLOBJDIR?= /usr/obj
56 WORLD_CCVER ?= ${CCVER}
57 KERNEL_CCVER ?= ${CCVER}
59 #########################################################################
60 # BASE ISO TARGETS #
61 #########################################################################
63 release: check clean buildworld1 buildkernel1 \
64 buildiso syssrcs customizeiso mklocatedb mkiso
66 quickrel: check clean buildworld2 buildkernel2 \
67 buildiso syssrcs customizeiso mklocatedb mkiso
69 realquickrel: check clean buildiso syssrcs customizeiso mklocatedb mkiso
71 check:
72 .if !exists(${PKGBIN_PKG_ADD})
73 @echo "Unable to find ${PKGBIN_PKG_ADD}. You can use the following"
74 @echo "command to bootstrap pkgsrc:"
75 @echo " make pkgsrc_bootstrap"
76 @exit 1
77 .endif
78 .if !exists(/etc/mk.conf)
79 @echo "You do not have an /etc/mk.conf. You can use the following"
80 @echo "command to install one. Otherwise pkgsrc defaults will not"
81 @echo "point to the right place:"
82 @echo " make pkgsrc_conf"
83 @exit 1
84 .endif
85 .for PKG in ${PKGSRC_PACKAGES}
86 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
87 (echo "Unable to find ${PKG}, use the following command to fetch required packages:"; echo " make [installer_]fetch"; exit 1)
88 .endfor
89 .if !exists(${PKGBIN_MKISOFS})
90 @echo "mkisofs is not installed. It is part of the cdrecord package."
91 @echo "You can install it with:"
92 @echo " make pkgsrc_cdrecord"
93 @exit 1
94 .endif
95 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
96 @echo "The pkgsrc bootstrap kit is not installed. You can install it with:"
97 @echo " make [installer_]fetch"
98 @exit 1
99 .endif
100 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
101 @echo "The cvsup bootstrap kit is not installed. You can install it with:"
102 @echo " make [installer_]fetch"
103 @exit 1
104 .endif
106 buildworld1 buildworld2:
107 cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//}
109 buildkernel1 buildkernel2:
110 cd ${.CURDIR}/..; \
111 first=; \
112 for kernconf in ${KERNCONF}; do \
113 CCVER=${KERNEL_CCVER} make ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
114 KERNCONF=$${kernconf} \
115 $${first:+-DNO_MODULES}; \
116 first=done; \
117 done
119 # note that we do not want to mess with any /usr/obj directories not related
120 # to buildworld, buildkernel, or nrelease, so we must supply the proper
121 # MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
122 # buildkernel mechanism.
124 buildiso:
125 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
126 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
127 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
128 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
129 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
130 cp -p ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
131 chroot ${ISOROOT} /usr/bin/newaliases
132 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
133 cd ${.CURDIR}/..; \
134 first=; \
135 for kernconf in ${KERNCONF}; do \
136 make DESTDIR=${ISOROOT} \
137 installkernel KERNCONF=$${kernconf} \
138 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
139 $${first:+-DNO_MODULES}; \
140 first=done; \
141 done
142 ln -s kernel ${ISOROOT}/kernel.BOOTP
143 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
144 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
145 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
147 # Include kernel sources on the release CD (~14MB)
149 syssrcs:
150 .if !defined(WITHOUT_SRCS)
151 ( cd ${.CURDIR}/../..; tar --exclude CVS -cf - src/Makefile src/Makefile.inc1 src/sys | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 )
152 .endif
154 customizeiso:
155 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
156 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${CVSUP_BOOTSTRAP_KIT}.tgz)
157 .for ROOTSKEL in ${ROOTSKELS}
158 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
159 .endfor
160 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
161 cpdup ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT} ${ISOROOT}/tmp/bootstrap
162 cp -p ${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}/usr/local/bin/cvsup ${ISOROOT}/usr/local/bin/cvsup
163 mkdir -p ${ISOROOT}/tmp/bootstrap/distfiles # new bootstrap insists in that
164 chroot ${ISOROOT} csh -c "cd /tmp/bootstrap/bootstrap; ./bootstrap"
165 rm -rf ${ISOROOT}/tmp/bootstrap ${ISOROOT}/usr/obj/pkgsrc
166 rm -rf `find ${ISOROOT} -type d -name CVS -print`
167 rm -rf ${ISOROOT}/usr/local/share/pristine
168 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
169 .for UPGRADE_ITEM in Makefile \
170 etc.${MACHINE_ARCH} \
171 isdn/Makefile \
172 rc.d/Makefile \
173 periodic/Makefile \
174 periodic/daily/Makefile \
175 periodic/security/Makefile \
176 periodic/weekly/Makefile \
177 periodic/monthly/Makefile
178 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
179 .endfor
180 .for PKG in ${PKGSRC_PACKAGES}
181 ${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${PKG}
182 .endfor
183 find ${ISOROOT}${PKGSRC_DB} -name +CONTENTS -type f -exec sed -i '' -e 's,${ISOROOT},,' -- {} \;
184 ${PKGBIN_PKG_ADMIN} -K ${ISOROOT}${PKGSRC_DB} rebuild
186 mklocatedb:
187 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
188 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
189 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
190 /usr/libexec/locate.mklocatedb \
191 -presort >${ISOROOT}/var/db/locate.database )
193 mkiso:
194 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
195 -R -J -V DragonFly -o ${ISOFILE} . )
197 clean:
198 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
199 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
200 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
202 realclean: clean
203 rm -rf ${OBJSYS}/${KERNCONF}
204 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
205 # override location.
206 if [ -d ${ISODIR}/packages ]; then rm -rf ${ISODIR}/packages; fi
208 fetch:
209 mkdir -p ${PKGSRC_PKG_PATH}
210 .for PKG in ${PKGSRC_PACKAGES}
211 @${ENVCMD} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGBIN_PKG_ADD} -K ${ISOROOT}/var/db/pkg -n ${PKG} > /dev/null 2>&1 || \
212 (cd ${PKGSRC_PKG_PATH}; echo "Fetching ${PKGSRC_BOOTSTRAP_URL}/${PKG}"; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKG})
213 .endfor
214 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
215 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
216 .endif
217 .if !exists(${PKGSRC_PKG_PATH}/${CVSUP_BOOTSTRAP_KIT}.tgz)
218 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${CVSUP_BOOTSTRAP_KIT}.tgz)
219 .endif
221 pkgsrc_bootstrap:
222 mkdir -p ${PKGSRC_PKG_PATH}
223 .if !exists(${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
224 (cd ${PKGSRC_PKG_PATH}; fetch ${PKGSRC_BOOTSTRAP_URL}/${PKGSRC_BOOTSTRAP_KIT}.tgz)
225 .endif
226 (cd ${PKGSRC_PKG_PATH}; tar xzpf ${PKGSRC_BOOTSTRAP_KIT}.tgz)
227 (cd ${PKGSRC_PKG_PATH}/${PKGSRC_BOOTSTRAP_KIT}/bootstrap; ./bootstrap)
229 pkgsrc_conf:
230 .if !exists(/etc/mk.conf)
231 cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
232 .else
233 fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
234 .endif
236 pkgsrc_cdrecord:
237 .if !exists (${PKGBIN_MKISOFS})
238 ${PKGBIN_PKG_ADD} ${PKGSRC_PKG_PATH}/cdrecord*
239 .endif
242 # XXX I am a tentative target, remove me when I am not needed anymore!
243 buildkernel1 buildkernel2: ${.CURDIR}/../sys/config/NATA
245 ${.CURDIR}/../sys/config/NATA: ${.CURDIR}/../sys/config/GENERIC
246 ( sed -e '/[[:<:]]ata[01]/d;s/[[:<:]]ata/n&/' ${.ALLSRC}; \
247 echo "options PCI_MAP_FIXUP"; \
248 echo "device nataraid" ) > ${.TARGET}
251 .PHONY: all release installer_release quickrel installer_quickrel realquickrel
252 .PHONY: installer_fetch
253 .PHONY: installer_realquickrel check buildworld1 buildworld2
254 .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
255 .PHONY: clean realclean fetch
257 .include <bsd.prog.mk>