Makefile revision 1.137
1# $NetBSD: Makefile,v 1.137 2000/02/26 18:42:31 mycroft 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/KERNELNAME, but can be 16# overridden. 17# KERNCONFDIR is where the configuration files for kernels are found; 18# default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden. 19# UPDATE is normally undefined; if defined, don't do a 'make clean' 20# before kernel compile 21# NO_SENDMAIL is normally undefined; if defined, it will not do a 22# `make distribution' in the sendmail config file source directory. 23# EXTRA_KERNELS has a machine-dependent list of kernels to build added 24# to it, but you may also set this to have extra ones built. 25# BUILD_KERNELS are a machine-dependent list of kernels that should just 26# be built in place but not made into sets or installed, e.g., an 27# INSTALL kernel used later in src/distrib/. 28# CRYPTOPATH is automatically defined by bsd.crypto.mk to be either 29# ../crypto-us or ../crypto-intl. It controls the building of 30# the secr set, which can be disabled by setting CRYPTOPATH to 31# "none". 32# 33# Targets: 34# distribution: makes a full NetBSD distribution in DESTDIR. If 35# INSTALL_DONE is set, it will not do a `make install.' 36# distrib-dirs: creates an empty NetBSD directory tree in DESTDIR. 37# Called by distribution. 38# snapshot: calls distribution, above, and then tars up the files 39# into a release(7) format in RELEASEDIR. Any port-dependent 40# stuff for this target is found in etc.${MACHINE}/Makefile.inc. 41# release: a synonym for `snapshot' 42 43# For NO_SENDMAIL and INSTPRIV and CRYPTOPATH 44.include <bsd.own.mk> 45SRCTOP= .. 46.include <bsd.crypto.mk> 47 48TZDIR= /usr/share/zoneinfo 49LOCALTIME?= US/Pacific 50 51# setting NOOBJ prevents "make obj" from doing anything; 52# an objdir would break the installation stuff below 53MKOBJ= no 54 55# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 56# are empty, to preserve the old semantics of setting them below with "=". 57BIN1= 58BIN2= 59BIN3= 60 61# Directories to build in ${RELEASEDIR}. MD Makefile.inc files can 62# add to this. 63# NOTE: Parent directories must be listed before subdirectories. 64INSTALLATION_DIRS= \ 65 binary binary/sets binary/kernel binary/security installation 66 67.if exists(etc.${MACHINE}/Makefile.inc) 68.include "etc.${MACHINE}/Makefile.inc" 69.endif 70 71# Use multiple jobs for kernel builds, if NBUILDJOBS set. 72# (Taken from src/Makefile.) 73.if defined(NBUILDJOBS) 74_J= -j${NBUILDJOBS} 75.endif 76 77# -rw-r--r-- 78BINOWN= root 79BINGRP= wheel 80BIN1+= bootptab changelist csh.cshrc csh.login csh.logout daily \ 81 daily.conf dm.conf floppytab ftpchroot ftpusers ftpwelcome \ 82 gettytab group hosts hosts.lpd inetd.conf lkm.conf \ 83 mailer.conf man.conf monthly monthly.conf mrouted.conf \ 84 netstart networks newsyslog.conf nsswitch.conf ntp.conf \ 85 phones printcap profile protocols rbootd.conf rc rc.conf \ 86 rc.lkm rc.local rc.subr rc.shutdown rc.wscons remote rpc \ 87 security security.conf services shells syslog.conf weekly \ 88 weekly.conf wscons.conf \ 89 etc.${MACHINE}/ttys etc.${MACHINE}/disktab 90 91.if (${MACHINE_ARCH} == "m68k") || \ 92 (${MACHINE_ARCH} == "ns32k") || \ 93 (${MACHINE_ARCH} == "vax") || \ 94 (${MACHINE_ARCH} == "arm32") 95BIN1+= ld.so.conf 96.elif exists(etc.${MACHINE_ARCH}/ld.so.conf) 97BIN1+= etc.${MACHINE_ARCH}/ld.so.conf 98.endif 99 100# IPv6 101BIN1+= rtadvd.conf 102 103# -rw-rw-r-- 104BIN2+= motd 105 106# -rw------- 107BIN3+= hosts.equiv 108 109NAMEDB= 127 root.cache named.conf 0000:0000:0000:0000:0000:0000:000 110PCS= pcs750.bin 111 112all clean cleandir depend distclean etc includes install lint: 113 114.ifndef DESTDIR 115distribution distrib-dirs release snapshot: 116 @echo setenv DESTDIR before doing that! 117 @false 118.else 119distribution: distrib-dirs 120.if !defined(INSTALL_DONE) 121 (cd ..; ${MAKE} _DISTRIB= includes) 122 (cd ..; ${MAKE} _DISTRIB= install) 123.endif 124 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} \ 125 ${DESTDIR}/etc 126 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} \ 127 ${DESTDIR}/etc 128 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} \ 129 ${DESTDIR}/etc 130 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases \ 131 ${DESTDIR}/etc 132 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 crontab \ 133 ${DESTDIR}/var/cron/tabs/root 134 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 master.passwd \ 135 ${DESTDIR}/etc 136 pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd 137 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ 138 MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev 139 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 minfree \ 140 ${DESTDIR}/var/crash 141 (cd root; \ 142 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.cshrc \ 143 ${DESTDIR}/root/.cshrc; \ 144 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 dot.klogin \ 145 ${DESTDIR}/root/.klogin; \ 146 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.login \ 147 ${DESTDIR}/root/.login; \ 148 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.profile \ 149 ${DESTDIR}/root/.profile; \ 150 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.shrc \ 151 ${DESTDIR}/root/.shrc; \ 152 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ 153 ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ 154 ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile) 155 (cd mtree; ${MAKE} install) 156 (cd namedb; \ 157 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ 158 ${NAMEDB} ${DESTDIR}/etc/namedb) 159 /bin/rm -f ${DESTDIR}/etc/localtime 160 ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 161 /bin/rm -f ${DESTDIR}/etc/rmt 162 ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt 163 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 664 /dev/null \ 164 ${DESTDIR}/etc/dumpdates 165 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 600 /dev/null \ 166 ${DESTDIR}/etc/skeykeys 167 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \ 168 ${DESTDIR}/var/at/at.deny 169 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \ 170 ${DESTDIR}/var/cron/log 171 ${INSTALL} ${INSTPRIV} -c -o nobody -g ${BINGRP} -m 664 /dev/null \ 172 ${DESTDIR}/var/db/locate.database 173 ${INSTALL} ${INSTPRIV} -c -o uucp -g dialer -m 640 /dev/null \ 174 ${DESTDIR}/var/log/aculog 175 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 176 ${DESTDIR}/var/log/authlog 177 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 178 ${DESTDIR}/var/log/lastlog 179 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \ 180 ${DESTDIR}/var/log/lpd-errs 181 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 182 ${DESTDIR}/var/log/maillog 183 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 184 ${DESTDIR}/var/log/messages 185 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 186 ${DESTDIR}/var/log/secure 187 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 188 ${DESTDIR}/var/log/sendmail.st 189 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 190 ${DESTDIR}/var/log/wtmp 191 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 192 ${DESTDIR}/var/log/xferlog 193 ${INSTALL} ${INSTPRIV} -c -o daemon -g staff -m 664 /dev/null \ 194 ${DESTDIR}/var/msgs/bounds 195 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 196 ${DESTDIR}/var/run/utmp 197 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 198 ${DESTDIR}/var/games/atc_scores 199 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 200 ${DESTDIR}/var/games/battlestar.log 201 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 202 ${DESTDIR}/var/games/cfscores 203 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 204 ${DESTDIR}/var/games/criblog 205 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 206 ${DESTDIR}/var/games/robots_roll 207 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 208 ${DESTDIR}/var/games/rogue.scores 209 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 210 ${DESTDIR}/var/games/saillog 211 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 212 ${DESTDIR}/var/games/snakerawscores 213 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 214 ${DESTDIR}/var/games/snake.log 215 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 216 ${DESTDIR}/var/games/tetris.scores 217 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 218 ${DESTDIR}/var/games/larn/llog12.0 219 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 220 ${DESTDIR}/var/games/larn/lscore12.0 221 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 222 ${DESTDIR}/var/games/larn/playerids 223 (cd etc.${MACHINE}; ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} \ 224 -g ${BINGRP} -m 444 fstab.* ${DESTDIR}/etc) 225 (cd ${DESTDIR}/dev; ./MAKEDEV all) 226 (cd ../usr.bin/mail; ${MAKE} distribution) 227.ifndef NO_SENDMAIL 228 (cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution) 229 ${DESTDIR}/usr/libexec/sendmail/sendmail -C ${DESTDIR}/etc/sendmail.cf -O AliasFile=${DESTDIR}/etc/aliases -bi 230.endif 231.ifdef BUILD_POSTFIX 232 (cd ../usr.sbin/postfix/etc; ${MAKE} distribution) 233.endif 234 235 236distrib-dirs: 237 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${DESTDIR} 238 -mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u 239 cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys 240 241.if !defined(RELEASEDIR) 242release snapshot snap_pre snap_md_pre snap_md_post: 243 @echo setenv RELEASEDIR before doing that! 244 @false 245.else 246release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post 247 sh ../distrib/sets/maketars -s ../distrib/sets \ 248 -d ${DESTDIR} -t ${RELEASEDIR}/binary/sets 249.if defined(CRYPTOPATH) && exists(${CRYPTOPATH}) 250 sh ../distrib/sets/maketars -s ../distrib/sets \ 251 -d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr 252 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/security 253.endif 254 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/sets 255 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz' 256 257snap_pre: 258 /bin/rm -rf ${RELEASEDIR} 259 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR} 260.for dir in ${INSTALLATION_DIRS} 261 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir} 262.endfor 263 264# the regular expression does a basename(1) on .CURDIR so that we don't 265# have to keep looking up .. at compile time. 266KERNSRCDIR?= ${.CURDIR:C/[^\/]+$//}sys 267KERNOBJDIR?= ${KERNSRCDIR}/arch/${MACHINE}/compile 268KERNCONFDIR?= ${KERNSRCDIR}/arch/${MACHINE}/conf 269 270# This target builds the GENERIC kernel (which must exist for all 271# ports) and puts it in binary/sets/kern.tgz, and also builds any 272# kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build 273# system can create more than one kernel from a single configuration 274# we figure out how many there are, what they're named, and move them 275# to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will 276# simply be "netbsd". If we don't find the "config" line, assume the 277# kernel will be "netbsd" (some config files are simple additions on 278# GENERIC, and just include it). 279# 280GETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 281 END{ if (found == 0) print "netbsd"; }' 282# 283.if !target(snap_kern) 284snap_kern: 285.for configfile in GENERIC ${EXTRA_KERNELS} ${BUILD_KERNELS} 286 cd ${KERNCONFDIR} && ${CONFIG} \ 287 -b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile} 288.ifndef UPDATE 289 cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 290.endif 291 cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J} 292.endfor # kernels 293 cd ${KERNOBJDIR}/GENERIC && \ 294 tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\ 295 gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz 296.for configfile in GENERIC ${EXTRA_KERNELS} 297 cd ${KERNOBJDIR}/${configfile} && \ 298 for kernel in `${GETKERNELAWK} \ 299 ${KERNCONFDIR}/${configfile}` ; { \ 300 gzip -c -9 < $${kernel} > \ 301 ${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; } 302.endfor # EXTRA_KERNELS 303.endif # no target(snap_kern) 304 305.endif # RELEASEDIR check 306 307snap_md_pre: 308# nothing here -- look in the machine-dependent Makefile.inc 309 310snap_md_post: 311# nothing here -- look in the machine-dependent Makefile.inc 312 313.endif # DESTDIR check 314 315.include <bsd.prog.mk> 316