Makefile revision 1.186
1# $NetBSD: Makefile,v 1.186 2001/10/24 02:43:13 tv 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# UPDATE is normally undefined; if defined, don't do a 'make clean' 19# before kernel compile 20# NO_SENDMAIL is normally undefined; if defined, it will not do a 21# `make distribution' in the sendmail config file source directory. 22# EXTRA_KERNELS has a machine-dependent list of kernels to build added 23# to it, but you may also set this to have extra ones built. 24# BUILD_KERNELS are a machine-dependent list of kernels that should just 25# be built in place but not made into sets or installed, e.g., an 26# INSTALL kernel used later in src/distrib/. 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# if DISTRIBUTION_DONE is set, it will not do anything. 32# distrib-dirs: creates an empty NetBSD directory tree in DESTDIR. 33# Called by distribution. 34# snapshot: calls distribution, above, and then tars up the files 35# into a release(7) format in RELEASEDIR. Any port-dependent 36# stuff for this target is found in etc.${MACHINE}/Makefile.inc. 37# release: a synonym for `snapshot' 38 39# do this before bsd.own.mk so we get correct KERNSRCDIR 40.include "../Makefile.inc" 41 42# For NO_SENDMAIL, INSTPRIV, MKCRYPTO 43.include <bsd.own.mk> 44 45TZDIR= /usr/share/zoneinfo 46LOCALTIME?= UTC 47 48# Flags for creating ISO CDROM image 49# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord 50MKISOFS?= mkisofs 51MKISOFS_FLAGS+= -J -l \ 52 -r -T -v \ 53 -P "The NetBSD Project" \ 54 -m "${RELEASEDIR}/installation/cdrom" 55 56# setting NOOBJ prevents "make obj" from doing anything; 57# an objdir would break the installation stuff below 58MKOBJ= no 59 60# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 61# are empty, to preserve the old semantics of setting them below with "=". 62BIN1= 63BIN2= 64BIN3= 65 66# Directories to build in ${RELEASEDIR}. MD Makefile.inc files can 67# add to this. 68# NOTE: Parent directories must be listed before subdirectories. 69INSTALLATION_DIRS= \ 70 binary binary/sets binary/kernel installation 71 72.if exists(etc.${MACHINE}/Makefile.inc) 73.include "etc.${MACHINE}/Makefile.inc" 74.endif 75 76# Use multiple jobs for kernel builds, if NBUILDJOBS set. 77# (Taken from src/Makefile.) 78.if defined(NBUILDJOBS) 79_J= -j${NBUILDJOBS} 80.endif 81 82# -rw-r--r-- 83BINOWN= root 84BINGRP= wheel 85BIN1+= bootptab changelist csh.cshrc csh.login csh.logout daily \ 86 daily.conf dm.conf floppytab ftpchroot ftpusers ftpwelcome \ 87 gettytab group hosts hosts.lpd inetd.conf lkm.conf \ 88 mailer.conf man.conf monthly monthly.conf mrouted.conf \ 89 netconfig networks newsyslog.conf nsswitch.conf ntp.conf \ 90 phones printcap profile protocols rbootd.conf rc rc.conf \ 91 rc.lkm rc.local rc.subr rc.shutdown remote rpc \ 92 security security.conf services shells sysctl.conf syslog.conf \ 93 weekly weekly.conf wscons.conf \ 94 etc.${MACHINE}/ttys etc.${MACHINE}/disktab 95 96.if (${MACHINE_ARCH} == "m68k") || \ 97 (${MACHINE_ARCH} == "ns32k") || \ 98 (${MACHINE_ARCH} == "vax") || \ 99 (${MACHINE_ARCH} == "arm32") 100BIN1+= ld.so.conf 101.elif exists(etc.${MACHINE_ARCH}/ld.so.conf) 102BIN1+= etc.${MACHINE_ARCH}/ld.so.conf 103.endif 104 105.if exists(etc.${MACHINE_ARCH}/ttyaction) 106BIN1+= etc.${MACHINE_ARCH}/ttyaction 107.endif 108 109# -rw-rw-r-- 110BIN2+= motd 111 112# -rw------- 113BIN3+= hosts.equiv 114 115NAMEDB= 127 root.cache named.conf localhost loopback.v6 116PCS= pcs750.bin 117 118# find out endianness of target and set proper flag for pwd_mkdb so that 119# it creates database in same endianness 120.if exists(${DESTDIR}/usr/include/machine/endian_machdep.h) 121TARGET_ENDIANNESS!= \ 122 ( echo "\#include <machine/endian_machdep.h>" ; echo _BYTE_ORDER ) | \ 123 ${CC} -I${DESTDIR}/usr/include -E - | tail -1 | awk '{print $$1}' 124.else 125TARGET_ENDIANNESS= 126.endif 127 128.if ${TARGET_ENDIANNESS} == "_LITTLE_ENDIAN" 129TARGET_ENDIANNESS= -L 130.elif ${TARGET_ENDIANNESS} == "_BIG_ENDIAN" 131TARGET_ENDIANNESS= -B 132.else 133# XXX sh3 should be split into sh3eb and sh3el 134TARGET_ENDIANNESS= 135.endif 136 137.include <bsd.kernobj.mk> 138 139obj: 140 mkdir -p ${KERNOBJDIR} 141 142.ifndef DESTDIR 143__warndestdir: .USE 144 @echo setenv DESTDIR before doing that! 145 @false 146distribution distrib-dirs release snapshot snap_pre snap_md_pre \ 147iso-image: __warndestdir 148.if !target(snap_md_post) 149snap_md_post: __warndestdir 150.endif 151.else 152distribution: distrib-dirs 153.if !defined(DISTRIBUTION_DONE) 154.if !defined(INSTALL_DONE) 155 (cd ..; ${MAKE} _DISTRIB= includes) 156 (cd ..; ${MAKE} _DISTRIB= install) 157.endif 158 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} \ 159 ${DESTDIR}/etc 160 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} \ 161 ${DESTDIR}/etc 162 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} \ 163 ${DESTDIR}/etc 164 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases \ 165 ${DESTDIR}/etc/mail 166 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 crontab \ 167 ${DESTDIR}/var/cron/tabs/root 168 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 master.passwd \ 169 ${DESTDIR}/etc 170 pwd_mkdb -p ${TARGET_ENDIANNESS} -d ${DESTDIR}/ \ 171 ${DESTDIR}/etc/master.passwd 172 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ 173 MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev 174 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 minfree \ 175 ${DESTDIR}/var/crash 176 (cd root; \ 177 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.cshrc \ 178 ${DESTDIR}/root/.cshrc; \ 179 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 dot.klogin \ 180 ${DESTDIR}/root/.klogin; \ 181 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.login \ 182 ${DESTDIR}/root/.login; \ 183 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.profile \ 184 ${DESTDIR}/root/.profile; \ 185 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 644 dot.shrc \ 186 ${DESTDIR}/root/.shrc; \ 187 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ 188 ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ 189 ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile) 190 (cd defaults; ${MAKE} install) 191 (cd mtree; ${MAKE} install) 192 (cd namedb; \ 193 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ 194 ${NAMEDB} ${DESTDIR}/etc/namedb) 195 (cd rc.d; ${MAKE} install) 196 /bin/rm -f ${DESTDIR}/etc/localtime 197 ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 198 /bin/rm -f ${DESTDIR}/etc/rmt 199 ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt 200 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 664 /dev/null \ 201 ${DESTDIR}/etc/dumpdates 202 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g operator -m 600 /dev/null \ 203 ${DESTDIR}/etc/skeykeys 204 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \ 205 ${DESTDIR}/var/at/at.deny 206 ${INSTALL} ${INSTPRIV} -c -o root -g wheel -m 600 /dev/null \ 207 ${DESTDIR}/var/cron/log 208 ${INSTALL} ${INSTPRIV} -c -o nobody -g ${BINGRP} -m 664 /dev/null \ 209 ${DESTDIR}/var/db/locate.database 210 ${INSTALL} ${INSTPRIV} -c -o uucp -g dialer -m 640 /dev/null \ 211 ${DESTDIR}/var/log/aculog 212 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 213 ${DESTDIR}/var/log/authlog 214 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 215 ${DESTDIR}/var/log/lastlog 216 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \ 217 ${DESTDIR}/var/log/lpd-errs 218 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 219 ${DESTDIR}/var/log/maillog 220 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 221 ${DESTDIR}/var/log/messages 222 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 223 ${DESTDIR}/var/log/secure 224 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 225 ${DESTDIR}/var/log/sendmail.st 226 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 227 ${DESTDIR}/var/log/wtmp 228 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 229 ${DESTDIR}/var/log/xferlog 230 ${INSTALL} ${INSTPRIV} -c -o daemon -g staff -m 664 /dev/null \ 231 ${DESTDIR}/var/msgs/bounds 232 ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 233 ${DESTDIR}/var/run/utmp 234 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 235 ${DESTDIR}/var/games/atc_scores 236 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 237 ${DESTDIR}/var/games/battlestar.log 238 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 239 ${DESTDIR}/var/games/cfscores 240 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 241 ${DESTDIR}/var/games/criblog 242 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 243 ${DESTDIR}/var/games/robots_roll 244 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 245 ${DESTDIR}/var/games/rogue.scores 246 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 247 ${DESTDIR}/var/games/saillog 248 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 249 ${DESTDIR}/var/games/snakerawscores 250 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 251 ${DESTDIR}/var/games/snake.log 252 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 253 ${DESTDIR}/var/games/tetris.scores 254 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 255 ${DESTDIR}/var/games/larn/llog12.0 256 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 257 ${DESTDIR}/var/games/larn/lscore12.0 258 ${INSTALL} ${INSTPRIV} -c -o games -g games -m 664 /dev/null \ 259 ${DESTDIR}/var/games/larn/playerids 260 (cd etc.${MACHINE}; ${INSTALL} ${INSTPRIV} -c -o ${BINOWN} \ 261 -g ${BINGRP} -m 444 fstab.* ${DESTDIR}/etc) 262 (cd skel; ${MAKE} distribution) 263 (cd ../usr.bin/mail; ${MAKE} distribution) 264 (cd ../gnu/usr.sbin/postfix/; ${MAKE} distribution) 265.if (${MKCRYPTO} != "no") 266 (cd ../usr.bin/ssh; ${MAKE} distribution) 267.endif 268.ifndef NO_SENDMAIL 269 (cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution) 270.endif 271.endif 272 273distrib-dirs: 274 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${DESTDIR} 275 ${MTREE} -def mtree/NetBSD.dist -p ${DESTDIR}/ -U 276 cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys 277 278.if !defined(RELEASEDIR) 279__warnreleasedir: .USE 280 @echo setenv RELEASEDIR before doing that! 281 @false 282release snapshot snap_pre snap_md_pre iso-image: __warnreleasedir 283.if !target(snap_md_post) 284snap_md_post: __warnreleasedir 285.endif 286.else 287release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post 288 (cd ../distrib/sets; ${MAKE} sets) 289 sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz' 290 291# Standalone target to create a CDROM image after the release 292# was composed. Should be run after "make build" in both src and xsrc 293iso-image: iso-image_md_post 294 295iso-image_mi: iso-image_md_pre 296 @if ${MKISOFS} --version; then \ 297 mkdir -p ${RELEASEDIR}/installation/cdrom ; \ 298 ${MKISOFS} ${MKISOFS_FLAGS} \ 299 -o ${RELEASEDIR}/installation/cdrom/netbsd-${MACHINE}.iso \ 300 ${RELEASEDIR} ; \ 301 sh ../distrib/sets/makesums -t ${RELEASEDIR}/installation/cdrom '*.iso' ; \ 302 else \ 303 echo "install pkgsrc/sysutils/cdrecord and type 'make iso-image'." ; \ 304 fi 305 306# Setup the $RELEASEDIR to produce a bootable CD image: 307iso-image_md_pre: 308# nothing here -- look in the machine-dependent Makefile.inc 309 310# Fixup the CD-image to be bootable 311iso-image_md_post: iso-image_mi 312# nothing here -- look in the machine-dependent Makefile.inc 313 314snap_pre: 315# Could be a mount point, ignore the errors 316 -/bin/rm -rf ${RELEASEDIR} 317 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR} 318.for dir in ${INSTALLATION_DIRS} 319 ${INSTALL} ${INSTPRIV} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir} 320.endfor 321 322 323# This target builds the GENERIC kernel (which must exist for all 324# ports) and puts it in binary/sets/kern.tgz, and also builds any 325# kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build 326# system can create more than one kernel from a single configuration 327# we figure out how many there are, what they're named, and move them 328# to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will 329# simply be "netbsd". If we don't find the "config" line, assume the 330# kernel will be "netbsd" (some config files are simple additions on 331# GENERIC, and just include it). 332# 333GETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 334 END{ if (found == 0) print "netbsd"; }' 335# 336.if !target(snap_kern) 337snap_kern: 338.ifndef KERNELS_DONE 339.for configfile in GENERIC ${EXTRA_KERNELS} ${BUILD_KERNELS} 340 cd ${KERNCONFDIR} && ${CONFIG} \ 341 -b ${KERNOBJDIR}/${configfile:C/.*\///} -s ${KERNSRCDIR} ${configfile} 342.ifndef UPDATE 343 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 344.endif 345 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} ${_J} 346.endfor # kernels 347 cd ${KERNOBJDIR}/GENERIC && \ 348 tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\ 349 gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz 350.for configfile in GENERIC ${EXTRA_KERNELS} 351 cd ${KERNOBJDIR}/${configfile:C/.*\///} && \ 352 for kernel in `${GETKERNELAWK} \ 353 ${KERNCONFDIR}/${configfile:C/.*\///}` ; do \ 354 gzip -c -9 < $${kernel} > \ 355 ${RELEASEDIR}/binary/kernel/$${kernel}.${configfile:C/.*\///}.gz ; done 356.endfor # EXTRA_KERNELS 357.endif # KERNELS_DONE 358.endif # no target(snap_kern) 359 360.endif # RELEASEDIR check 361 362snap_md_pre: 363# nothing here -- look in the machine-dependent Makefile.inc 364 365snap_md_post: 366# nothing here -- look in the machine-dependent Makefile.inc 367 368.endif # DESTDIR check 369 370.include <bsd.prog.mk> 371