1# $NetBSD: Makefile,v 1.424 2015/08/31 06:08:07 uebayasi Exp $ 2# from: @(#)Makefile 8.7 (Berkeley) 5/25/95 3 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 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 22# 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' 34# 35 36# For MK* vars 37.include <bsd.own.mk> 38 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 42 43.MAKEOVERRIDES+= USETOOLS 44 45TZDIR= /usr/share/zoneinfo 46LOCALTIME?= UTC 47CKSUM?= ${TOOL_CKSUM} 48MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums 49DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 50 51GZIP_FLAGS= -9 ${GZIP_N_FLAG} 52 53# Flags for creating ISO CDROM image 54# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools 55# Note: At least mkisofs 2.0 should be used. 56# 57.if !defined(__MINIX) 58# LSC: We do not yet support iso creation anyway, then do not try to find it. 59.if !defined(MKISOFS) 60MKISOFS!= (which mkisofs || echo true) 2>/dev/null 61.endif 62DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 63# ISO 9660 volume ID. Note that this can only contain [A-Z0-9_]. 64ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 65MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \ 66 -V ${ISO_VOLID} \ 67 -publisher "The NetBSD Project" \ 68 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom" 69.if ${MKISOFS_FLAGS:N-v} 70MKISOFS_FLAGS+= -quiet 71.endif 72.endif # !defined(__MINIX) 73 74 75# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 76# are empty, to preserve the old semantics of setting them below with "+=". 77# 78BIN1= 79BIN2= 80BIN3= 81 82# Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}. 83# MD Makefile.inc files can add to this. 84# NOTE: Parent directories must be listed before subdirectories. 85# 86INSTALLATION_DIRS= binary binary/sets binary/kernel installation 87 88.if exists(etc.${RELEASEMACHINE}/Makefile.inc) 89.include "etc.${RELEASEMACHINE}/Makefile.inc" 90.endif 91 92# -rw-r--r-- 93BINOWN= root 94BINGRP= wheel 95UTMPGRP= utmp 96.if defined(__MINIX) 97BIN1+= \ 98 \ 99 gettytab \ 100 man.conf \ 101 \ 102 passwd.conf \ 103 protocols rc rc.cd rc.subr \ 104 rc.shutdown services shells \ 105 syslog.conf 106# MINIX-only files: 107BIN1+= boot.cfg.default rc.minix \ 108 rs.single termcap utmp 109.else 110BIN1+= bootptab changelist csh.cshrc csh.login \ 111 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \ 112 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \ 113 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \ 114 mrouted.conf named.conf netconfig networks newsyslog.conf \ 115 nsswitch.conf ntp.conf passwd.conf pkgpath.conf phones printcap \ 116 profile protocols rbootd.conf rc rc.conf rc.local rc.subr \ 117 rc.shutdown remote rpc security security.conf services shells \ 118 shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf 119 120# Use machine-specific disktab if it exists, or the MI one otherwise 121.if exists(etc.${MACHINE}/disktab) 122BIN1+= etc.${MACHINE}/disktab 123.else 124BIN1+= disktab 125.endif 126 127.if exists(etc.${MACHINE}/ld.so.conf) && empty(MACHINE_ARCH:M*arm*hf*) 128BIN1+= etc.${MACHINE}/ld.so.conf 129.endif 130 131.if exists(etc.${MACHINE}/ttyaction) 132BIN1+= etc.${MACHINE}/ttyaction 133.endif 134 135# -rw-rw-r-- 136BIN2+= motd 137FILESBUILD_motd= YES 138 139# -rw------- 140BIN3+= hosts.equiv 141.endif # defined(__MINIX) 142 143SYSPKG= etc 144ETC_PKG=-T etc_pkg 145BASE_PKG=-T base_pkg 146ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 147ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 148 149.if ${TARGET_ENDIANNESS} == "1234" 150PWD_MKDB_ENDIAN= -L 151.elif ${TARGET_ENDIANNESS} == "4321" 152PWD_MKDB_ENDIAN= -B 153.else 154PWD_MKDB_ENDIAN= 155.endif 156 157 158# distribution -- 159# Build a distribution 160# 161distribution: .PHONY .MAKE check_DESTDIR distrib-dirs 162.if !defined(DISTRIBUTION_DONE) 163.if !defined(INSTALL_DONE) 164 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 165 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 166.endif # !INSTALL_DONE 167 ${MAKEDIRTARGET} . install-etc-files 168. if ${MKX11} != "no" 169 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution 170. endif 171. if ${MKEXTSRC} != "no" 172 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution 173. endif 174 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 175.endif # !DISTRIBUTION_DONE 176 177 178.if !defined(__MINIX) 179# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER 180# 181.if !empty(DISTRIBVER:M*.99.*) 182MOTD_SOURCE= motd.current 183.elif !empty(DISTRIBVER:M*BETA*) 184MOTD_SOURCE= motd.beta 185.elif !empty(DISTRIBVER:M*RC*) 186MOTD_SOURCE= motd.rc 187.elif !empty(DISTRIBVER:M*STABLE*) 188MOTD_SOURCE= motd.stable 189.else 190MOTD_SOURCE= motd.default 191.endif 192CLEANFILES+= motd 193motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} 194 ${_MKTARGET_CREATE} 195 ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} 196.endif # !defined(__MINIX) 197 198CLEANFILES+= MAKEDEV 199.if !defined(__MINIX) 200MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} 201MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 202 ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf 203 ${_MKTARGET_CREATE} 204 MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 205 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 206 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 207 > ${.TARGET} 208.else 209MAKEDEV: .PHONY 210 if [ ${MKUNPRIVED} != "yes" ]; then \ 211 cd ${DESTDIR}/dev && sh ${NETBSDSRCDIR}/minix/commands/MAKEDEV/MAKEDEV.sh -s; \ 212 else \ 213 sh ${NETBSDSRCDIR}/minix/commands/MAKEDEV/MAKEDEV.sh -m -s >> ${DESTDIR}/METALOG; \ 214 fi 215.endif # !defined(__MINIX) 216 217.include "${NETBSDSRCDIR}/etc/Makefile.params" 218CLEANFILES+= etc-release 219etc-release: .EXEC .MAKE 220 ${_MKTARGET_CREATE} 221 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 222 echo ; \ 223 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 224 echo ; \ 225 echo "Build information:"; \ 226 printf "%20s %s\n" "Build date" "$$(date -u)"; \ 227 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \ 228 if [ -n "${BUILDID}" ]; then \ 229 printf "%20s %s\n" "Build ID" "${BUILDID}" ; \ 230 fi ; \ 231 if [ -n "${BUILDINFO}" ]; then \ 232 echo ; \ 233 info="$$(printf "%b" ${BUILDINFO:Q})" ; \ 234 printf "%s\n" "$${info}" \ 235 | ${TOOL_SED} -e 's/^/ /' ; \ 236 fi ; \ 237 echo ; \ 238 echo "Build settings:"; \ 239 echo ; \ 240 ${PRINT_PARAMS} ; \ 241 ) >${.OBJDIR}/${.TARGET} 242 243install-etc-release: .PHONY etc-release 244 ${_MKMSG_INSTALL} etc/release 245 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 246 etc-release ${DESTDIR}/etc/release 247 248 249FILESDIR= /etc 250CONFIGFILES= 251CONFIGSYMLINKS= 252 253.for file in ${BIN1} 254CONFIGFILES+= ${file} 255FILESMODE_${file:T}= 644 256.endfor 257 258.for file in ${BIN2} 259CONFIGFILES+= ${file} 260FILESMODE_${file:T}= 664 261.endfor 262 263.for file in ${BIN3} 264CONFIGFILES+= ${file} 265FILESMODE_${file:T}= 600 266.endfor 267 268.if (${MKPOSTFIX} != "no") 269CONFIGFILES+= aliases 270FILESDIR_aliases= /etc/mail 271FILESMODE_aliases= 644 272.endif 273 274.if !defined(__MINIX) 275CONFIGFILES+= MAKEDEV.local 276FILESDIR_MAKEDEV.local= /dev 277FILESMODE_MAKEDEV.local=${BINMODE} 278 279CONFIGFILES+= crontab 280FILESDIR_crontab= /var/cron/tabs 281FILESNAME_crontab= root 282FILESMODE_crontab= 600 283 284CONFIGFILES+= minfree 285FILESDIR_minfree= /var/crash 286FILESMODE_minfree= 600 287 288CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 289 /usr/sbin/rmt /etc/rmt 290.else 291CONFIGSYMLINKS+= \ 292 /usr/log /var/log \ 293 /usr/tmp /var/tmp \ 294 /proc/mounts /etc/mtab \ 295 /usr/service/asr /service/asr 296 297.endif # !defined(__MINIX) 298 299 300# install-etc-files -- 301# Install etc (config) files; not performed by "make build" 302# 303install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 304 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 305 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 306 master.passwd ${DESTDIR}/etc 307 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 308 ${DESTDIR}/etc/master.passwd 309.if ${MKUNPRIVED} != "no" 310 ( \ 311 mode=0600; \ 312 for metaent in spwd.db passwd pwd.db; do \ 313 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 314 mode=0644; \ 315 done; \ 316 ) | ${METALOG.add} 317.endif # MKUNPRIVED != no 318.if defined(__MINIX) 319# BJG: Unsafe (i.e. user-editable) files for Minix 320.for owner group mode sdir tdir files in \ 321 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ group \ 322 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ hostname.file \ 323 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ mk.conf \ 324 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ motd \ 325 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ rc.conf \ 326 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ shrc \ 327 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.cshrc \ 328 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.login \ 329 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.logout \ 330 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ profile 331 ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T} 332 if [ ! -e ${tdir} ]; then \ 333 ${INSTALL_DIR} ${tdir}; \ 334 fi; \ 335 ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir}; 336.endfor 337.if ${MKX11} == "yes" 338 ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 ${DESTDIR}/etc/X11 339 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 ${NETBSDSRCDIR}/etc/xorg.conf \ 340 ${DESTDIR}/etc/X11/xorg.conf 341.endif # ${MKX11} == "yes" 342# LSC: We need a safe install target for etc files, as this is expected from 343# our current user base. This safe version only leaves out the master.passwd 344# file in order not to loose any user account created. 345# 346# BJG: For Minix, the -safe target *is* performed by "make build" 347# 348# LSC: To ensure minimal modifications, the logic is a bit contrived, i.e. the 349# NetBSD build system expect install-etc-files to be unsafe, so what was done 350# is to separate that step into two steps, with the unsafe version refering 351# (not by dependency, to ensure correct order of actions) the safe step, and 352# use the following mapping in the main Makefile: 353# etcforce -> install-etc-files (default NetBSD target) 354# etcfiles -> install-etc-files-safe (new -safe- target) 355 ${MAKEDIRTARGET} . install-etc-files-safe 356 357install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV 358.endif # defined(__MINIX) 359 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 360.if !defined(__MINIX) 361.if exists(${.CURDIR}/etc.${MACHINE}/ttys) 362 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 363 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 364.else 365 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 366 ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc 367.endif 368.else 369 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 370 ${.CURDIR}/ttys ${DESTDIR}/etc 371.endif # !defined(__MINIX) 372.if exists(etc.${MACHINE}/boot.cfg) 373 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 374 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 375 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 376.endif 377.if !defined(__MINIX) 378 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 379 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 380 MAKEDEV ${DESTDIR}/dev 381.else 382# As /var/log is a symlink to /usr/log, we need to use /usr/log for files 383# in /var/log here. The same applies to the distrib list entries. 384.for owner group mode file in \ 385 ${BINOWN} ${BINGRP} 644 /usr/log/messages \ 386 ${BINOWN} ${BINGRP} 644 /usr/log/syslog \ 387 games games 664 /var/games/tetris.scores 388 ${_MKMSG_INSTALL} ${DESTDIR}${file} 389 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 390 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 391 /dev/null ${DESTDIR}${file}; \ 392 else true; fi 393.endfor 394.endif # !defined(__MINIX) 395# TAC as software is imported, copy the files from the .for block below 396# TAC to the .for block above. 397.if !defined(__MINIX) 398.for owner group mode file in \ 399 ${BINOWN} operator 664 /etc/dumpdates \ 400 ${BINOWN} operator 600 /etc/skeykeys \ 401 root wheel 600 /var/at/at.deny \ 402 root wheel 644 /var/db/locate.database \ 403 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 404 root wheel 600 /var/log/cron \ 405 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 406 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 407 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 408 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 409 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 410 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 411 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 412 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 413 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 414 daemon staff 664 /var/msgs/bounds \ 415 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 416 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 417 games games 664 /var/games/atc_score \ 418 games games 664 /var/games/battlestar.log \ 419 games games 664 /var/games/cfscores \ 420 games games 664 /var/games/criblog \ 421 games games 660 /var/games/hackdir/perm \ 422 games games 660 /var/games/hackdir/record \ 423 games games 664 /var/games/larn/llog12.0 \ 424 games games 664 /var/games/larn/lscore12.0 \ 425 games games 664 /var/games/larn/playerids \ 426 games games 664 /var/games/robots_roll \ 427 games games 664 /var/games/rogue.scores \ 428 games games 664 /var/games/saillog \ 429 games games 664 /var/games/snakerawscores \ 430 games games 664 /var/games/snake.log \ 431 games games 664 /var/games/tetris.scores 432 ${_MKMSG_INSTALL} ${DESTDIR}${file} 433 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 434 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 435 /dev/null ${DESTDIR}${file}; \ 436 else true; fi 437.endfor 438.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 439 ${MAKEDIRTARGET} ${subdir} configinstall 440.endfor 441 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 442 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 443.if (${MKPF} != "no") 444 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 445.endif 446.if (${MKCRYPTO} != "no") 447 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 448.endif 449.if (${MKPOSTFIX} != "no") 450 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 451.endif 452.if (${MKATF} != "no") 453 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 454.endif 455.if (${MKKYUA} != "no") 456 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall 457.endif 458.else # LSC Minix Specific 459.for owner group mode sdir tdir files in \ 460 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ daily \ 461 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ rc \ 462 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/usr/lib/ crontab \ 463 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ system.conf \ 464 ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/ Makefile \ 465 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_hub.cfg \ 466 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_storage.cfg \ 467 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ block \ 468 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ singlechar \ 469 470 ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T} 471 if [ ! -e ${tdir} ]; then \ 472 ${INSTALL_DIR} ${tdir}; \ 473 fi; \ 474 ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir}; 475.endfor 476.if ${MACHINE_ARCH} == "earm" 477 ${_MKMSG_INSTALL} ${DESTDIR}/etc/rc.capes 478 ${INSTALL_DIR} ${DESTDIR}/etc/rc.capes 479 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/rc.capes/* ${DESTDIR}/etc/rc.capes 480 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/minix/drivers/usb/usbd/usbd.conf ${DESTDIR}/etc/system.conf.d/usbd 481.endif # Minix/earm specific 482.for subdir in . defaults mtree rc.d root skel 483 ${MAKEDIRTARGET} ${subdir} configinstall 484.endfor 485 ${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts 486 ${INSTALL_DIR} ${DESTDIR}/usr/lib/fonts 487 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/fonts/*.fnt ${DESTDIR}/usr/lib/fonts/ 488.endif # LSC Minix Specific 489 490 491# install-obsolete-lists -- 492# Install var/db/obsolete set lists; this is performed by "make build" 493# 494OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 495.if !defined(__MINIX) 496OBSOLETE.files= base comp etc games man misc text 497.else 498OBSOLETE.files= minix-base minix-comp minix-games minix-kernel minix-man 499.endif # !defined(__MINIX) 500.if ${MKDEBUG} != "no" 501OBSOLETE.files+= minix-debug 502.endif 503.if ${MKKMOD} != "no" 504OBSOLETE.files+= modules 505.endif 506.if ${MKATF} != "no" 507OBSOLETE.files+= minix-tests tests 508.endif 509.if ${MKX11} != "no" 510OBSOLETE.files+= xbase xcomp xetc xfont xserver 511.endif 512 513# XXX make "makeobsolete" set wise; then generate files respectively 514install-obsolete-lists: .PHONY .MAKE 515 mkdir -p ${OBSOLETE.dir} 516.if ${MKX11} != "no" 517 (cd ${NETBSDSRCDIR}/distrib/sets && \ 518 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 519.else 520 (cd ${NETBSDSRCDIR}/distrib/sets && \ 521 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 522.endif 523.for file in ${OBSOLETE.files} 524 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 525 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ 526 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ 527 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 528 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ 529 else true; fi 530.endfor 531 532 533# distrib-dirs -- 534# Populate $DESTDIR with directories needed by NetBSD 535# 536distrib-dirs: .PHONY check_DESTDIR 537 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs 538 539 540# release, snapshot -- 541# Build a full distribution including kernels & install media. 542# 543release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 544 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 545 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 546 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@} 547 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 548 549 550.if !defined(__MINIX) 551# iso-image -- 552# Standalone target to create a CDROM image after the release 553# was composed. Should be run after "make release" in src and xsrc. 554# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc 555# 556# Note: At least mkisofs 2.0 should be used. 557# 558CDROM_NAME_ADD?= 559CDROM_IMAGE?=${RELEASEDIR}/images/NetBSD-${DISTRIBVER}-${MACHINE}.iso 560CDROM.dir= ${.OBJDIR}/cdrom.dir 561CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 562 563iso-image: 564 565.if ${MKISOFS} != true 566do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 567 ${MAKESUMS} -t ${RELEASEDIR}/images/ '*.iso' 568 @echo "iso-image created as: ${CDROM_IMAGE}" 569.else 570do-iso-image: 571 @echo iso-image: mkisofs not found 572.endif 573 574iso-image-setup: .PHONY check_RELEASEDIR 575 rm -f ${CDROM.pathlist} 576.for extra in README SOURCE_DATE source 577.if exists(${RELEASEDIR}/${extra}) 578 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 579.endif 580.endfor 581 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} 582 mkdir -p ${CDROM.dir} 583 584check_imagedir: 585 mkdir -p ${RELEASEDIR}/images 586 587# iso-image-mi -- 588# Create the image after the MD operations have completed. 589# 590iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir 591 @if ! ${MKISOFS} --version; then \ 592 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 593 false; \ 594 fi 595 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 596 -o ${CDROM_IMAGE} ${CDROM.dir} 597 598# iso-image-md-pre -- 599# Setup ${CDROM.dir} to produce a bootable CD image. 600# Overridden by etc.$MACHINE/Makefile.inc 601# 602iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 603# (empty -- look in the machine-dependent Makefile.inc) 604 605# iso-image-md-post -- 606# Fixup the CD-image to be bootable. 607# Overridden by etc.$MACHINE/Makefile.inc 608# 609iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 610# (empty -- look in the machine-dependent Makefile.inc) 611 612 613# live-image -- 614# Standalone target to create live images after the release was composed. 615# Should be run after "make release" in src and xsrc. 616# LIVEIMG_RELEASEDIR specifies where to install live images and 617# it can be set in MD etc.${MACHINE}/Makefile.inc. 618# 619LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 620 621live-image: .PHONY check_DESTDIR check_RELEASEDIR 622 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 623 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 624 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 625 626# install-image -- 627# Standalone target to create installation images 628# after the release was composed. 629# Should be run after "make release" in src and xsrc. 630# INSTIMG_RELEASEDIR specifies where to install live images and 631# it can be set in MD etc.${MACHINE}/Makefile.inc. 632# 633INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 634 635install-image: .PHONY check_DESTDIR check_RELEASEDIR 636 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 637 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 638 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 639.endif # !defined(__MINIX) 640 641# snap_pre -- 642# Create ${RELEASEDIR} and necessary subdirectories. 643# 644snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 645 ${INSTALL} -d -m 755 ${RELEASEDIR} 646.if ${MKUPDATE} == "no" 647# Could be a mount point, ignore the errors 648 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 649.endif 650 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 651.for dir in ${INSTALLATION_DIRS} 652 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 653.endfor 654 655# snap_post -- 656# Build the install media and notes from distrib 657# 658snap_post: .PHONY .MAKE build_kernelsets build_releasekernels 659.if ${MKUPDATE} == "no" 660 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 661.endif 662 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 663 ${MAKE} release 664 665# build kernels -- 666# This target builds the kernels specified by each port. 667# A port may specify the following kernels: 668# 669# KERNEL_SETS The list of kernels that will be 670# packaged into sets, named 671# kern-${kernel}.tgz. These kernels 672# are also placed in the binary/kernel 673# area of the release package as 674# netbsd-${kernel}.gz. 675# 676# EXTRA_KERNELS Additional kernels to place in the 677# binary/kernel area of the release 678# package as netbsd-${kernel}.gz, but 679# which are not placed into sets. This 680# allows a port to provide e.g. a netbootable 681# installation kernel containing a ramdisk. 682# 683# BUILD_KERNELS Additional kernels to build which are 684# not placed into sets nor into the 685# binary/kernel area of the release 686# package. These are typically kernels 687# that are built for inclusion only in 688# installation disk/CD-ROM/tape images. 689# 690# A port may also specify KERNEL_SUFFIXES, which is an optional list 691# of filename suffixes for kernels to include in the kernel sets and 692# in the binary/kernel area of the release package (e.g. "netbsd" vs. 693# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 694# with these suffixes do not exist in the kernel build directory. 695# 696# 697# A list of all the kernels to build, which can be overridden from 698# external sources (such as make(1)'s environment or command line) 699# 700ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 701.export ALL_KERNELS 702 703GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 704 END{ if (found == 0) print "netbsd"; }' 705 706build_kernels: .PHONY 707# Configure & compile kernels listed in ${ALL_KERNELS} 708# 709# The 'sync' is so that all writes during the build are pushed back 710# to the disk. Not having it causes problems on some host systems 711# (e.g. Linux) when building on NFS. 712# 713.if !defined(KERNELS_DONE) # { 714.for configfile in ${ALL_KERNELS:O:u} # { 715build_kernels: kern-${configfile} 716kern-${configfile}: .PHONY .MAKE 717 cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \ 718 -U DEBUG -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 719.if ${MKUPDATE} == "no" 720 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 721.endif 722 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 723 sync 724.endfor # ALL_KERNELS # } 725.endif # KERNELS_DONE # } 726 727build_kernelsets: .PHONY 728# Create kernel sets from ${KERNEL_SETS} into 729# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 730# 731.for configfile in ${KERNEL_SETS:O:u} # { 732.for configsel in ${ALL_KERNELS:O:u} 733.if ${configfile} == ${configsel} 734build_kernelsets: kernset-${configfile} 735kernset-${configfile}: .PHONY build_kernels snap_pre 736 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 737 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 738 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 739 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 740 pax_cmd="GZIP=${GZIP_FLAGS:Q} ${TOOL_PAX} --use-compress-program ${TOOL_GZIP:Q} -O -w -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 741 cd $${kerndir} && { \ 742 kernels=; newest=; \ 743 for kernel in $${kernlist}; do \ 744 for s in "" $${kernsuffixes}; do \ 745 ks="$${kernel}$${s}"; \ 746 [ -f $${ks} ] || continue; \ 747 kernels="$${kernels} $${ks}"; \ 748 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 749 newest=$${ks}; \ 750 done; \ 751 done; \ 752 [ $${kern_tgz} -nt "$${newest}" ] || { \ 753 echo "echo $${kernels} | $${pax_cmd}"; \ 754 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 755 echo ". type=dir optional"; \ 756 for kernel in $${kernels}; do \ 757 echo "./$${kernel} type=file"; \ 758 done ) | eval $${pax_cmd}; \ 759 } \ 760 } 761.endif 762.endfor 763.endfor # KERNEL_SETS # } 764 765build_releasekernels: .PHONY 766# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 767# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 768# 769.for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # { 770.for configsel in ${ALL_KERNELS:O:u} 771.if ${configfile} == ${configsel} 772build_releasekernels: releasekern-${configfile} 773releasekern-${configfile}: .PHONY build_kernels snap_pre 774 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 775 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 776 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 777 cd $${kerndir} && { \ 778 for kernel in $${kernlist}; do \ 779 for s in "" $${kernsuffixes}; do \ 780 ks="$${kernel}$${s}"; \ 781 [ ! -f $${ks} ] && continue; \ 782 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 783 [ $${knl_gz} -nt $${ks} ] && continue; \ 784 rm -f $${knl_gz}; \ 785 echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \ 786 ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \ 787 done; \ 788 done; \ 789 } 790.endif 791.endfor 792.endfor # KERNEL_SETS EXTRA_KERNELS # } 793 794# snap_md_post -- 795# Machine dependent distribution media operations. 796# Overridden by etc.$MACHINE/Makefile.inc 797# 798snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 799# (empty -- look in the machine-dependent Makefile.inc) 800 801 802clean: 803 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 804 805.if !defined(__MINIX) 806SUBDIR= defaults rc.d mtree 807.else 808SUBDIR= devmand defaults mtree 809.endif # !defined(__MINIX) 810 811.include <bsd.prog.mk> 812.include <bsd.subdir.mk> 813 814test: 815 @echo ${OBSOLETE.files} 816