Makefile revision 1.327 1 1.327 tron # $NetBSD: Makefile,v 1.327 2006/06/08 11:05:31 tron Exp $
2 1.66 mikel # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
3 1.1 cgd
4 1.96 cjs # Environment variables without default values:
5 1.96 cjs # DESTDIR must be set before anything in this file will work.
6 1.96 cjs # RELEASEDIR is where the tarred up stuff for a snapshot or
7 1.96 cjs # release will be placed.
8 1.96 cjs #
9 1.96 cjs # Environment variables with default values:
10 1.96 cjs # LOCALTIME will set the default local time for the system you
11 1.96 cjs # build; it determines what /etc/localtime is symlink'd to.
12 1.96 cjs # KERNSRCDIR points to kernel source; it is set by default to ../sys,
13 1.96 cjs # but can be overridden.
14 1.96 cjs # KERNOBJDIR is the kernel build directory, it defaults to
15 1.172 jlam # ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
16 1.96 cjs # KERNCONFDIR is where the configuration files for kernels are found;
17 1.96 cjs # default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
18 1.270 lukem # MKCRYPTO; if not `no', install crypto-related configuration
19 1.304 lukem # MKPOSTFIX; if not `no', install postfix configuration
20 1.270 lukem # MKUNPRIVED; if not `no', allow non-root installs.
21 1.255 lukem # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
22 1.154 thorpej #
23 1.96 cjs # Targets:
24 1.96 cjs # distribution: makes a full NetBSD distribution in DESTDIR. If
25 1.96 cjs # INSTALL_DONE is set, it will not do a `make install.'
26 1.182 chs # if DISTRIBUTION_DONE is set, it will not do anything.
27 1.96 cjs # distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
28 1.96 cjs # Called by distribution.
29 1.96 cjs # snapshot: calls distribution, above, and then tars up the files
30 1.286 cl # into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}.
31 1.241 lukem # Any port-dependent stuff for this target is found in
32 1.241 lukem # etc.${MACHINE}/Makefile.inc.
33 1.106 cjs # release: a synonym for `snapshot'
34 1.242 lukem #
35 1.199 tv
36 1.270 lukem # For MK* vars
37 1.90 kim .include <bsd.own.mk>
38 1.187 jmc
39 1.260 lukem .include <bsd.sys.mk> # for HOST_SH
40 1.260 lukem .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
41 1.260 lukem .include <bsd.endian.mk> # For TARGET_ENDIANNESS
42 1.252 lukem
43 1.187 jmc .MAKEOVERRIDES+= USETOOLS
44 1.90 kim
45 1.23 cgd TZDIR= /usr/share/zoneinfo
46 1.157 kleink LOCALTIME?= UTC
47 1.283 agc CKSUM?= ${TOOL_CKSUM}
48 1.283 agc MAKESUMS= CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
49 1.266 lukem DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
50 1.19 deraadt
51 1.161 hubertf # Flags for creating ISO CDROM image
52 1.320 apb # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools
53 1.242 lukem # Note: At least mkisofs 2.0 should be used.
54 1.242 lukem #
55 1.161 hubertf MKISOFS?= mkisofs
56 1.260 lukem DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
57 1.224 bjh21 # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
58 1.306 martin ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
59 1.306 martin MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \
60 1.224 bjh21 -V ${ISO_VOLID} \
61 1.161 hubertf -P "The NetBSD Project" \
62 1.286 cl -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
63 1.306 martin .if ${MKISOFS_FLAGS:N-v}
64 1.306 martin MKISOFS_FLAGS+= -quiet
65 1.306 martin .endif
66 1.306 martin
67 1.1 cgd
68 1.80 jonathan # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
69 1.316 hubertf # are empty, to preserve the old semantics of setting them below with "+=".
70 1.242 lukem #
71 1.200 lukem BIN1=
72 1.80 jonathan BIN2=
73 1.80 jonathan BIN3=
74 1.80 jonathan
75 1.286 cl # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
76 1.241 lukem # MD Makefile.inc files can add to this.
77 1.117 simonb # NOTE: Parent directories must be listed before subdirectories.
78 1.242 lukem #
79 1.217 lukem INSTALLATION_DIRS= binary binary/sets binary/kernel installation
80 1.117 simonb
81 1.286 cl .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
82 1.286 cl .include "etc.${RELEASEMACHINE}/Makefile.inc"
83 1.71 cjs .endif
84 1.32 jtc
85 1.21 cgd # -rw-r--r--
86 1.21 cgd BINOWN= root
87 1.21 cgd BINGRP= wheel
88 1.227 perry UTMPGRP= utmp
89 1.184 lukem BIN1+= bootptab changelist csh.cshrc csh.login csh.logout daily \
90 1.223 fredette daily.conf dm.conf floppytab ftpchroot ftpusers \
91 1.280 itohy gettytab group hosts hosts.lpd inetd.conf lkm.conf locate.conf \
92 1.314 tron mailer.conf man.conf monthly monthly.conf mrouted.conf named.conf \
93 1.151 fvdl netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
94 1.291 lukem passwd.conf phones printcap profile protocols \
95 1.291 lukem rbootd.conf rc rc.conf rc.lkm rc.local rc.subr rc.shutdown remote rpc \
96 1.142 tsarna security security.conf services shells sysctl.conf syslog.conf \
97 1.291 lukem weekly weekly.conf wscons.conf
98 1.291 lukem
99 1.242 lukem # Use machine-specific disktab if it exists, or the MI one otherwise
100 1.236 jdolecek .if exists(etc.${MACHINE}/disktab)
101 1.236 jdolecek BIN1+= etc.${MACHINE}/disktab
102 1.236 jdolecek .else
103 1.236 jdolecek BIN1+= disktab
104 1.236 jdolecek .endif
105 1.105 mycroft
106 1.234 jdolecek .if exists(etc.${MACHINE}/ld.so.conf)
107 1.234 jdolecek BIN1+= etc.${MACHINE}/ld.so.conf
108 1.152 perry .endif
109 1.152 perry
110 1.234 jdolecek .if exists(etc.${MACHINE}/ttyaction)
111 1.234 jdolecek BIN1+= etc.${MACHINE}/ttyaction
112 1.105 mycroft .endif
113 1.1 cgd
114 1.46 deraadt # -rw-rw-r--
115 1.80 jonathan BIN2+= motd
116 1.1 cgd
117 1.77 mycroft # -rw-------
118 1.80 jonathan BIN3+= hosts.equiv
119 1.77 mycroft
120 1.291 lukem SYSPKG= etc
121 1.230 perry ETC_PKG=-T etc_pkg
122 1.230 perry BASE_PKG=-T base_pkg
123 1.242 lukem ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
124 1.261 cl ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
125 1.230 perry
126 1.191 tv .if ${TARGET_ENDIANNESS} == "1234"
127 1.252 lukem PWD_MKDB_ENDIAN= -L
128 1.191 tv .elif ${TARGET_ENDIANNESS} == "4321"
129 1.252 lukem PWD_MKDB_ENDIAN= -B
130 1.170 jdolecek .else
131 1.252 lukem PWD_MKDB_ENDIAN=
132 1.191 tv .endif
133 1.149 sjg
134 1.149 sjg
135 1.242 lukem # distribution --
136 1.242 lukem # Build a distribution
137 1.242 lukem #
138 1.324 dsl distribution: .PHONY .MAKE check_DESTDIR distrib-dirs
139 1.182 chs .if !defined(DISTRIBUTION_DONE)
140 1.87 perry .if !defined(INSTALL_DONE)
141 1.285 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
142 1.285 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
143 1.200 lukem .endif # !INSTALL_DONE
144 1.285 lukem ${MAKEDIRTARGET} . install-etc-files
145 1.288 lukem .if ${MKX11} != "no"
146 1.288 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution
147 1.288 lukem .endif
148 1.285 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
149 1.200 lukem .endif # !DISTRIBUTION_DONE
150 1.193 thorpej
151 1.266 lukem
152 1.295 christos CLEANFILES+= MAKEDEV
153 1.275 lukem MAKEDEV: .EXEC
154 1.263 lukem ${_MKTARGET_CREATE}
155 1.264 lukem MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
156 1.264 lukem NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
157 1.264 lukem awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}
158 1.257 jdolecek
159 1.266 lukem RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \
160 1.266 lukem DESTDIR EXTERNAL_TOOLCHAIN \
161 1.266 lukem INSTALLWORLDDIR \
162 1.266 lukem KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
163 1.266 lukem MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
164 1.266 lukem MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
165 1.273 lukem MKBFD MKCATPAGES \
166 1.273 lukem MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
167 1.273 lukem MKDOC MKDYNAMICROOT MKGCC MKGCCCMDS MKGDB \
168 1.303 peter MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
169 1.325 christos MKKERBEROS MKLINKLIB MKLINT \
170 1.273 lukem MKMAN MKMANZ MKNLS MKOBJ MKOBJDIRS \
171 1.303 peter MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
172 1.326 christos MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
173 1.273 lukem MKUNPRIVED MKUPDATE MKUUCP MKX11 MKYP \
174 1.276 lukem NBUILDJOBS NETBSDSRCDIR \
175 1.266 lukem NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
176 1.276 lukem OBJMACHINE \
177 1.276 lukem RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \
178 1.276 lukem USETOOLS USR_OBJMACHINE \
179 1.276 lukem X11SRCDIR
180 1.276 lukem
181 1.276 lukem params: .PHONY
182 1.276 lukem .for var in ${RELEASEVARS}
183 1.276 lukem .if defined(${var})
184 1.276 lukem @printf "%20s = '%-s'\n" ${var} ${${var}:Q}
185 1.276 lukem .else
186 1.276 lukem @printf "%20s = (undefined)\n" ${var}
187 1.276 lukem .endif
188 1.276 lukem .endfor
189 1.266 lukem
190 1.272 lukem CLEANFILES+= etc-release
191 1.322 dsl etc-release: .EXEC .MAKE
192 1.266 lukem ${_MKTARGET_CREATE}
193 1.266 lukem @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
194 1.266 lukem echo ; \
195 1.269 lukem cat ${NETBSDSRCDIR}/sys/conf/copyright; \
196 1.266 lukem echo ; \
197 1.266 lukem echo "Build settings:"; \
198 1.281 lukem printf "%20s %s\n" "Build date" "$$(date -u)"; \
199 1.281 lukem printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \
200 1.281 lukem echo ; \
201 1.282 enami (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
202 1.276 lukem ) >${.OBJDIR}/${.TARGET}
203 1.266 lukem
204 1.275 lukem install-etc-release: .PHONY etc-release
205 1.272 lukem ${_MKMSG_INSTALL} etc/release
206 1.266 lukem ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
207 1.272 lukem etc-release ${DESTDIR}/etc/release
208 1.242 lukem
209 1.291 lukem
210 1.291 lukem FILESDIR= /etc
211 1.291 lukem CONFIGFILES=
212 1.291 lukem CONFIGSYMLINKS=
213 1.291 lukem
214 1.291 lukem .for file in ${BIN1}
215 1.291 lukem CONFIGFILES+= ${file}
216 1.291 lukem FILESMODE_${file:T}= 644
217 1.291 lukem .endfor
218 1.291 lukem
219 1.291 lukem .for file in ${BIN2}
220 1.291 lukem CONFIGFILES+= ${file}
221 1.291 lukem FILESMODE_${file:T}= 664
222 1.291 lukem .endfor
223 1.291 lukem
224 1.291 lukem .for file in ${BIN3}
225 1.291 lukem CONFIGFILES+= ${file}
226 1.291 lukem FILESMODE_${file:T}= 600
227 1.291 lukem .endfor
228 1.291 lukem
229 1.327 tron .if (${MKPOSTFIX} != "no")
230 1.291 lukem CONFIGFILES+= aliases
231 1.291 lukem FILESDIR_aliases= /etc/mail
232 1.291 lukem FILESMODE_aliases= 644
233 1.327 tron .endif
234 1.291 lukem
235 1.291 lukem CONFIGFILES+= MAKEDEV.local
236 1.291 lukem FILESDIR_MAKEDEV.local= /dev
237 1.291 lukem FILESMODE_MAKEDEV.local=${BINMODE}
238 1.291 lukem
239 1.291 lukem CONFIGFILES+= crontab
240 1.291 lukem FILESDIR_crontab= /var/cron/tabs
241 1.291 lukem FILESNAME_crontab= root
242 1.291 lukem FILESMODE_crontab= 600
243 1.291 lukem
244 1.291 lukem CONFIGFILES+= minfree
245 1.291 lukem FILESDIR_minfree= /var/crash
246 1.291 lukem FILESMODE_minfree= 600
247 1.291 lukem
248 1.291 lukem CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
249 1.291 lukem /usr/sbin/rmt /etc/rmt
250 1.291 lukem
251 1.291 lukem
252 1.242 lukem # install-etc-files --
253 1.242 lukem # Install etc (config) files; not performed by "make build"
254 1.242 lukem #
255 1.323 dsl install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
256 1.291 lukem ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
257 1.230 perry ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
258 1.230 perry master.passwd ${DESTDIR}/etc
259 1.254 lukem ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
260 1.230 perry ${DESTDIR}/etc/master.passwd
261 1.255 lukem .if ${MKUNPRIVED} != "no"
262 1.222 lukem ( \
263 1.246 lukem for metaent in passwd pwd.db spwd.db; do \
264 1.246 lukem echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
265 1.246 lukem done; \
266 1.239 lukem ) | ${METALOG.add}
267 1.255 lukem .endif # MKUNPRIVED != no
268 1.291 lukem ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys
269 1.289 christos ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
270 1.298 christos ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc
271 1.291 lukem ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV
272 1.259 ross ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
273 1.257 jdolecek MAKEDEV ${DESTDIR}/dev
274 1.291 lukem .for owner group mode file in \
275 1.291 lukem ${BINOWN} operator 664 /etc/dumpdates \
276 1.291 lukem ${BINOWN} ${BINGRP} 644 /etc/mail/local-host-names \
277 1.291 lukem ${BINOWN} operator 600 /etc/skeykeys \
278 1.291 lukem root wheel 600 /var/at/at.deny \
279 1.291 lukem nobody ${BINGRP} 664 /var/db/locate.database \
280 1.291 lukem uucp dialer 640 /var/log/aculog \
281 1.291 lukem ${BINOWN} ${BINGRP} 600 /var/log/authlog \
282 1.291 lukem root wheel 600 /var/log/cron \
283 1.313 lukem ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \
284 1.313 lukem ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \
285 1.291 lukem ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \
286 1.291 lukem ${BINOWN} ${BINGRP} 600 /var/log/maillog \
287 1.291 lukem ${BINOWN} ${BINGRP} 644 /var/log/messages \
288 1.291 lukem ${BINOWN} ${BINGRP} 600 /var/log/secure \
289 1.313 lukem ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \
290 1.313 lukem ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \
291 1.291 lukem ${BINOWN} ${BINGRP} 600 /var/log/xferlog \
292 1.291 lukem daemon staff 664 /var/msgs/bounds \
293 1.291 lukem ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \
294 1.291 lukem ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \
295 1.291 lukem games games 664 /var/games/atc_score \
296 1.291 lukem games games 664 /var/games/battlestar.log \
297 1.291 lukem games games 664 /var/games/cfscores \
298 1.291 lukem games games 664 /var/games/criblog \
299 1.291 lukem games games 660 /var/games/hackdir/perm \
300 1.291 lukem games games 660 /var/games/hackdir/record \
301 1.291 lukem games games 664 /var/games/larn/llog12.0 \
302 1.291 lukem games games 664 /var/games/larn/lscore12.0 \
303 1.291 lukem games games 664 /var/games/larn/playerids \
304 1.291 lukem games games 664 /var/games/robots_roll \
305 1.291 lukem games games 664 /var/games/rogue.scores \
306 1.291 lukem games games 664 /var/games/saillog \
307 1.291 lukem games games 664 /var/games/snakerawscores \
308 1.291 lukem games games 664 /var/games/snake.log \
309 1.291 lukem games games 664 /var/games/tetris.scores
310 1.291 lukem ${_MKMSG_INSTALL} ${DESTDIR}${file}
311 1.291 lukem ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
312 1.291 lukem /dev/null ${DESTDIR}${file}
313 1.291 lukem .endfor
314 1.321 agc .for subdir in . defaults iscsi mtree namedb pam.d powerd rc.d root skel ssh
315 1.291 lukem ${MAKEDIRTARGET} ${subdir} configinstall
316 1.291 lukem .endfor
317 1.287 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
318 1.303 peter .if (${MKPF} != "no")
319 1.294 yamt ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall
320 1.303 peter .endif
321 1.155 thorpej .if (${MKCRYPTO} != "no")
322 1.287 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/ssh configinstall
323 1.155 thorpej .endif
324 1.304 lukem .if (${MKPOSTFIX} != "no")
325 1.304 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/postfix configinstall
326 1.304 lukem .endif
327 1.247 lukem
328 1.247 lukem
329 1.247 lukem # install-obsolete-lists --
330 1.247 lukem # Install var/db/obsolete set lists; this is performed by "make build"
331 1.247 lukem #
332 1.247 lukem OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
333 1.247 lukem OBSOLETE.files= base comp etc games man misc text
334 1.307 tron .if ${MKX11} != "no"
335 1.311 lukem OBSOLETE.files+= xbase xcomp xetc xfont xserver
336 1.307 tron .endif
337 1.247 lukem
338 1.322 dsl install-obsolete-lists: .PHONY .MAKE
339 1.246 lukem mkdir -p ${OBSOLETE.dir}
340 1.307 tron .if ${MKX11} != "no"
341 1.307 tron (cd ${NETBSDSRCDIR}/distrib/sets && \
342 1.307 tron MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
343 1.307 tron .else
344 1.253 lukem (cd ${NETBSDSRCDIR}/distrib/sets && \
345 1.253 lukem MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
346 1.307 tron .endif
347 1.246 lukem .for file in ${OBSOLETE.files}
348 1.291 lukem ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}
349 1.246 lukem ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
350 1.247 lukem ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
351 1.246 lukem .endfor
352 1.1 cgd
353 1.242 lukem
354 1.242 lukem # distrib-dirs --
355 1.242 lukem # Populate $DESTDIR with directories needed by NetBSD
356 1.242 lukem #
357 1.255 lukem .if ${MKUNPRIVED} == "no"
358 1.255 lukem TOOL_MTREE.unpriv=
359 1.255 lukem .else
360 1.255 lukem TOOL_MTREE.unpriv= -W
361 1.255 lukem .endif
362 1.255 lukem
363 1.275 lukem distrib-dirs: .PHONY check_DESTDIR
364 1.317 apb .if !defined(DISTRIBUTION_DONE) # {
365 1.317 apb # XXX: If METALOG=${DESTDIR}/METALOG (as is normal), and if ${DESTDIR}
366 1.317 apb # does not yet exist (as often happens), then the INSTALL_DIR command
367 1.317 apb # immediately below will create ${DESTDIR} but will fail to register
368 1.317 apb # an entry for "." in the metalog. We ignore the problem, because the
369 1.317 apb # TOOL_MTREE commands a little further below will soon register an entry
370 1.317 apb # for "." in the metalog.
371 1.230 perry ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
372 1.317 apb # XXX: It would be nice if a single mtree invocation could both
373 1.317 apb # append to the metalog and do real work. Instead, we have to
374 1.317 apb # repeat the command twice in slightly different ways.
375 1.254 lukem ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
376 1.255 lukem -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
377 1.317 apb .if ${MKUNPRIVED} != "no" # {
378 1.317 apb ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
379 1.317 apb -p ${DESTDIR}/ -C -k all | \
380 1.317 apb awk '/ optional/ {next} // {print}' | ${METALOG.add}
381 1.317 apb .endif # MKUNPRIVED # }
382 1.317 apb .endif # DISTRIBUTION_DONE # }
383 1.242 lukem
384 1.242 lukem # release, snapshot --
385 1.242 lukem # Build a full distribution including kernels & install media.
386 1.242 lukem #
387 1.324 dsl release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post
388 1.285 lukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
389 1.315 jmc ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
390 1.315 jmc ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@}
391 1.286 cl ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
392 1.161 hubertf
393 1.242 lukem
394 1.242 lukem # iso-image --
395 1.242 lukem # Standalone target to create a CDROM image after the release
396 1.242 lukem # was composed. Should be run after "make release" in src and xsrc.
397 1.242 lukem #
398 1.245 lukem # Note: At least mkisofs 2.0 should be used.
399 1.242 lukem #
400 1.292 he CDROM_NAME_ADD?=
401 1.292 he CDROM.image=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom/netbsd-${MACHINE}${CDROM_NAME_ADD}.iso
402 1.319 apb CDROM.dir= ${.OBJDIR}/cdrom.dir
403 1.319 apb CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist
404 1.242 lukem
405 1.324 dsl iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
406 1.286 cl ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso'
407 1.265 lukem @echo "iso-image created as: ${CDROM.image}"
408 1.161 hubertf
409 1.275 lukem iso-image-setup: .PHONY check_RELEASEDIR
410 1.242 lukem rm -f ${CDROM.pathlist}
411 1.302 fredb .for extra in README SOURCE_DATE source
412 1.302 fredb .if exists(${RELEASEDIR}/${extra})
413 1.302 fredb echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist}
414 1.302 fredb .endif
415 1.302 fredb .endfor
416 1.286 cl echo "${MACHINE}=${RELEASEDIR}/${RELEASEMACHINEDIR}" >> ${CDROM.pathlist}
417 1.242 lukem mkdir -p ${CDROM.dir}
418 1.286 cl mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
419 1.242 lukem
420 1.248 lukem # iso-image-mi --
421 1.242 lukem # Create the image after the MD operations have completed.
422 1.248 lukem #
423 1.324 dsl iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre
424 1.242 lukem @if ! ${MKISOFS} --version; then \
425 1.320 apb echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
426 1.242 lukem false; \
427 1.161 hubertf fi
428 1.242 lukem ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
429 1.242 lukem -o ${CDROM.image} ${CDROM.dir}
430 1.242 lukem
431 1.248 lukem # iso-image-md-pre --
432 1.242 lukem # Setup ${CDROM.dir} to produce a bootable CD image.
433 1.242 lukem # Overridden by etc.$MACHINE/Makefile.inc
434 1.242 lukem #
435 1.324 dsl iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
436 1.242 lukem # (empty -- look in the machine-dependent Makefile.inc)
437 1.161 hubertf
438 1.248 lukem # iso-image-md-post --
439 1.242 lukem # Fixup the CD-image to be bootable.
440 1.242 lukem # Overridden by etc.$MACHINE/Makefile.inc
441 1.242 lukem #
442 1.324 dsl iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
443 1.242 lukem # (empty -- look in the machine-dependent Makefile.inc)
444 1.41 cgd
445 1.242 lukem
446 1.242 lukem # snap_pre --
447 1.242 lukem # Create ${RELEASEDIR} and necessary subdirectories.
448 1.242 lukem #
449 1.324 dsl snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
450 1.241 lukem ${INSTALL} -d -m 755 ${RELEASEDIR}
451 1.255 lukem .if ${MKUPDATE} == "no"
452 1.168 jmc # Could be a mount point, ignore the errors
453 1.286 cl -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
454 1.240 lukem .endif
455 1.286 cl ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
456 1.117 simonb .for dir in ${INSTALLATION_DIRS}
457 1.286 cl ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
458 1.117 simonb .endfor
459 1.96 cjs
460 1.242 lukem # snap_post --
461 1.242 lukem # Build the install media and notes from distrib
462 1.242 lukem #
463 1.324 dsl snap_post: .PHONY .MAKE build_kernelsets build_releasekernels
464 1.255 lukem .if ${MKUPDATE} == "no"
465 1.233 lukem cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
466 1.233 lukem .endif
467 1.233 lukem cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
468 1.233 lukem ${MAKE} release
469 1.233 lukem
470 1.324 dsl # build kernels --
471 1.242 lukem # This target builds the kernels specified by each port.
472 1.242 lukem # A port may specify the following kernels:
473 1.196 thorpej #
474 1.196 thorpej # KERNEL_SETS The list of kernels that will be
475 1.196 thorpej # packaged into sets, named
476 1.196 thorpej # kern-${kernel}.tgz. These kernels
477 1.203 chs # are also placed in the binary/kernel
478 1.196 thorpej # area of the release package as
479 1.196 thorpej # netbsd-${kernel}.gz.
480 1.196 thorpej #
481 1.196 thorpej # EXTRA_KERNELS Additional kernels to place in the
482 1.203 chs # binary/kernel area of the release
483 1.196 thorpej # package as netbsd-${kernel}.gz, but
484 1.196 thorpej # which are not placed into sets. This
485 1.196 thorpej # allows a port to provide e.g. a netbootable
486 1.196 thorpej # installation kernel containing a ramdisk.
487 1.196 thorpej #
488 1.196 thorpej # BUILD_KERNELS Additional kernels to build which are
489 1.196 thorpej # not placed into sets nor into the
490 1.203 chs # binary/kernel area of the release
491 1.196 thorpej # package. These are typically kernels
492 1.196 thorpej # that are built for inclusion only in
493 1.196 thorpej # installation disk/CD-ROM/tape images.
494 1.116 fair #
495 1.242 lukem # A port may also specify KERNEL_SUFFIXES, which is an optional list
496 1.242 lukem # of filename suffixes for kernels to include in the kernel sets and
497 1.242 lukem # in the binary/kernel area of the release package (e.g. "netbsd" vs.
498 1.242 lukem # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
499 1.242 lukem # with these suffixes do not exist in the kernel build directory.
500 1.197 thorpej #
501 1.229 lukem #
502 1.229 lukem # A list of all the kernels to build, which can be overridden from
503 1.229 lukem # external sources (such as make(1)'s environment or command line)
504 1.229 lukem #
505 1.229 lukem ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
506 1.242 lukem
507 1.116 fair GETKERNELAWK= awk '/^config/ {print $$2; found=1} \
508 1.116 fair END{ if (found == 0) print "netbsd"; }'
509 1.242 lukem
510 1.324 dsl build_kernels: .PHONY
511 1.232 lukem # Configure & compile kernels listed in ${ALL_KERNELS}
512 1.232 lukem #
513 1.284 cgd # The 'sync' is so that all writes during the build are pushed back
514 1.284 cgd # to the disk. Not having it causes problems on some host systems
515 1.284 cgd # (e.g. Linux) when building on NFS.
516 1.284 cgd #
517 1.201 lukem .if !defined(KERNELS_DONE) # {
518 1.232 lukem .for configfile in ${ALL_KERNELS} # {
519 1.324 dsl build_kernels: kern-${configfile}
520 1.322 dsl kern-${configfile}: .PHONY .MAKE
521 1.254 lukem cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
522 1.232 lukem -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
523 1.255 lukem .if ${MKUPDATE} == "no"
524 1.200 lukem cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
525 1.96 cjs .endif
526 1.218 sommerfe cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
527 1.284 cgd sync
528 1.232 lukem .endfor # ALL_KERNELS # }
529 1.232 lukem .endif # KERNELS_DONE # }
530 1.232 lukem
531 1.324 dsl build_kernelsets: .PHONY
532 1.241 lukem # Create kernel sets from ${KERNEL_SETS} into
533 1.286 cl # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
534 1.232 lukem #
535 1.232 lukem .for configfile in ${KERNEL_SETS} # {
536 1.324 dsl build_kernelsets: kernset-${configfile}
537 1.324 dsl kernset-${configfile}: .PHONY build_kernels snap_pre
538 1.256 dsl @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
539 1.197 thorpej kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
540 1.256 dsl kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
541 1.286 cl kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
542 1.256 dsl pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
543 1.256 dsl cd $${kerndir} && { \
544 1.256 dsl kernels=; newest=; \
545 1.210 lukem for kernel in $${kernlist}; do \
546 1.256 dsl for s in "" $${kernsuffixes}; do \
547 1.256 dsl ks="$${kernel}$${s}"; \
548 1.256 dsl [ -f $${ks} ] || continue; \
549 1.256 dsl kernels="$${kernels} $${ks}"; \
550 1.256 dsl [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
551 1.256 dsl newest=$${ks}; \
552 1.197 thorpej done; \
553 1.256 dsl done; \
554 1.256 dsl [ $${kern_tgz} -nt "$${newest}" ] || { \
555 1.256 dsl echo "echo $${kernels} | $${pax_cmd}"; \
556 1.256 dsl ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
557 1.256 dsl echo ". type=dir optional"; \
558 1.256 dsl for kernel in $${kernels}; do \
559 1.256 dsl echo "./$${kernel} type=file"; \
560 1.256 dsl done ) | eval $${pax_cmd}; \
561 1.256 dsl } \
562 1.256 dsl }
563 1.232 lukem .endfor # KERNEL_SETS # }
564 1.232 lukem
565 1.324 dsl build_releasekernels: .PHONY
566 1.232 lukem # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
567 1.286 cl # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
568 1.232 lukem #
569 1.232 lukem .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
570 1.324 dsl build_releasekernels: releasekern-${configfile}
571 1.324 dsl releasekern-${configfile}: .PHONY build_kernels snap_pre
572 1.256 dsl @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
573 1.197 thorpej kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
574 1.256 dsl kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
575 1.256 dsl cd $${kerndir} && { \
576 1.256 dsl for kernel in $${kernlist}; do \
577 1.256 dsl for s in "" $${kernsuffixes}; do \
578 1.256 dsl ks="$${kernel}$${s}"; \
579 1.256 dsl [ ! -f $${ks} ] && continue; \
580 1.286 cl knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \
581 1.256 dsl [ $${knl_gz} -nt $${ks} ] && continue; \
582 1.256 dsl echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
583 1.256 dsl gzip -c -9 < $${ks} > $${knl_gz}; \
584 1.197 thorpej done; \
585 1.256 dsl done; \
586 1.256 dsl }
587 1.232 lukem .endfor # KERNEL_SETS EXTRA_KERNELS # }
588 1.232 lukem
589 1.242 lukem # snap_md_post --
590 1.242 lukem # Machine dependent distribution media operations.
591 1.242 lukem # Overridden by etc.$MACHINE/Makefile.inc
592 1.242 lukem #
593 1.324 dsl snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
594 1.242 lukem # (empty -- look in the machine-dependent Makefile.inc)
595 1.242 lukem
596 1.242 lukem
597 1.242 lukem clean:
598 1.246 lukem -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
599 1.7 cgd
600 1.1 cgd .include <bsd.prog.mk>
601 1.309 tron
602 1.309 tron test:
603 1.309 tron @echo ${OBSOLETE.files}
604