Makefile revision 1.116
11.116Sfair# $NetBSD: Makefile,v 1.116 1999/04/10 04:41:52 fair Exp $ 21.66Smikel# from: @(#)Makefile 8.7 (Berkeley) 5/25/95 31.1Scgd 41.96Scjs# Environment variables without default values: 51.96Scjs# DESTDIR must be set before anything in this file will work. 61.96Scjs# RELEASEDIR is where the tarred up stuff for a snapshot or 71.96Scjs# release will be placed. 81.96Scjs# 91.96Scjs# Environment variables with default values: 101.96Scjs# LOCALTIME will set the default local time for the system you 111.96Scjs# build; it determines what /etc/localtime is symlink'd to. 121.96Scjs# KERNSRCDIR points to kernel source; it is set by default to ../sys, 131.96Scjs# but can be overridden. 141.96Scjs# KERNOBJDIR is the kernel build directory, it defaults to 151.96Scjs# ${KERNSRCDIR}/arch/${MACHINE}/compile/KERNELNAME, but can be 161.96Scjs# overridden. 171.96Scjs# KERNCONFDIR is where the configuration files for kernels are found; 181.96Scjs# default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden. 191.97Scjs# UPDATE is normally undefined; if defined, don't do a 'make clean' 201.97Scjs# before kernel compile 211.96Scjs# NO_SENDMAIL is normally undefined; if defined, it will not do a 221.96Scjs# `make distribution' in the sendmail config file source directory. 231.96Scjs# USE_BIND4 is normally unset; if set, it will install a named.boot 241.96Scjs# instead of a named.conf in etc/namedb. 251.96Scjs# EXTRA_KERNELS has a machine-dependent list of kernels to build added 261.96Scjs# to it, but you may also set this to have extra ones built. 271.96Scjs# 281.96Scjs# Targets: 291.96Scjs# distribution: makes a full NetBSD distribution in DESTDIR. If 301.96Scjs# INSTALL_DONE is set, it will not do a `make install.' 311.96Scjs# distrib-dirs: creates an empty NetBSD directory tree in DESTDIR. 321.96Scjs# Called by distribution. 331.96Scjs# snapshot: calls distribution, above, and then tars up the files 341.96Scjs# into a release(7) format in RELEASEDIR. Any port-dependent 351.96Scjs# stuff for this target is found in etc.${MACHINE}/Makefile.inc. 361.106Scjs# release: a synonym for `snapshot' 371.96Scjs 381.91Stron# XXX: For NO_SENDMAIL and USE_BIND4 391.90Skim.include <bsd.own.mk> 401.90Skim 411.23ScgdTZDIR= /usr/share/zoneinfo 421.90SkimLOCALTIME?= US/Pacific 431.19Sderaadt 441.55Sperry# setting NOOBJ prevents "make obj" from doing anything; 451.55Sperry# an objdir would break the installation stuff below 461.101SlukemMKOBJ= no 471.1Scgd 481.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 491.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=". 501.80SjonathanBIN1= 511.80SjonathanBIN2= 521.80SjonathanBIN3= 531.80Sjonathan 541.71Scjs.if exists(etc.${MACHINE}/Makefile.inc) 551.71Scjs.include "etc.${MACHINE}/Makefile.inc" 561.71Scjs.endif 571.32Sjtc 581.96Scjs# Use multiple jobs for kernel builds, if NBUILDJOBS set. 591.96Scjs# (Taken from src/Makefile.) 601.96Scjs.if defined(NBUILDJOBS) 611.96Scjs_J= -j${NBUILDJOBS} 621.96Scjs.endif 631.96Scjs 641.21Scgd# -rw-r--r-- 651.21ScgdBINOWN= root 661.21ScgdBINGRP= wheel 671.92SperryBIN1+= aliases bootptab changelist csh.cshrc csh.login \ 681.92Sperry csh.logout daily daily.conf dm.conf floppytab ftpchroot \ 691.92Sperry ftpusers ftpwelcome gettytab group hosts hosts.lpd \ 701.105Smycroft inetd.conf lkm.conf mailer.conf man.conf \ 711.92Sperry monthly monthly.conf mrouted.conf netstart networks \ 721.94Slukem newsyslog.conf nsswitch.conf phones printcap profile protocols \ 731.92Sperry rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \ 741.108Sdrochner rc.shutdown rc.wscons remote rpc security security.conf services \ 751.109Sdrochner shells syslog.conf weekly weekly.conf wscons.conf \ 761.109Sdrochner etc.${MACHINE}/ttys etc.${MACHINE}/disktab 771.105Smycroft 781.105Smycroft.if (${MACHINE_ARCH} == "i386") || \ 791.105Smycroft (${MACHINE_ARCH} == "m68k") || \ 801.105Smycroft (${MACHINE_ARCH} == "ns32k") || \ 811.105Smycroft (${MACHINE_ARCH} == "sparc") || \ 821.105Smycroft (${MACHINE_ARCH} == "vax") || \ 831.105Smycroft (${MACHINE_ARCH} == "arm32") 841.105SmycroftBIN1+= ld.so.conf 851.105Smycroft.endif 861.1Scgd 871.46Sderaadt# -rw-rw-r-- 881.80SjonathanBIN2+= motd 891.1Scgd 901.77Smycroft# -rw------- 911.80SjonathanBIN3+= hosts.equiv 921.77Smycroft 931.95SmycroftNAMEDB= 127 root.cache 941.91Stron.ifdef USE_BIND4 951.91StronNAMEDB+= named.boot 961.91Stron.else 971.90SkimNAMEDB+= named.conf 981.90Skim.endif 991.1ScgdPCS= pcs750.bin 1001.1Scgd 1011.88Slukemall clean cleandir depend distclean etc includes install lint: 1021.1Scgd 1031.34Scgd.ifndef DESTDIR 1041.106Scjsdistribution distrib-dirs release snapshot: 1051.36Scgd @echo setenv DESTDIR before doing that! 1061.34Scgd @false 1071.34Scgd.else 1081.7Scgddistribution: distrib-dirs 1091.87Sperry.if !defined(INSTALL_DONE) 1101.107Sscottr (cd ..; ${MAKE} _DISTRIB= includes) 1111.107Sscottr (cd ..; ${MAKE} _DISTRIB= install) 1121.87Sperry.endif 1131.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc 1141.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc 1151.77Smycroft ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc 1161.56Sthorpej ${INSTALL} -c -o root -g wheel -m 600 crontab \ 1171.56Sthorpej ${DESTDIR}/var/cron/tabs/root 1181.56Sthorpej ${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc 1191.68Sperry pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd 1201.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ 1211.1Scgd MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev 1221.73Sperry ${INSTALL} -c -o root -g wheel -m 600 minfree \ 1231.73Sperry ${DESTDIR}/var/crash 1241.1Scgd (cd root; \ 1251.56Sthorpej ${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \ 1261.1Scgd ${DESTDIR}/root/.cshrc; \ 1271.65Smikel ${INSTALL} -c -o root -g wheel -m 600 dot.klogin \ 1281.1Scgd ${DESTDIR}/root/.klogin; \ 1291.56Sthorpej ${INSTALL} -c -o root -g wheel -m 644 dot.login \ 1301.1Scgd ${DESTDIR}/root/.login; \ 1311.56Sthorpej ${INSTALL} -c -o root -g wheel -m 644 dot.profile \ 1321.1Scgd ${DESTDIR}/root/.profile; \ 1331.1Scgd rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ 1341.1Scgd ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ 1351.1Scgd ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile) 1361.83Smrg (cd mtree; ${MAKE} install) 1371.63Smikel (cd namedb; \ 1381.63Smikel ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \ 1391.64Spk ${DESTDIR}/etc/namedb) 1401.19Sderaadt /bin/rm -f ${DESTDIR}/etc/localtime 1411.19Sderaadt ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 1421.48Sderaadt /bin/rm -f ${DESTDIR}/etc/rmt 1431.48Sderaadt ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt 1441.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \ 1451.32Sjtc ${DESTDIR}/etc/dumpdates 1461.93Sabs ${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \ 1471.44Sderaadt ${DESTDIR}/etc/skeykeys 1481.56Sthorpej ${INSTALL} -c -o root -g wheel -m 600 /dev/null \ 1491.38Scgd ${DESTDIR}/var/cron/log 1501.56Sthorpej ${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \ 1511.32Sjtc ${DESTDIR}/var/db/locate.database 1521.113Sfair ${INSTALL} -c -o uucp -g dialer -m 640 /dev/null \ 1531.113Sfair ${DESTDIR}/var/log/aculog 1541.69Sperry ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 1551.69Sperry ${DESTDIR}/var/log/authlog 1561.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 1571.32Sjtc ${DESTDIR}/var/log/lastlog 1581.58Slukem ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \ 1591.32Sjtc ${DESTDIR}/var/log/lpd-errs 1601.58Slukem ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 1611.32Sjtc ${DESTDIR}/var/log/maillog 1621.58Slukem ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 1631.32Sjtc ${DESTDIR}/var/log/messages 1641.58Slukem ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 1651.58Slukem ${DESTDIR}/var/log/secure 1661.58Slukem ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ 1671.32Sjtc ${DESTDIR}/var/log/wtmp 1681.69Sperry ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ 1691.69Sperry ${DESTDIR}/var/log/xferlog 1701.56Sthorpej ${INSTALL} -c -o daemon -g staff -m 664 /dev/null \ 1711.39Scgd ${DESTDIR}/var/msgs/bounds 1721.56Sthorpej ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ 1731.32Sjtc ${DESTDIR}/var/run/utmp 1741.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1751.81Smrg ${DESTDIR}/var/games/atc_scores 1761.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1771.81Smrg ${DESTDIR}/var/games/battlestar.log 1781.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1791.81Smrg ${DESTDIR}/var/games/cfscores 1801.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1811.82Sperry ${DESTDIR}/var/games/criblog 1821.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1831.81Smrg ${DESTDIR}/var/games/robots_roll 1841.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1851.81Smrg ${DESTDIR}/var/games/rogue.scores 1861.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1871.81Smrg ${DESTDIR}/var/games/saillog 1881.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1891.81Smrg ${DESTDIR}/var/games/snakerawscores 1901.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1911.81Smrg ${DESTDIR}/var/games/snake.log 1921.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1931.81Smrg ${DESTDIR}/var/games/tetris.scores 1941.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1951.81Smrg ${DESTDIR}/var/games/larn/llog12.0 1961.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1971.81Smrg ${DESTDIR}/var/games/larn/lscore12.0 1981.81Smrg ${INSTALL} -c -o games -g games -m 664 /dev/null \ 1991.81Smrg ${DESTDIR}/var/games/larn/playerids 2001.56Sthorpej (cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ 2011.6Scgd fstab.* ${DESTDIR}/etc) 2021.49Stls (cd ${DESTDIR}/dev; ./MAKEDEV all) 2031.62Sperry (cd ../usr.bin/mail; ${MAKE} distribution) 2041.90Skim.ifndef NO_SENDMAIL 2051.35Scgd (cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution) 2061.90Skim.endif 2071.112Sperry.ifdef BUILD_POSTFIX 2081.110Smrg (cd ../usr.sbin/postfix/etc; ${MAKE} distribution) 2091.111Ssimonb.endif 2101.1Scgd 2111.1Scgd 2121.7Scgddistrib-dirs: 2131.56Sthorpej ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR} 2141.67Sperry -mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u 2151.28Sjtc cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys 2161.99Scjs 2171.96Scjs.if !defined(RELEASEDIR) 2181.106Scjsrelease snapshot snap_pre: 2191.96Scjs @echo setenv RELEASEDIR before doing that! 2201.96Scjs @false 2211.96Scjs.else 2221.100Scjsrelease snapshot: distribution snap_pre snap_md snap_kern 2231.96Scjs sh ../distrib/sets/maketars -s ../distrib/sets \ 2241.96Scjs -d ${DESTDIR} -t ${RELEASEDIR}/binary/sets 2251.104Sitohy.if exists(../domestic) && !defined(EXPORTABLE_SYSTEM) 2261.103Sfair sh ../distrib/sets/maketars -s ../distrib/sets \ 2271.103Sfair -d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr 2281.103Sfair (cd ${RELEASEDIR}/binary/security && \ 2291.103Sfair cksum -o 1 *.tgz >BSDSUM && \ 2301.103Sfair cksum *.tgz >CKSUM && \ 2311.103Sfair cksum -m *.tgz >MD5 && \ 2321.103Sfair cksum -o 2 *.tgz >SYSVSUM ) 2331.103Sfair.endif 2341.96Scjs (cd ${RELEASEDIR}/binary/sets && \ 2351.96Scjs cksum -o 1 *.tgz >BSDSUM && \ 2361.96Scjs cksum *.tgz >CKSUM && \ 2371.96Scjs cksum -m *.tgz >MD5 && \ 2381.96Scjs cksum -o 2 *.tgz >SYSVSUM ) 2391.104Sitohy.ifdef EXTRA_KERNELS 2401.104Sitohy (cd ${RELEASEDIR}/binary/kernel && \ 2411.96Scjs cksum -o 1 *.gz >BSDSUM && \ 2421.96Scjs cksum *.gz >CKSUM && \ 2431.96Scjs cksum -m *.gz >MD5 && \ 2441.104Sitohy cksum -o 2 *.gz >SYSVSUM ) 2451.104Sitohy.endif 2461.41Scgd 2471.41Scgdsnap_pre: 2481.96Scjs /bin/rm -rf ${RELEASEDIR} 2491.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR} 2501.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary 2511.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets 2521.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel 2531.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security 2541.96Scjs ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation 2551.96Scjs 2561.96Scjs# the regular expression does a basename(1) on .CURDIR so that we don't 2571.96Scjs# have to keep looking up .. at compile time. 2581.96ScjsKERNSRCDIR?= ${.CURDIR:C/[^\/]+$//}sys 2591.96ScjsKERNOBJDIR?= ${KERNSRCDIR}/arch/${MACHINE}/compile 2601.96ScjsKERNCONFDIR?= ${KERNSRCDIR}/arch/${MACHINE}/conf 2611.96Scjs 2621.96Scjs# This target builds the GENERIC kernel (which must exist for all 2631.96Scjs# ports) and puts it in binary/sets/kern.tgz, and also builds any 2641.114Sfair# kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build 2651.114Sfair# system can create more than one kernel from a single configuration 2661.114Sfair# we figure out how many there are, what they're named, and move them 2671.114Sfair# to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will 2681.116Sfair# simply be "netbsd". If we don't find the "config" line, assume the 2691.116Sfair# kernel will be "netbsd" (some config files are simple additions on 2701.116Sfair# GENERIC, and just include it). 2711.116Sfair# 2721.116SfairGETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 2731.116Sfair END{ if (found == 0) print "netbsd"; }' 2741.96Scjs# 2751.96Scjssnap_kern: 2761.96Scjs cd ${KERNCONFDIR} && config \ 2771.96Scjs -b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC 2781.97Scjs.ifndef UPDATE 2791.96Scjs cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 2801.96Scjs.endif 2811.115Sfair cd ${KERNOBJDIR}/GENERIC && ${MAKE} depend && ${MAKE} ${_J} 2821.96Scjs cd ${KERNOBJDIR}/GENERIC && \ 2831.116Sfair tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\ 2841.96Scjs gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz 2851.114Sfair.for configfile in ${EXTRA_KERNELS} 2861.96Scjs cd ${KERNCONFDIR} && config \ 2871.114Sfair -b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile} 2881.98Scjs.ifndef UPDATE 2891.114Sfair cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 2901.96Scjs.endif 2911.115Sfair cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J} 2921.114Sfair cd ${KERNOBJDIR}/${configfile} && \ 2931.116Sfair for kernel in `${GETKERNELAWK} \ 2941.114Sfair ${KERNCONFDIR}/${configfile}` ; { \ 2951.114Sfair gzip -c -9 < $${kernel} > \ 2961.114Sfair ${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; } 2971.96Scjs.endfor # EXTRA_KERNELS 2981.108Sdrochner 2991.96Scjs.endif # RELEASEDIR check 3001.41Scgd 3011.41Scgdsnap_md: 3021.41Scgd# nothing here -- look in the machine-dependent Makefile.inc 3031.41Scgd 3041.34Scgd.endif # DESTDIR check 3051.7Scgd 3061.1Scgd.include <bsd.prog.mk> 307