Annotation of src/etc/Makefile, Revision 1.462
1.462 ! nia 1: # $NetBSD: Makefile,v 1.461 2022/05/28 11:17:35 nia Exp $
1.66 mikel 2: # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
1.1 cgd 3:
1.96 cjs 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.
8: #
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
1.172 jlam 15: # ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
1.96 cjs 16: # KERNCONFDIR is where the configuration files for kernels are found;
17: # default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
1.304 lukem 18: # MKPOSTFIX; if not `no', install postfix configuration
1.270 lukem 19: # MKUNPRIVED; if not `no', allow non-root installs.
1.255 lukem 20: # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
1.154 thorpej 21: #
1.96 cjs 22: # Targets:
23: # distribution: makes a full NetBSD distribution in DESTDIR. If
24: # INSTALL_DONE is set, it will not do a `make install.'
1.182 chs 25: # if DISTRIBUTION_DONE is set, it will not do anything.
1.96 cjs 26: # distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
27: # Called by distribution.
28: # snapshot: calls distribution, above, and then tars up the files
1.286 cl 29: # into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}.
1.241 lukem 30: # Any port-dependent stuff for this target is found in
31: # etc.${MACHINE}/Makefile.inc.
1.106 cjs 32: # release: a synonym for `snapshot'
1.242 lukem 33: #
1.199 tv 34:
1.270 lukem 35: # For MK* vars
1.90 kim 36: .include <bsd.own.mk>
1.187 jmc 37:
1.260 lukem 38: .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
39: .include <bsd.endian.mk> # For TARGET_ENDIANNESS
1.252 lukem 40:
1.187 jmc 41: .MAKEOVERRIDES+= USETOOLS
1.90 kim 42:
1.23 cgd 43: TZDIR= /usr/share/zoneinfo
1.157 kleink 44: LOCALTIME?= UTC
1.283 agc 45: CKSUM?= ${TOOL_CKSUM}
1.330 christos 46: MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
1.266 lukem 47: DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
1.19 deraadt 48:
1.419 apb 49: GZIP_FLAGS= -9 ${GZIP_N_FLAG}
50:
1.161 hubertf 51: # Flags for creating ISO CDROM image
1.320 apb 52: # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools
1.242 lukem 53: # Note: At least mkisofs 2.0 should be used.
54: #
1.341 bouyer 55: .if !defined(MKISOFS)
1.407 uebayasi 56: MKISOFS!= (which mkisofs || echo true) 2>/dev/null
1.341 bouyer 57: .endif
1.260 lukem 58: DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
1.224 bjh21 59: # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
1.306 martin 60: ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
61: MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \
1.224 bjh21 62: -V ${ISO_VOLID} \
1.331 lukem 63: -publisher "The NetBSD Project" \
1.286 cl 64: -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
1.306 martin 65: .if ${MKISOFS_FLAGS:N-v}
66: MKISOFS_FLAGS+= -quiet
67: .endif
68:
1.426 christos 69: # Reproducible build parameters
70: .if ${MKREPRO:Uno} == "no"
71: BUILDER!= echo $${USER-root}@$$(hostname)
72: .else
73: BUILDER= builder@localhost.NetBSD.org
74: .endif
75: .if ${MKREPRO_TIMESTAMP:Uno} == "no"
76: PAX_TIMESTAMP=
77: BUILD_DATE!= date -u
78: .else
79: PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
1.450 christos 80: BUILD_DATE!= ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}"
1.426 christos 81: .endif
1.1 cgd 82:
1.80 jonathan 83: # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
1.316 hubertf 84: # are empty, to preserve the old semantics of setting them below with "+=".
1.242 lukem 85: #
1.200 lukem 86: BIN1=
1.80 jonathan 87: BIN2=
88: BIN3=
89:
1.286 cl 90: # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
1.241 lukem 91: # MD Makefile.inc files can add to this.
1.117 simonb 92: # NOTE: Parent directories must be listed before subdirectories.
1.242 lukem 93: #
1.217 lukem 94: INSTALLATION_DIRS= binary binary/sets binary/kernel installation
1.117 simonb 95:
1.286 cl 96: .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
97: .include "etc.${RELEASEMACHINE}/Makefile.inc"
1.71 cjs 98: .endif
1.32 jtc 99:
1.21 cgd 100: # -rw-r--r--
101: BINOWN= root
102: BINGRP= wheel
1.227 perry 103: UTMPGRP= utmp
1.432 christos 104: BIN1+= auto_master bootptab changelist csh.cshrc csh.login \
1.345 adrianp 105: csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \
1.370 mbalmer 106: ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \
1.345 adrianp 107: locate.conf login.conf mailer.conf man.conf monthly monthly.conf \
1.459 nia 108: named.conf netconfig networks newsyslog.conf \
1.461 nia 109: nsswitch.conf passwd.conf pkgpath.conf phones printcap \
1.408 agc 110: profile protocols rbootd.conf rc rc.conf rc.local rc.subr \
111: rc.shutdown remote rpc security security.conf services shells \
112: shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf
1.291 lukem 113:
1.460 nia 114: .if ${MKMROUTING} != "no"
1.459 nia 115: BIN1+= mrouted.conf
116: .endif
117:
1.461 nia 118: .if ${MKNTP} != "no"
1.462 ! nia 119: BIN1+= ntp.conf
1.461 nia 120: .endif
121:
1.242 lukem 122: # Use machine-specific disktab if it exists, or the MI one otherwise
1.236 jdolecek 123: .if exists(etc.${MACHINE}/disktab)
124: BIN1+= etc.${MACHINE}/disktab
125: .else
126: BIN1+= disktab
127: .endif
1.105 mycroft 128:
1.433 ryo 129: .if exists(etc.${MACHINE}/ld.so.conf) && \
1.447 jakllsch 130: empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*)
1.234 jdolecek 131: BIN1+= etc.${MACHINE}/ld.so.conf
1.152 perry 132: .endif
133:
1.234 jdolecek 134: .if exists(etc.${MACHINE}/ttyaction)
135: BIN1+= etc.${MACHINE}/ttyaction
1.105 mycroft 136: .endif
1.1 cgd 137:
1.46 deraadt 138: # -rw-rw-r--
1.80 jonathan 139: BIN2+= motd
1.400 apb 140: FILESBUILD_motd= YES
1.1 cgd 141:
1.77 mycroft 142: # -rw-------
1.438 roy 143: BIN3+= hosts.equiv wpa_supplicant.conf
1.77 mycroft 144:
1.291 lukem 145: SYSPKG= etc
1.230 perry 146: ETC_PKG=-T etc_pkg
147: BASE_PKG=-T base_pkg
1.242 lukem 148: ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
1.261 cl 149: ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
1.230 perry 150:
1.191 tv 151: .if ${TARGET_ENDIANNESS} == "1234"
1.252 lukem 152: PWD_MKDB_ENDIAN= -L
1.191 tv 153: .elif ${TARGET_ENDIANNESS} == "4321"
1.252 lukem 154: PWD_MKDB_ENDIAN= -B
1.170 jdolecek 155: .else
1.252 lukem 156: PWD_MKDB_ENDIAN=
1.191 tv 157: .endif
1.149 sjg 158:
159:
1.242 lukem 160: # distribution --
161: # Build a distribution
162: #
1.324 dsl 163: distribution: .PHONY .MAKE check_DESTDIR distrib-dirs
1.182 chs 164: .if !defined(DISTRIBUTION_DONE)
1.87 perry 165: .if !defined(INSTALL_DONE)
1.285 lukem 166: ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
167: ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
1.200 lukem 168: .endif # !INSTALL_DONE
1.456 christos 169: ${MAKEDIRTARGET} . install-debugkernels
1.285 lukem 170: ${MAKEDIRTARGET} . install-etc-files
1.360 mrg 171: . if ${MKX11} != "no"
1.358 lukem 172: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution
1.360 mrg 173: . endif
1.374 uebayasi 174: . if ${MKEXTSRC} != "no"
175: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution
176: . endif
1.285 lukem 177: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
1.200 lukem 178: .endif # !DISTRIBUTION_DONE
1.193 thorpej 179:
1.266 lukem 180:
1.400 apb 181: # motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER
182: #
183: .if !empty(DISTRIBVER:M*.99.*)
184: MOTD_SOURCE= motd.current
185: .elif !empty(DISTRIBVER:M*BETA*)
186: MOTD_SOURCE= motd.beta
187: .elif !empty(DISTRIBVER:M*RC*)
188: MOTD_SOURCE= motd.rc
189: .else
190: MOTD_SOURCE= motd.default
191: .endif
192: CLEANFILES+= motd
193: motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS}
194: ${_MKTARGET_CREATE}
195: ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET}
196:
1.340 apb 197: CLEANFILES+= MAKEDEV
1.421 matt 198: MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}}
1.386 uebayasi 199: MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
1.421 matt 200: ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf
1.263 lukem 201: ${_MKTARGET_CREATE}
1.421 matt 202: MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
1.264 lukem 203: NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
1.359 apb 204: ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
205: > ${.TARGET}
1.257 jdolecek 206:
1.401 apb 207: .include "${NETBSDSRCDIR}/etc/Makefile.params"
1.425 christos 208:
1.272 lukem 209: CLEANFILES+= etc-release
1.322 dsl 210: etc-release: .EXEC .MAKE
1.266 lukem 211: ${_MKTARGET_CREATE}
212: @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
213: echo ; \
1.269 lukem 214: cat ${NETBSDSRCDIR}/sys/conf/copyright; \
1.266 lukem 215: echo ; \
1.416 apb 216: echo "Build information:"; \
1.425 christos 217: printf "%20s %s\n" "Build date" "${BUILD_DATE}"; \
218: printf "%20s %s\n" "Built by" "${BUILDER}"; \
1.414 apb 219: if [ -n "${BUILDID}" ]; then \
1.416 apb 220: printf "%20s %s\n" "Build ID" "${BUILDID}" ; \
221: fi ; \
222: if [ -n "${BUILDINFO}" ]; then \
223: echo ; \
224: info="$$(printf "%b" ${BUILDINFO:Q})" ; \
225: printf "%s\n" "$${info}" \
226: | ${TOOL_SED} -e 's/^/ /' ; \
1.414 apb 227: fi ; \
1.281 lukem 228: echo ; \
1.416 apb 229: echo "Build settings:"; \
230: echo ; \
1.401 apb 231: ${PRINT_PARAMS} ; \
1.276 lukem 232: ) >${.OBJDIR}/${.TARGET}
1.266 lukem 233:
1.275 lukem 234: install-etc-release: .PHONY etc-release
1.272 lukem 235: ${_MKMSG_INSTALL} etc/release
1.266 lukem 236: ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
1.272 lukem 237: etc-release ${DESTDIR}/etc/release
1.242 lukem 238:
1.291 lukem 239:
240: FILESDIR= /etc
241: CONFIGFILES=
242: CONFIGSYMLINKS=
243:
244: .for file in ${BIN1}
245: CONFIGFILES+= ${file}
246: FILESMODE_${file:T}= 644
247: .endfor
248:
249: .for file in ${BIN2}
250: CONFIGFILES+= ${file}
251: FILESMODE_${file:T}= 664
252: .endfor
253:
254: .for file in ${BIN3}
255: CONFIGFILES+= ${file}
256: FILESMODE_${file:T}= 600
257: .endfor
258:
1.327 tron 259: .if (${MKPOSTFIX} != "no")
1.291 lukem 260: CONFIGFILES+= aliases
261: FILESDIR_aliases= /etc/mail
262: FILESMODE_aliases= 644
1.327 tron 263: .endif
1.291 lukem 264:
265: CONFIGFILES+= MAKEDEV.local
266: FILESDIR_MAKEDEV.local= /dev
267: FILESMODE_MAKEDEV.local=${BINMODE}
268:
269: CONFIGFILES+= crontab
270: FILESDIR_crontab= /var/cron/tabs
271: FILESNAME_crontab= root
272: FILESMODE_crontab= 600
273:
274: CONFIGFILES+= minfree
275: FILESDIR_minfree= /var/crash
276: FILESMODE_minfree= 600
277:
278: CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
279: /usr/sbin/rmt /etc/rmt
280:
281:
1.242 lukem 282: # install-etc-files --
283: # Install etc (config) files; not performed by "make build"
284: #
1.340 apb 285: install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
1.291 lukem 286: ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
1.230 perry 287: ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
288: master.passwd ${DESTDIR}/etc
1.254 lukem 289: ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
1.230 perry 290: ${DESTDIR}/etc/master.passwd
1.255 lukem 291: .if ${MKUNPRIVED} != "no"
1.222 lukem 292: ( \
1.403 christos 293: mode=0600; \
294: for metaent in spwd.db passwd pwd.db; do \
295: echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \
296: mode=0644; \
1.246 lukem 297: done; \
1.239 lukem 298: ) | ${METALOG.add}
1.255 lukem 299: .endif # MKUNPRIVED != no
1.291 lukem 300: ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys
1.421 matt 301: .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
1.289 christos 302: ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
1.298 christos 303: ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc
1.421 matt 304: .else
305: ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
306: ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc
307: .endif
1.351 ad 308: .if exists(etc.${MACHINE}/boot.cfg)
309: ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg
310: ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
311: ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/
312: .endif
1.291 lukem 313: ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV
1.259 ross 314: ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
1.257 jdolecek 315: MAKEDEV ${DESTDIR}/dev
1.291 lukem 316: .for owner group mode file in \
317: ${BINOWN} operator 664 /etc/dumpdates \
318: ${BINOWN} operator 600 /etc/skeykeys \
319: root wheel 600 /var/at/at.deny \
1.378 dholland 320: root wheel 644 /var/db/locate.database \
1.291 lukem 321: ${BINOWN} ${BINGRP} 600 /var/log/authlog \
322: root wheel 600 /var/log/cron \
1.313 lukem 323: ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \
324: ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \
1.291 lukem 325: ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \
326: ${BINOWN} ${BINGRP} 600 /var/log/maillog \
327: ${BINOWN} ${BINGRP} 644 /var/log/messages \
328: ${BINOWN} ${BINGRP} 600 /var/log/secure \
1.313 lukem 329: ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \
330: ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \
1.291 lukem 331: ${BINOWN} ${BINGRP} 600 /var/log/xferlog \
332: daemon staff 664 /var/msgs/bounds \
333: ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \
334: ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \
335: games games 664 /var/games/atc_score \
336: games games 664 /var/games/battlestar.log \
337: games games 664 /var/games/cfscores \
338: games games 664 /var/games/criblog \
339: games games 660 /var/games/hackdir/perm \
340: games games 660 /var/games/hackdir/record \
341: games games 664 /var/games/larn/llog12.0 \
342: games games 664 /var/games/larn/lscore12.0 \
343: games games 664 /var/games/larn/playerids \
344: games games 664 /var/games/robots_roll \
345: games games 664 /var/games/rogue.scores \
346: games games 664 /var/games/saillog \
347: games games 664 /var/games/snakerawscores \
348: games games 664 /var/games/snake.log \
349: games games 664 /var/games/tetris.scores
350: ${_MKMSG_INSTALL} ${DESTDIR}${file}
1.385 uebayasi 351: if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \
352: ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
1.440 gson 353: /dev/null ${DESTDIR}${file}; \
1.385 uebayasi 354: else true; fi
1.291 lukem 355: .endfor
1.432 christos 356: .for subdir in . defaults autofs bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh
1.291 lukem 357: ${MAKEDIRTARGET} ${subdir} configinstall
358: .endfor
1.357 joerg 359: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall
1.287 lukem 360: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
1.303 peter 361: .if (${MKPF} != "no")
1.294 yamt 362: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall
1.303 peter 363: .endif
1.369 mrg 364: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall
1.304 lukem 365: .if (${MKPOSTFIX} != "no")
1.367 tron 366: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall
1.304 lukem 367: .endif
1.363 jmmv 368: .if (${MKATF} != "no")
369: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall
370: .endif
1.406 jmmv 371: .if (${MKKYUA} != "no")
372: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall
373: .endif
1.247 lukem 374:
375:
376: # install-obsolete-lists --
377: # Install var/db/obsolete set lists; this is performed by "make build"
378: #
379: OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
1.452 maya 380: OBSOLETE.files= base comp etc games gpufw man misc rescue text
1.405 matt 381: .if ${MKDEBUG} != "no"
382: OBSOLETE.files+= debug
383: .endif
1.445 jmcneill 384: .if ${MKDTB} != "no"
385: OBSOLETE.files+= dtb
386: .endif
1.376 he 387: .if ${MKKMOD} != "no"
388: OBSOLETE.files+= modules
389: .endif
1.383 njoly 390: .if ${MKATF} != "no"
391: OBSOLETE.files+= tests
392: .endif
1.360 mrg 393: .if ${MKX11} != "no"
1.311 lukem 394: OBSOLETE.files+= xbase xcomp xetc xfont xserver
1.449 martin 395: .if ${MKDEBUG} != "no"
396: OBSOLETE.files+= xdebug
397: .endif
1.307 tron 398: .endif
1.247 lukem 399:
1.387 uebayasi 400: # XXX make "makeobsolete" set wise; then generate files respectively
1.322 dsl 401: install-obsolete-lists: .PHONY .MAKE
1.246 lukem 402: mkdir -p ${OBSOLETE.dir}
1.360 mrg 403: .if ${MKX11} != "no"
1.307 tron 404: (cd ${NETBSDSRCDIR}/distrib/sets && \
1.364 sketch 405: AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
1.307 tron 406: .else
1.253 lukem 407: (cd ${NETBSDSRCDIR}/distrib/sets && \
1.364 sketch 408: AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
1.307 tron 409: .endif
1.246 lukem 410: .for file in ${OBSOLETE.files}
1.291 lukem 411: ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}
1.387 uebayasi 412: if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \
413: ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \
414: ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
415: ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \
416: else true; fi
1.246 lukem 417: .endfor
1.1 cgd 418:
1.242 lukem 419:
420: # distrib-dirs --
421: # Populate $DESTDIR with directories needed by NetBSD
422: #
1.371 mrg 423: distrib-dirs: .PHONY check_DESTDIR
424: cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs
1.255 lukem 425:
1.437 martin 426: COMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}}
1.434 martin 427: XZ_OPT=-9
1.437 martin 428: TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz}
1.242 lukem 429:
430: # release, snapshot --
431: # Build a full distribution including kernels & install media.
432: #
1.324 dsl 433: release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post
1.285 lukem 434: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
1.315 jmc 435: ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
1.434 martin 436: ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.${TAR_SUFF}@}
1.286 cl 437: ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
1.161 hubertf 438:
1.242 lukem 439:
440: # iso-image --
441: # Standalone target to create a CDROM image after the release
442: # was composed. Should be run after "make release" in src and xsrc.
1.341 bouyer 443: # The do-iso-image is to be called from etc.$MACHINE/Makefile.inc
1.242 lukem 444: #
1.245 lukem 445: # Note: At least mkisofs 2.0 should be used.
1.242 lukem 446: #
1.292 he 447: CDROM_NAME_ADD?=
1.415 martin 448: CDROM_IMAGE?=${RELEASEDIR}/images/NetBSD-${DISTRIBVER}-${MACHINE}.iso
1.319 apb 449: CDROM.dir= ${.OBJDIR}/cdrom.dir
450: CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist
1.242 lukem 451:
1.341 bouyer 452: iso-image:
453:
454: .if ${MKISOFS} != true
455: do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
1.415 martin 456: ${MAKESUMS} -t ${RELEASEDIR}/images/ '*.iso'
1.395 joerg 457: @echo "iso-image created as: ${CDROM_IMAGE}"
1.341 bouyer 458: .else
459: do-iso-image:
460: @echo iso-image: mkisofs not found
461: .endif
1.161 hubertf 462:
1.275 lukem 463: iso-image-setup: .PHONY check_RELEASEDIR
1.242 lukem 464: rm -f ${CDROM.pathlist}
1.302 fredb 465: .for extra in README SOURCE_DATE source
466: .if exists(${RELEASEDIR}/${extra})
467: echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist}
468: .endif
469: .endfor
1.342 bad 470: echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist}
1.242 lukem 471: mkdir -p ${CDROM.dir}
1.415 martin 472:
473: check_imagedir:
474: mkdir -p ${RELEASEDIR}/images
1.242 lukem 475:
1.248 lukem 476: # iso-image-mi --
1.242 lukem 477: # Create the image after the MD operations have completed.
1.248 lukem 478: #
1.415 martin 479: iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir
1.242 lukem 480: @if ! ${MKISOFS} --version; then \
1.320 apb 481: echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
1.242 lukem 482: false; \
1.161 hubertf 483: fi
1.242 lukem 484: ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
1.395 joerg 485: -o ${CDROM_IMAGE} ${CDROM.dir}
1.242 lukem 486:
1.248 lukem 487: # iso-image-md-pre --
1.242 lukem 488: # Setup ${CDROM.dir} to produce a bootable CD image.
489: # Overridden by etc.$MACHINE/Makefile.inc
490: #
1.324 dsl 491: iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
1.242 lukem 492: # (empty -- look in the machine-dependent Makefile.inc)
1.161 hubertf 493:
1.248 lukem 494: # iso-image-md-post --
1.242 lukem 495: # Fixup the CD-image to be bootable.
496: # Overridden by etc.$MACHINE/Makefile.inc
497: #
1.324 dsl 498: iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
1.242 lukem 499: # (empty -- look in the machine-dependent Makefile.inc)
1.41 cgd 500:
1.242 lukem 501:
1.396 tsutsui 502: # live-image --
503: # Standalone target to create live images after the release was composed.
504: # Should be run after "make release" in src and xsrc.
505: # LIVEIMG_RELEASEDIR specifies where to install live images and
506: # it can be set in MD etc.${MACHINE}/Makefile.inc.
507: #
1.398 riz 508: LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images
1.396 tsutsui 509:
510: live-image: .PHONY check_DESTDIR check_RELEASEDIR
511: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \
512: LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR}
513: ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz'
514:
515: # install-image --
516: # Standalone target to create installation images
517: # after the release was composed.
518: # Should be run after "make release" in src and xsrc.
519: # INSTIMG_RELEASEDIR specifies where to install live images and
520: # it can be set in MD etc.${MACHINE}/Makefile.inc.
521: #
1.398 riz 522: INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images
1.396 tsutsui 523:
524: install-image: .PHONY check_DESTDIR check_RELEASEDIR
525: ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \
526: INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR}
527: ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz'
528:
1.242 lukem 529: # snap_pre --
530: # Create ${RELEASEDIR} and necessary subdirectories.
531: #
1.324 dsl 532: snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
1.241 lukem 533: ${INSTALL} -d -m 755 ${RELEASEDIR}
1.255 lukem 534: .if ${MKUPDATE} == "no"
1.168 jmc 535: # Could be a mount point, ignore the errors
1.286 cl 536: -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
1.240 lukem 537: .endif
1.286 cl 538: ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
1.117 simonb 539: .for dir in ${INSTALLATION_DIRS}
1.286 cl 540: ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
1.117 simonb 541: .endfor
1.96 cjs 542:
1.242 lukem 543: # snap_post --
544: # Build the install media and notes from distrib
545: #
1.324 dsl 546: snap_post: .PHONY .MAKE build_kernelsets build_releasekernels
1.255 lukem 547: .if ${MKUPDATE} == "no"
1.233 lukem 548: cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
549: .endif
550: cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
551: ${MAKE} release
552:
1.324 dsl 553: # build kernels --
1.242 lukem 554: # This target builds the kernels specified by each port.
555: # A port may specify the following kernels:
1.196 thorpej 556: #
557: # KERNEL_SETS The list of kernels that will be
558: # packaged into sets, named
1.436 martin 559: # kern-${kernel}.tgz (or .tar.xz).
560: # These kernels are also placed in the
561: # binary/kernel area of the release package
562: # as netbsd-${kernel}.gz.
1.196 thorpej 563: #
564: # EXTRA_KERNELS Additional kernels to place in the
1.203 chs 565: # binary/kernel area of the release
1.196 thorpej 566: # package as netbsd-${kernel}.gz, but
567: # which are not placed into sets. This
568: # allows a port to provide e.g. a netbootable
569: # installation kernel containing a ramdisk.
570: #
571: # BUILD_KERNELS Additional kernels to build which are
572: # not placed into sets nor into the
1.203 chs 573: # binary/kernel area of the release
1.196 thorpej 574: # package. These are typically kernels
575: # that are built for inclusion only in
576: # installation disk/CD-ROM/tape images.
1.116 fair 577: #
1.242 lukem 578: # A port may also specify KERNEL_SUFFIXES, which is an optional list
579: # of filename suffixes for kernels to include in the kernel sets and
580: # in the binary/kernel area of the release package (e.g. "netbsd" vs.
581: # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
582: # with these suffixes do not exist in the kernel build directory.
1.197 thorpej 583: #
1.229 lukem 584: #
585: # A list of all the kernels to build, which can be overridden from
586: # external sources (such as make(1)'s environment or command line)
587: #
588: ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
1.402 mlelstv 589: .export ALL_KERNELS
1.242 lukem 590:
1.359 apb 591: GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \
1.116 fair 592: END{ if (found == 0) print "netbsd"; }'
1.242 lukem 593:
1.324 dsl 594: build_kernels: .PHONY
1.232 lukem 595: # Configure & compile kernels listed in ${ALL_KERNELS}
596: #
1.201 lukem 597: .if !defined(KERNELS_DONE) # {
1.424 uebayasi 598: .for configfile in ${ALL_KERNELS:O:u} # {
1.324 dsl 599: build_kernels: kern-${configfile}
1.322 dsl 600: kern-${configfile}: .PHONY .MAKE
1.422 uebayasi 601: cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \
1.455 christos 602: ${MKDEBUGKERNEL == "yes" :? -DDEBUG=-g :} \
1.439 martin 603: -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
1.255 lukem 604: .if ${MKUPDATE} == "no"
1.427 christos 605: ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} distclean
1.96 cjs 606: .endif
1.427 christos 607: ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} depend && \
1.456 christos 608: ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} && \
609: ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} debuginstall
1.232 lukem 610: .endfor # ALL_KERNELS # }
611: .endif # KERNELS_DONE # }
612:
1.324 dsl 613: build_kernelsets: .PHONY
1.241 lukem 614: # Create kernel sets from ${KERNEL_SETS} into
1.286 cl 615: # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
1.232 lukem 616: #
1.424 uebayasi 617: .for configfile in ${KERNEL_SETS:O:u} # {
618: .for configsel in ${ALL_KERNELS:O:u}
1.402 mlelstv 619: .if ${configfile} == ${configsel}
1.324 dsl 620: build_kernelsets: kernset-${configfile}
621: kernset-${configfile}: .PHONY build_kernels snap_pre
1.430 christos 622: @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \
1.197 thorpej 623: kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
1.256 dsl 624: kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
1.434 martin 625: kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.${TAR_SUFF}; \
626: pax_cmd="GZIP=${GZIP_FLAGS:Q} XZ_OPT=${XZ_OPT:Q} ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program ${COMPRESS_PROGRAM:Q} -O -w -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
1.256 dsl 627: cd $${kerndir} && { \
628: kernels=; newest=; \
1.210 lukem 629: for kernel in $${kernlist}; do \
1.256 dsl 630: for s in "" $${kernsuffixes}; do \
631: ks="$${kernel}$${s}"; \
632: [ -f $${ks} ] || continue; \
633: kernels="$${kernels} $${ks}"; \
1.442 christos 634: [ -z "$${newest}" -o $${ks} \
635: -nt "$${newest}" ] && newest=$${ks}; \
1.455 christos 636: [ ${MKDEBUGKERNEL} = "no" -o \
1.458 kre 637: ! -f $${ks}.gdb ] && continue; \
1.455 christos 638: kernels="$${kernels} $${ks}.gdb"; \
1.197 thorpej 639: done; \
1.256 dsl 640: done; \
641: [ $${kern_tgz} -nt "$${newest}" ] || { \
642: echo "echo $${kernels} | $${pax_cmd}"; \
1.444 christos 643: if [ ${KERNEL_DIR} = "yes" ]; then \
1.442 christos 644: tmpdir=kernel$$; \
645: trap "rm -fr $${tmpdir}" 0 1 2 3 15; \
646: mkdir -p $${tmpdir}/netbsd; \
647: d=./netbsd; \
648: cd $${tmpdir}; \
649: else \
650: d=.; \
651: fi; \
1.256 dsl 652: ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
653: echo ". type=dir optional"; \
1.442 christos 654: if [ ${KERNEL_DIR} = "yes" ]; then \
655: echo "./netbsd type=dir optional"; \
656: fi; \
1.256 dsl 657: for kernel in $${kernels}; do \
1.442 christos 658: if [ ${KERNEL_DIR} = "yes" ]; then \
659: newname=$$(echo $${kernel} | \
660: ${TOOL_SED} -e s/netbsd/kernel/); \
661: ln ../$${kernel} ./netbsd/$${newname}; \
662: else \
663: newname=$${kernel}; \
664: fi; \
665: echo "$${d}/$${newname} type=file"; \
1.256 dsl 666: done ) | eval $${pax_cmd}; \
1.442 christos 667: if [ ${KERNEL_DIR} = "yes" ]; then \
668: mv $${kern_tgz} ..; \
669: fi; \
1.256 dsl 670: } \
671: }
1.402 mlelstv 672: .endif
673: .endfor
1.232 lukem 674: .endfor # KERNEL_SETS # }
675:
1.324 dsl 676: build_releasekernels: .PHONY
1.232 lukem 677: # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
1.286 cl 678: # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
1.232 lukem 679: #
1.424 uebayasi 680: .for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # {
681: .for configsel in ${ALL_KERNELS:O:u}
1.402 mlelstv 682: .if ${configfile} == ${configsel}
1.324 dsl 683: build_releasekernels: releasekern-${configfile}
684: releasekern-${configfile}: .PHONY build_kernels snap_pre
1.430 christos 685: @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \
1.197 thorpej 686: kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
1.256 dsl 687: kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
1.429 christos 688: dest="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"; \
1.256 dsl 689: cd $${kerndir} && { \
690: for kernel in $${kernlist}; do \
691: for s in "" $${kernsuffixes}; do \
692: ks="$${kernel}$${s}"; \
693: [ ! -f $${ks} ] && continue; \
1.429 christos 694: knl_gz="$${dest}/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \
1.256 dsl 695: [ $${knl_gz} -nt $${ks} ] && continue; \
1.352 gdt 696: rm -f $${knl_gz}; \
1.419 apb 697: echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \
698: ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \
1.197 thorpej 699: done; \
1.256 dsl 700: done; \
701: }
1.402 mlelstv 702: .endif
703: .endfor
1.232 lukem 704: .endfor # KERNEL_SETS EXTRA_KERNELS # }
705:
1.456 christos 706: # install-debugkernels:
707: # Create fake kernel debug files to satisfy the sets requirements
708: # They will be later replaced with the real ones if we are building
709: # kernels. This mess is needed because checkflist runs before the
710: # kernels are built. It should really run before the sets are build.
711: install-debugkernels:
712: .if ${MKDEBUG:Uno} == "yes"
1.457 christos 713: @for i in $$(${NETBSDSRCDIR}/distrib/sets/makeflist debug | \
714: ${TOOL_GREP} -E '^./usr/libdata/debug/(nfs)?netbsd-'); do \
715: echo touch ${DESTDIR}/$$i; \
716: touch ${DESTDIR}/$$i; \
717: done
1.456 christos 718: . for k in ${ALL_KERNELS}
719: install-debugkernels: ${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug
720:
721: ${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug:
722: ${_MKTARGET_INSTALL}
723: touch ${.TARGET}
724: . endfor
725: .endif
726:
1.242 lukem 727: # snap_md_post --
728: # Machine dependent distribution media operations.
729: # Overridden by etc.$MACHINE/Makefile.inc
730: #
1.324 dsl 731: snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
1.242 lukem 732: # (empty -- look in the machine-dependent Makefile.inc)
733:
734:
735: clean:
1.246 lukem 736: -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
1.7 cgd 737:
1.392 jym 738: SUBDIR= defaults rc.d mtree
1.362 cube 739:
1.1 cgd 740: .include <bsd.prog.mk>
1.362 cube 741: .include <bsd.subdir.mk>
1.309 tron 742:
743: test:
744: @echo ${OBSOLETE.files}
CVSweb <webmaster@jp.NetBSD.org>