Makefile revision 1.123
1# $NetBSD: Makefile,v 1.123 1999/07/22 20:10:16 is 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+= 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} == "m68k") || \ 88 (${MACHINE_ARCH} == "ns32k") || \ 89 (${MACHINE_ARCH} == "vax") || \ 90 (${MACHINE_ARCH} == "arm32") 91BIN1+= ld.so.conf 92.endif 93 94# IPv6 95BIN1+= rtadvd.conf 96 97# -rw-rw-r-- 98BIN2+= motd 99 100# -rw------- 101BIN3+= hosts.equiv 102 103NAMEDB= 127 root.cache 104.ifdef USE_BIND4 105NAMEDB+= named.boot 106.else 107NAMEDB+= named.conf 108.endif 109PCS= pcs750.bin 110 111all clean cleandir depend distclean etc includes install lint: 112 113.ifndef DESTDIR 114distribution distrib-dirs release snapshot: 115 @echo setenv DESTDIR before doing that! 116 @false 117.else 118distribution: distrib-dirs 119.if !defined(INSTALL_DONE) 120 (cd ..; ${MAKE} _DISTRIB= includes) 121 (cd ..; ${MAKE} _DISTRIB= install) 122.endif 123 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc 124 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc 125 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc 126 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases ${DESTDIR}/etc 127 /usr/libexec/sendmail/sendmail -O AliasFile=${DESTDIR}/etc/aliases -bi 128 ${INSTALL} -c -o root -g wheel -m 600 crontab \ 129 ${DESTDIR}/var/cron/tabs/root 130 ${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc 131 pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd 132 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ 133 MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev 134 ${INSTALL} -c -o root -g wheel -m 600 minfree \ 135 ${DESTDIR}/var/crash 136 (cd root; \ 137 ${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \ 138 ${DESTDIR}/root/.cshrc; \ 139 ${INSTALL} -c -o root -g wheel -m 600 dot.klogin \ 140 ${DESTDIR}/root/.klogin; \ 141 ${INSTALL} -c -o root -g wheel -m 644 dot.login \ 142 ${DESTDIR}/root/.login; \ 143 ${INSTALL} -c -o root -g wheel -m 644 dot.profile \ 144 ${DESTDIR}/root/.profile; \ 145 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ 146 ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ 147 ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile) 148 (cd mtree; ${MAKE} install) 149 (cd namedb; \ 150 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \ 151 ${DESTDIR}/etc/namedb) 152 /bin/rm -f ${DESTDIR}/etc/localtime 153 ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 154 /bin/rm -f ${DESTDIR}/etc/rmt 155 ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt 156 ${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \ 157 ${DESTDIR}/etc/dumpdates 158 ${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \ 159 ${DESTDIR}/etc/skeykeys 160 ${INSTALL} -c -o root -g wheel -m 600 /dev/null \ 161 ${DESTDIR}/var/cron/log 162 ${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \ 163 ${DESTDIR}/var/db/locate.database 164 ${INSTALL} -c -o uucp -g dialer -m 640 /dev/null \ 165 ${DESTDIR}/var/log/aculog 166 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 167 ${DESTDIR}/var/log/authlog 168 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 169 ${DESTDIR}/var/log/lastlog 170 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \ 171 ${DESTDIR}/var/log/lpd-errs 172 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 173 ${DESTDIR}/var/log/maillog 174 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 175 ${DESTDIR}/var/log/messages 176 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 177 ${DESTDIR}/var/log/secure 178 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 179 ${DESTDIR}/var/log/wtmp 180 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 181 ${DESTDIR}/var/log/xferlog 182 ${INSTALL} -c -o daemon -g staff -m 664 /dev/null \ 183 ${DESTDIR}/var/msgs/bounds 184 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 185 ${DESTDIR}/var/run/utmp 186 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 187 ${DESTDIR}/var/games/atc_scores 188 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 189 ${DESTDIR}/var/games/battlestar.log 190 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 191 ${DESTDIR}/var/games/cfscores 192 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 193 ${DESTDIR}/var/games/criblog 194 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 195 ${DESTDIR}/var/games/robots_roll 196 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 197 ${DESTDIR}/var/games/rogue.scores 198 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 199 ${DESTDIR}/var/games/saillog 200 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 201 ${DESTDIR}/var/games/snakerawscores 202 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 203 ${DESTDIR}/var/games/snake.log 204 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 205 ${DESTDIR}/var/games/tetris.scores 206 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 207 ${DESTDIR}/var/games/larn/llog12.0 208 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 209 ${DESTDIR}/var/games/larn/lscore12.0 210 ${INSTALL} -c -o games -g games -m 664 /dev/null \ 211 ${DESTDIR}/var/games/larn/playerids 212 (cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ 213 fstab.* ${DESTDIR}/etc) 214 (cd ${DESTDIR}/dev; ./MAKEDEV all) 215 (cd ../usr.bin/mail; ${MAKE} distribution) 216.ifndef NO_SENDMAIL 217 (cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution) 218.endif 219.ifdef BUILD_POSTFIX 220 (cd ../usr.sbin/postfix/etc; ${MAKE} distribution) 221.endif 222 223 224distrib-dirs: 225 ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR} 226 -mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u 227 cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys 228 229.if !defined(RELEASEDIR) 230release snapshot snap_pre snap_md_pre snap_md_post: 231 @echo setenv RELEASEDIR before doing that! 232 @false 233.else 234release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post 235 sh ../distrib/sets/maketars -s ../distrib/sets \ 236 -d ${DESTDIR} -t ${RELEASEDIR}/binary/sets 237.if exists(../domestic) && !defined(EXPORTABLE_SYSTEM) 238 sh ../distrib/sets/maketars -s ../distrib/sets \ 239 -d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr 240 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/security 241.endif 242 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/sets 243.ifdef EXTRA_KERNELS 244 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz' 245.endif 246 247snap_pre: 248 /bin/rm -rf ${RELEASEDIR} 249 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR} 250.for dir in ${INSTALLATION_DIRS} 251 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir} 252.endfor 253 254# the regular expression does a basename(1) on .CURDIR so that we don't 255# have to keep looking up .. at compile time. 256KERNSRCDIR?= ${.CURDIR:C/[^\/]+$//}sys 257KERNOBJDIR?= ${KERNSRCDIR}/arch/${MACHINE}/compile 258KERNCONFDIR?= ${KERNSRCDIR}/arch/${MACHINE}/conf 259 260# This target builds the GENERIC kernel (which must exist for all 261# ports) and puts it in binary/sets/kern.tgz, and also builds any 262# kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build 263# system can create more than one kernel from a single configuration 264# we figure out how many there are, what they're named, and move them 265# to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will 266# simply be "netbsd". If we don't find the "config" line, assume the 267# kernel will be "netbsd" (some config files are simple additions on 268# GENERIC, and just include it). 269# 270GETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 271 END{ if (found == 0) print "netbsd"; }' 272# 273.if !target(snap_kern) 274snap_kern: 275 cd ${KERNCONFDIR} && config \ 276 -b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC 277.ifndef UPDATE 278 cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 279.endif 280 cd ${KERNOBJDIR}/GENERIC && ${MAKE} depend && ${MAKE} ${_J} 281 cd ${KERNOBJDIR}/GENERIC && \ 282 tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\ 283 gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz 284# XXX use same loop for ${EXTRA_KERNELS} and ${BUILD_KERNELS} but 285# XXX only install ${EXTRA_KERNELS} in binary/kernel??? 286.for configfile in ${EXTRA_KERNELS} 287 cd ${KERNCONFDIR} && config \ 288 -b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile} 289.ifndef UPDATE 290 cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 291.endif 292 cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J} 293 cd ${KERNOBJDIR}/${configfile} && \ 294 for kernel in `${GETKERNELAWK} \ 295 ${KERNCONFDIR}/${configfile}` ; { \ 296 gzip -c -9 < $${kernel} > \ 297 ${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; } 298.endfor # EXTRA_KERNELS 299.for configfile in ${BUILD_KERNELS} 300 cd ${KERNCONFDIR} && config \ 301 -b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile} 302.ifndef UPDATE 303 cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 304.endif 305 cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J} 306.endfor # BUILD_KERNELS 307.endif # no target(snap_kern) 308 309.endif # RELEASEDIR check 310 311snap_md_pre: 312# nothing here -- look in the machine-dependent Makefile.inc 313 314snap_md_post: 315# nothing here -- look in the machine-dependent Makefile.inc 316 317.endif # DESTDIR check 318 319.include <bsd.prog.mk> 320