kernel: trap-dependent state restore, trace fixes
[minix.git] / etc / Makefile
blob98e2b56f4292467943d450e7191998bcb5bb0282
1 # $NetBSD: Makefile,v 1.398 2012/08/17 16:59:26 riz Exp $
2 # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
4 # Environment variables without default values:
5 # DESTDIR must be set before anything in this file will work.
6 # RELEASEDIR is where the tarred up stuff for a snapshot or
7 # release will be placed.
9 # Environment variables with default values:
10 # LOCALTIME will set the default local time for the system you
11 # build; it determines what /etc/localtime is symlink'd to.
12 # KERNSRCDIR points to kernel source; it is set by default to ../sys,
13 # but can be overridden.
14 # KERNOBJDIR is the kernel build directory, it defaults to
15 # ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
16 # KERNCONFDIR is where the configuration files for kernels are found;
17 # default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
18 # MKCRYPTO; if not `no', install crypto-related configuration
19 # MKPOSTFIX; if not `no', install postfix configuration
20 # MKUNPRIVED; if not `no', allow non-root installs.
21 # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
23 # Targets:
24 # distribution: makes a full NetBSD distribution in DESTDIR. If
25 # INSTALL_DONE is set, it will not do a `make install.'
26 # if DISTRIBUTION_DONE is set, it will not do anything.
27 # distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
28 # Called by distribution.
29 # snapshot: calls distribution, above, and then tars up the files
30 # into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}.
31 # Any port-dependent stuff for this target is found in
32 # etc.${MACHINE}/Makefile.inc.
33 # release: a synonym for `snapshot'
36 # For MK* vars
37 .include <bsd.own.mk>
39 .include <bsd.sys.mk> # for HOST_SH, TOOL_AWK, ...
40 .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
41 .include <bsd.endian.mk> # For TARGET_ENDIANNESS
43 .MAKEOVERRIDES+= USETOOLS
45 TZDIR= /usr/share/zoneinfo
46 LOCALTIME?= UTC
47 CKSUM?= ${TOOL_CKSUM}
48 MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
49 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
51 # Flags for creating ISO CDROM image
52 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools
53 # Note: At least mkisofs 2.0 should be used.
55 .if !defined(__MINIX)
56 # LSC: We do not yet support iso creation anyway, then do not try to find it.
57 .if !defined(MKISOFS)
58 MKISOFS!= (which mkisofs || echo true)
59 .endif
60 DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
61 # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
62 ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
63 MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \
64 -V ${ISO_VOLID} \
65 -publisher "The NetBSD Project" \
66 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
67 .if ${MKISOFS_FLAGS:N-v}
68 MKISOFS_FLAGS+= -quiet
69 .endif
70 .endif # !defined(__MINIX)
73 # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
74 # are empty, to preserve the old semantics of setting them below with "+=".
76 BIN1=
77 BIN2=
78 BIN3=
80 # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
81 # MD Makefile.inc files can add to this.
82 # NOTE: Parent directories must be listed before subdirectories.
84 INSTALLATION_DIRS= binary binary/sets binary/kernel installation
86 .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
87 .include "etc.${RELEASEMACHINE}/Makefile.inc"
88 .endif
90 # -rw-r--r--
91 BINOWN= root
92 BINGRP= operator
93 UTMPGRP= utmp
94 .if defined(__MINIX)
95 BIN1+= \
96 boot.cfg.default \
97 group hostname.file inet.conf \
98 make.conf man.conf \
99 motd mtab \
100 profile protocols \
101 resolv.conf \
102 rc rc.conf rc.cd rc.subr \
103 rc.daemons.dist rs.inet rs.single \
104 services shells syslog.conf \
105 system.conf \
106 termcap utmp
107 .else
108 BIN1+= bootptab changelist csh.cshrc csh.login \
109 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \
110 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \
111 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \
112 mrouted.conf named.conf netconfig networks newsyslog.conf \
113 nsswitch.conf ntp.conf passwd.conf phones printcap profile protocols \
114 rbootd.conf rc rc.conf rc.local rc.subr rc.shutdown remote rpc \
115 security security.conf services shells shrc sysctl.conf syslog.conf \
116 weekly weekly.conf wscons.conf
118 # Use machine-specific disktab if it exists, or the MI one otherwise
119 .if exists(etc.${MACHINE}/disktab)
120 BIN1+= etc.${MACHINE}/disktab
121 .else
122 BIN1+= disktab
123 .endif
125 .if exists(etc.${MACHINE}/ld.so.conf)
126 BIN1+= etc.${MACHINE}/ld.so.conf
127 .endif
129 .if exists(etc.${MACHINE}/ttyaction)
130 BIN1+= etc.${MACHINE}/ttyaction
131 .endif
133 # -rw-rw-r--
134 .if !empty(DISTRIBVER:M*.99.*)
135 BIN2+= motd.current
136 FILESNAME_motd.current= motd
137 .elif !empty(DISTRIBVER:M*BETA*)
138 BIN2+= motd.beta
139 FILESNAME_motd.beta= motd
140 .elif !empty(DISTRIBVER:M*RC*)
141 BIN2+= motd.rc
142 FILESNAME_motd.rc= motd
143 .elif !empty(DISTRIBVER:M*STABLE*)
144 BIN2+= motd.stable
145 FILESNAME_motd.stable= motd
146 .else
147 BIN2+= motd
148 .endif
150 # -rw-------
151 BIN3+= hosts.equiv
152 .endif # defined(__MINIX)
154 SYSPKG= etc
155 ETC_PKG=-T etc_pkg
156 BASE_PKG=-T base_pkg
157 ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
158 ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
160 .if ${TARGET_ENDIANNESS} == "1234"
161 PWD_MKDB_ENDIAN= -L
162 .elif ${TARGET_ENDIANNESS} == "4321"
163 PWD_MKDB_ENDIAN= -B
164 .else
165 PWD_MKDB_ENDIAN=
166 .endif
169 # distribution --
170 # Build a distribution
172 distribution: .PHONY .MAKE check_DESTDIR distrib-dirs
173 .if !defined(DISTRIBUTION_DONE)
174 .if !defined(INSTALL_DONE)
175 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
176 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
177 .endif # !INSTALL_DONE
178 ${MAKEDIRTARGET} . install-etc-files
179 . if ${MKX11} != "no"
180 . if ${X11FLAVOUR} == "Xorg"
181 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution
182 . else
183 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution
184 . endif
185 . endif
186 . if ${MKEXTSRC} != "no"
187 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution
188 . endif
189 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
190 .endif # !DISTRIBUTION_DONE
193 CLEANFILES+= MAKEDEV
194 .if !defined(__MINIX)
195 MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
196 ${.CURDIR}/etc.${MACHINE}/MAKEDEV.conf
197 ${_MKTARGET_CREATE}
198 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
199 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
200 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
201 > ${.TARGET}
202 .else
203 MAKEDEV:
204 if [ ${MKUNPRIVED} != "yes" ]; then \
205 cd ${DESTDIR}/dev && sh ${NETBSDSRCDIR}/commands/MAKEDEV/MAKEDEV.sh null ;\
206 cd ${DESTDIR}/dev && sh ${NETBSDSRCDIR}/commands/MAKEDEV/MAKEDEV.sh std 2>/dev/null ;\
208 .endif # !defined(__MINIX)
210 RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \
211 DESTDIR EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
212 INSTALLWORLDDIR \
213 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
214 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
215 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
216 MKBFD MKBINUTILS MKCATPAGES \
217 MKCRYPTO MKCRYPTO_RC5 MKCVS \
218 MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
219 MKGCC MKGCCCMDS MKGDB \
220 MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
221 MKKERBEROS MKLDAP MKLINKLIB MKLINT \
222 MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
223 MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
224 MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
225 MKUNPRIVED MKUPDATE MKX11 MKYP \
226 NBUILDJOBS NETBSDSRCDIR \
227 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
228 OBJMACHINE \
229 RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \
230 USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
231 USE_PAM USE_SKEY USE_YP \
232 USETOOLS USR_OBJMACHINE \
233 X11SRCDIR X11FLAVOUR
235 params: .PHONY
236 .for var in ${RELEASEVARS}
237 .if defined(${var})
238 @printf "%20s = '%-s'\n" ${var} ${${var}:Q}
239 .else
240 @printf "%20s = (undefined)\n" ${var}
241 .endif
242 .endfor
244 CLEANFILES+= etc-release
245 etc-release: .EXEC .MAKE
246 ${_MKTARGET_CREATE}
247 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
248 echo ; \
249 cat ${NETBSDSRCDIR}/sys/conf/copyright; \
250 echo ; \
251 echo "Build settings:"; \
252 printf "%20s %s\n" "Build date" "$$(date -u)"; \
253 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \
254 echo ; \
255 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
256 ) >${.OBJDIR}/${.TARGET}
258 install-etc-release: .PHONY etc-release
259 ${_MKMSG_INSTALL} etc/release
260 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
261 etc-release ${DESTDIR}/etc/release
264 FILESDIR= /etc
265 CONFIGFILES=
266 CONFIGSYMLINKS=
268 .for file in ${BIN1}
269 CONFIGFILES+= ${file}
270 FILESMODE_${file:T}= 644
271 .endfor
273 .for file in ${BIN2}
274 CONFIGFILES+= ${file}
275 FILESMODE_${file:T}= 664
276 .endfor
278 .for file in ${BIN3}
279 CONFIGFILES+= ${file}
280 FILESMODE_${file:T}= 600
281 .endfor
283 .if (${MKPOSTFIX} != "no")
284 CONFIGFILES+= aliases
285 FILESDIR_aliases= /etc/mail
286 FILESMODE_aliases= 644
287 .endif
289 .if !defined(__MINIX)
290 CONFIGFILES+= MAKEDEV.local
291 FILESDIR_MAKEDEV.local= /dev
292 FILESMODE_MAKEDEV.local=${BINMODE}
294 CONFIGFILES+= crontab
295 FILESDIR_crontab= /var/cron/tabs
296 FILESNAME_crontab= root
297 FILESMODE_crontab= 600
299 CONFIGFILES+= minfree
300 FILESDIR_minfree= /var/crash
301 FILESMODE_minfree= 600
303 CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
304 /usr/sbin/rmt /etc/rmt
305 .else
306 CONFIGSYMLINKS+= \
307 /usr/lib/cpp /lib/cpp \
308 /usr/log /var/log \
309 /usr/tmp /var/tmp \
310 /usr/pkg/bin/clang /usr/bin/cc \
311 /usr/pkg/bin/strip /usr/bin/strip \
312 /dev/kbdaux /dev/mouse \
313 /proc/mounts /etc/mtab
315 .endif # !defined(__MINIX)
318 # install-etc-files --
319 # Install etc (config) files; not performed by "make build"
321 install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
322 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
323 ${ETC_INSTALL_FILE} -o root -g operator -m 600 \
324 master.passwd ${DESTDIR}/etc
325 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
326 ${DESTDIR}/etc/master.passwd
327 .if defined(__MINIX)
328 # LSC: We need a safe install target for etc files, as this is expected from
329 # our current user base. This safe version only leaves out the master.passwd
330 # file in order not to loose any user account created.
332 # LSC: To ensure minimal modifications, the logic is a bit contrived, i.e. the
333 # NetBSD build system expect install-etc-files to be unsafe, so what was done
334 # is to separate that step into two steps, with the unsafe version refering
335 # (not by dependency, to ensure correct order of actions) the safe step, and
336 # use the following mapping in the main Makefile:
337 # etcforce -> install-etc-files (default NetBSD target)
338 # etcfiles -> install-etc-files-safe (new -safe- target)
339 ${MAKEDIRTARGET} . install-etc-files-safe
341 install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV
342 # LSC Minix administrator group is operator, not wheel
343 .endif # defined(__MINIX)
344 .if ${MKUNPRIVED} != "no"
346 for metaent in passwd pwd.db spwd.db; do \
347 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=operator tags=etc_pkg"; \
348 done; \
349 ) | ${METALOG.add}
350 .endif # MKUNPRIVED != no
351 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys
352 .if !defined(__MINIX)
353 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
354 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc
355 .else
356 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
357 ${.CURDIR}/ttys ${DESTDIR}/etc
358 .endif # !defined(__MINIX)
359 .if exists(etc.${MACHINE}/boot.cfg)
360 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg
361 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
362 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/
363 .endif
364 .if !defined(__MINIX)
365 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV
366 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
367 MAKEDEV ${DESTDIR}/dev
368 .for owner group mode file in \
369 ${BINOWN} operator 664 /etc/dumpdates \
370 ${BINOWN} operator 600 /etc/skeykeys \
371 root wheel 600 /var/at/at.deny \
372 root wheel 644 /var/db/locate.database \
373 ${BINOWN} ${BINGRP} 600 /var/log/authlog \
374 root wheel 600 /var/log/cron \
375 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \
376 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \
377 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \
378 ${BINOWN} ${BINGRP} 600 /var/log/maillog \
379 ${BINOWN} ${BINGRP} 644 /var/log/messages \
380 ${BINOWN} ${BINGRP} 600 /var/log/secure \
381 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \
382 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \
383 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \
384 daemon staff 664 /var/msgs/bounds \
385 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \
386 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \
387 games games 664 /var/games/atc_score \
388 games games 664 /var/games/battlestar.log \
389 games games 664 /var/games/cfscores \
390 games games 664 /var/games/criblog \
391 games games 660 /var/games/hackdir/perm \
392 games games 660 /var/games/hackdir/record \
393 games games 664 /var/games/larn/llog12.0 \
394 games games 664 /var/games/larn/lscore12.0 \
395 games games 664 /var/games/larn/playerids \
396 games games 664 /var/games/robots_roll \
397 games games 664 /var/games/rogue.scores \
398 games games 664 /var/games/saillog \
399 games games 664 /var/games/snakerawscores \
400 games games 664 /var/games/snake.log \
401 games games 664 /var/games/tetris.scores
402 ${_MKMSG_INSTALL} ${DESTDIR}${file}
403 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \
404 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
405 /dev/null ${DESTDIR}${file}; \
406 else true; fi
407 .endfor
408 .for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh
409 ${MAKEDIRTARGET} ${subdir} configinstall
410 .endfor
411 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall
412 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
413 .if (${MKPF} != "no")
414 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall
415 .endif
416 .if (${MKCRYPTO} != "no")
417 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall
418 .endif
419 .if (${MKPOSTFIX} != "no")
420 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall
421 .endif
422 .if (${MKATF} != "no")
423 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall
424 .endif
425 .else # LSC Minix Specific
426 .for owner group mode sdir tdir file in \
427 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ daily \
428 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ dhcptags.conf \
429 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ rc \
430 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/usr/lib/ crontab \
431 ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/ Makefile \
432 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ block \
433 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ singlechar
434 ${_MKMSG_INSTALL} ${DESTDIR}${_dir}${file}
435 if [ ! -e ${tdir} ]; then \
436 mkdir -p ${tdir}; \
437 fi; \
438 if [ ! -e ${tdir}${file} -o -s ${tdir}${file} ]; then \
439 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
440 ${sdir}${file} ${tdir}${file}; \
441 else true; fi
442 .endfor
443 .for subdir in . defaults mtree
444 ${MAKEDIRTARGET} ${subdir} configinstall
445 .endfor
446 ${_MKMSG_INSTALL} ${DESTDIR}/usr/ast and ${DESTDIR}/root
447 for u in ${DESTDIR}/usr/ast ${DESTDIR}/root; do ${INSTALL_DIR} $$u; cp ${NETBSDSRCDIR}/etc/ast/.[aepv]* $$u; done
448 ${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts
449 ${INSTALL_DIR} ${DESTDIR}/usr/lib/fonts
450 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/fonts/*.fnt ${DESTDIR}/usr/lib/fonts/
451 .endif # LSC Minix Specific
454 # install-obsolete-lists --
455 # Install var/db/obsolete set lists; this is performed by "make build"
457 OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
458 .if !defined(__MINIX)
459 OBSOLETE.files= base comp etc games man misc text
460 .else
461 OBSOLETE.files= minix
462 .endif # defined(__MINIX)
463 .if ${MKKMOD} != "no"
464 OBSOLETE.files+= modules
465 .endif
466 .if ${MKATF} != "no"
467 OBSOLETE.files+= tests
468 .endif
469 .if ${MKX11} != "no"
470 OBSOLETE.files+= xbase xcomp xetc xfont xserver
471 .endif
473 # XXX make "makeobsolete" set wise; then generate files respectively
474 install-obsolete-lists: .PHONY .MAKE
475 mkdir -p ${OBSOLETE.dir}
476 .if ${MKX11} != "no"
477 (cd ${NETBSDSRCDIR}/distrib/sets && \
478 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
479 .else
480 (cd ${NETBSDSRCDIR}/distrib/sets && \
481 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
482 .endif
483 .for file in ${OBSOLETE.files}
484 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}
485 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \
486 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \
487 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
488 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \
489 else true; fi
490 .endfor
493 # distrib-dirs --
494 # Populate $DESTDIR with directories needed by NetBSD
496 distrib-dirs: .PHONY check_DESTDIR
497 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs
500 # release, snapshot --
501 # Build a full distribution including kernels & install media.
503 release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post
504 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
505 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
506 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@}
507 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
510 .if !defined(__MINIX)
511 # iso-image --
512 # Standalone target to create a CDROM image after the release
513 # was composed. Should be run after "make release" in src and xsrc.
514 # The do-iso-image is to be called from etc.$MACHINE/Makefile.inc
516 # Note: At least mkisofs 2.0 should be used.
518 CDROM_NAME_ADD?=
519 CDROM_IMAGE?=${RELEASEDIR}/iso/NetBSD-${DISTRIBVER}-${MACHINE}.iso
520 CDROM.dir= ${.OBJDIR}/cdrom.dir
521 CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist
523 iso-image:
525 .if ${MKISOFS} != true
526 do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
527 ${MAKESUMS} -t ${RELEASEDIR}/iso/ '*.iso'
528 @echo "iso-image created as: ${CDROM_IMAGE}"
529 .else
530 do-iso-image:
531 @echo iso-image: mkisofs not found
532 .endif
534 iso-image-setup: .PHONY check_RELEASEDIR
535 rm -f ${CDROM.pathlist}
536 .for extra in README SOURCE_DATE source
537 .if exists(${RELEASEDIR}/${extra})
538 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist}
539 .endif
540 .endfor
541 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist}
542 mkdir -p ${CDROM.dir}
543 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
545 # iso-image-mi --
546 # Create the image after the MD operations have completed.
548 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre
549 @if ! ${MKISOFS} --version; then \
550 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
551 false; \
553 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
554 -o ${CDROM_IMAGE} ${CDROM.dir}
556 # iso-image-md-pre --
557 # Setup ${CDROM.dir} to produce a bootable CD image.
558 # Overridden by etc.$MACHINE/Makefile.inc
560 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
561 # (empty -- look in the machine-dependent Makefile.inc)
563 # iso-image-md-post --
564 # Fixup the CD-image to be bootable.
565 # Overridden by etc.$MACHINE/Makefile.inc
567 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
568 # (empty -- look in the machine-dependent Makefile.inc)
571 # live-image --
572 # Standalone target to create live images after the release was composed.
573 # Should be run after "make release" in src and xsrc.
574 # LIVEIMG_RELEASEDIR specifies where to install live images and
575 # it can be set in MD etc.${MACHINE}/Makefile.inc.
577 LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images
579 live-image: .PHONY check_DESTDIR check_RELEASEDIR
580 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \
581 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR}
582 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz'
584 # install-image --
585 # Standalone target to create installation images
586 # after the release was composed.
587 # Should be run after "make release" in src and xsrc.
588 # INSTIMG_RELEASEDIR specifies where to install live images and
589 # it can be set in MD etc.${MACHINE}/Makefile.inc.
591 INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images
593 install-image: .PHONY check_DESTDIR check_RELEASEDIR
594 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \
595 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR}
596 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz'
597 .endif # !defined(__MINIX)
599 # snap_pre --
600 # Create ${RELEASEDIR} and necessary subdirectories.
602 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
603 ${INSTALL} -d -m 755 ${RELEASEDIR}
604 .if ${MKUPDATE} == "no"
605 # Could be a mount point, ignore the errors
606 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
607 .endif
608 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
609 .for dir in ${INSTALLATION_DIRS}
610 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
611 .endfor
613 # snap_post --
614 # Build the install media and notes from distrib
616 snap_post: .PHONY .MAKE build_kernelsets build_releasekernels
617 .if ${MKUPDATE} == "no"
618 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
619 .endif
620 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
621 ${MAKE} release
623 # build kernels --
624 # This target builds the kernels specified by each port.
625 # A port may specify the following kernels:
627 # KERNEL_SETS The list of kernels that will be
628 # packaged into sets, named
629 # kern-${kernel}.tgz. These kernels
630 # are also placed in the binary/kernel
631 # area of the release package as
632 # netbsd-${kernel}.gz.
634 # EXTRA_KERNELS Additional kernels to place in the
635 # binary/kernel area of the release
636 # package as netbsd-${kernel}.gz, but
637 # which are not placed into sets. This
638 # allows a port to provide e.g. a netbootable
639 # installation kernel containing a ramdisk.
641 # BUILD_KERNELS Additional kernels to build which are
642 # not placed into sets nor into the
643 # binary/kernel area of the release
644 # package. These are typically kernels
645 # that are built for inclusion only in
646 # installation disk/CD-ROM/tape images.
648 # A port may also specify KERNEL_SUFFIXES, which is an optional list
649 # of filename suffixes for kernels to include in the kernel sets and
650 # in the binary/kernel area of the release package (e.g. "netbsd" vs.
651 # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
652 # with these suffixes do not exist in the kernel build directory.
655 # A list of all the kernels to build, which can be overridden from
656 # external sources (such as make(1)'s environment or command line)
658 ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
660 GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \
661 END{ if (found == 0) print "netbsd"; }'
663 build_kernels: .PHONY
664 # Configure & compile kernels listed in ${ALL_KERNELS}
666 # The 'sync' is so that all writes during the build are pushed back
667 # to the disk. Not having it causes problems on some host systems
668 # (e.g. Linux) when building on NFS.
670 .if !defined(KERNELS_DONE) # {
671 .for configfile in ${ALL_KERNELS} # {
672 build_kernels: kern-${configfile}
673 kern-${configfile}: .PHONY .MAKE
674 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
675 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
676 .if ${MKUPDATE} == "no"
677 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
678 .endif
679 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
680 sync
681 .endfor # ALL_KERNELS # }
682 .endif # KERNELS_DONE # }
684 build_kernelsets: .PHONY
685 # Create kernel sets from ${KERNEL_SETS} into
686 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
688 .for configfile in ${KERNEL_SETS} # {
689 build_kernelsets: kernset-${configfile}
690 kernset-${configfile}: .PHONY build_kernels snap_pre
691 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \
692 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
693 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
694 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
695 pax_cmd="COMPRESS_PROGRAM=${TOOL_GZIP:Q} GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
696 cd $${kerndir} && { \
697 kernels=; newest=; \
698 for kernel in $${kernlist}; do \
699 for s in "" $${kernsuffixes}; do \
700 ks="$${kernel}$${s}"; \
701 [ -f $${ks} ] || continue; \
702 kernels="$${kernels} $${ks}"; \
703 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
704 newest=$${ks}; \
705 done; \
706 done; \
707 [ $${kern_tgz} -nt "$${newest}" ] || { \
708 echo "echo $${kernels} | $${pax_cmd}"; \
709 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
710 echo ". type=dir optional"; \
711 for kernel in $${kernels}; do \
712 echo "./$${kernel} type=file"; \
713 done ) | eval $${pax_cmd}; \
716 .endfor # KERNEL_SETS # }
718 build_releasekernels: .PHONY
719 # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
720 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
722 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
723 build_releasekernels: releasekern-${configfile}
724 releasekern-${configfile}: .PHONY build_kernels snap_pre
725 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \
726 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
727 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
728 cd $${kerndir} && { \
729 for kernel in $${kernlist}; do \
730 for s in "" $${kernsuffixes}; do \
731 ks="$${kernel}$${s}"; \
732 [ ! -f $${ks} ] && continue; \
733 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \
734 [ $${knl_gz} -nt $${ks} ] && continue; \
735 rm -f $${knl_gz}; \
736 echo "${TOOL_GZIP} -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
737 ${TOOL_GZIP} -c -9 < $${ks} > $${knl_gz}; \
738 done; \
739 done; \
741 .endfor # KERNEL_SETS EXTRA_KERNELS # }
743 # snap_md_post --
744 # Machine dependent distribution media operations.
745 # Overridden by etc.$MACHINE/Makefile.inc
747 snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
748 # (empty -- look in the machine-dependent Makefile.inc)
751 clean:
752 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
754 .if !defined(__MINIX)
755 SUBDIR= defaults rc.d mtree
756 .else
757 SUBDIR= devmand defaults mtree
758 .endif # defined(__MINIX)
760 .include <bsd.prog.mk>
761 .include <bsd.subdir.mk>
763 test:
764 @echo ${OBSOLETE.files}