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