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