Makefile revision 1.103
11.103Sfair#	$NetBSD: Makefile,v 1.103 1999/02/18 19:42:51 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.96Scjs
371.91Stron# XXX: For NO_SENDMAIL and USE_BIND4
381.90Skim.include <bsd.own.mk>
391.90Skim
401.23ScgdTZDIR=		/usr/share/zoneinfo
411.90SkimLOCALTIME?=	US/Pacific
421.19Sderaadt
431.55Sperry# setting NOOBJ prevents "make obj" from doing anything;
441.55Sperry# an objdir would break the installation stuff below
451.101SlukemMKOBJ=	no
461.1Scgd
471.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
481.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
491.80SjonathanBIN1=	
501.80SjonathanBIN2=
511.80SjonathanBIN3=
521.80Sjonathan
531.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
541.71Scjs.include "etc.${MACHINE}/Makefile.inc"
551.71Scjs.endif
561.32Sjtc
571.96Scjs# Use multiple jobs for kernel builds, if NBUILDJOBS set.
581.96Scjs# (Taken from src/Makefile.)
591.96Scjs.if defined(NBUILDJOBS)
601.96Scjs_J= -j${NBUILDJOBS}
611.96Scjs.endif
621.96Scjs
631.21Scgd# -rw-r--r--
641.21ScgdBINOWN= root
651.21ScgdBINGRP= wheel
661.92SperryBIN1+=	aliases bootptab changelist csh.cshrc csh.login \
671.92Sperry	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
681.92Sperry	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
691.92Sperry	inetd.conf ld.so.conf lkm.conf mailer.conf man.conf \
701.92Sperry	monthly monthly.conf mrouted.conf netstart networks \
711.94Slukem	newsyslog.conf nsswitch.conf phones printcap profile protocols \
721.92Sperry	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
731.92Sperry	rc.shutdown remote rpc security security.conf services \
741.92Sperry	shells syslog.conf weekly weekly.conf etc.${MACHINE}/ttys \
751.92Sperry	etc.${MACHINE}/disktab
761.1Scgd
771.46Sderaadt# -rw-rw-r--
781.80SjonathanBIN2+=	motd
791.1Scgd
801.77Smycroft# -rw-------
811.80SjonathanBIN3+=	hosts.equiv
821.77Smycroft
831.95SmycroftNAMEDB=	127 root.cache
841.91Stron.ifdef USE_BIND4
851.91StronNAMEDB+=	named.boot
861.91Stron.else
871.90SkimNAMEDB+=	named.conf
881.90Skim.endif
891.1ScgdPCS=	pcs750.bin
901.1Scgd
911.88Slukemall clean cleandir depend distclean etc includes install lint:
921.1Scgd
931.34Scgd.ifndef DESTDIR
941.41Scgddistribution distrib-dirs snapshot:
951.36Scgd	@echo setenv DESTDIR before doing that!
961.34Scgd	@false
971.34Scgd.else
981.7Scgddistribution: distrib-dirs
991.87Sperry.if !defined(INSTALL_DONE)
1001.53Scgd	(cd ..; ${MAKE} includes)
1011.32Sjtc	(cd ..; ${MAKE} install)
1021.87Sperry.endif
1031.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
1041.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
1051.77Smycroft	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
1061.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 crontab \
1071.56Sthorpej	    ${DESTDIR}/var/cron/tabs/root
1081.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
1091.68Sperry	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
1101.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
1111.1Scgd	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1121.73Sperry	${INSTALL} -c -o root -g wheel -m 600 minfree \
1131.73Sperry	    ${DESTDIR}/var/crash
1141.1Scgd	(cd root; \
1151.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
1161.1Scgd		    ${DESTDIR}/root/.cshrc; \
1171.65Smikel		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
1181.1Scgd		    ${DESTDIR}/root/.klogin; \
1191.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.login \
1201.1Scgd		    ${DESTDIR}/root/.login; \
1211.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
1221.1Scgd		    ${DESTDIR}/root/.profile; \
1231.1Scgd		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
1241.1Scgd		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
1251.1Scgd		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
1261.83Smrg	(cd mtree; ${MAKE} install)
1271.63Smikel	(cd namedb; \
1281.63Smikel		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
1291.64Spk		    ${DESTDIR}/etc/namedb)
1301.19Sderaadt	/bin/rm -f ${DESTDIR}/etc/localtime
1311.19Sderaadt	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
1321.48Sderaadt	/bin/rm -f ${DESTDIR}/etc/rmt
1331.48Sderaadt	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
1341.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
1351.32Sjtc		${DESTDIR}/etc/dumpdates
1361.93Sabs	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
1371.44Sderaadt		${DESTDIR}/etc/skeykeys
1381.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
1391.38Scgd		${DESTDIR}/var/cron/log
1401.56Sthorpej	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
1411.32Sjtc		${DESTDIR}/var/db/locate.database
1421.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1431.69Sperry		${DESTDIR}/var/log/authlog
1441.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1451.32Sjtc		${DESTDIR}/var/log/lastlog
1461.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
1471.32Sjtc		${DESTDIR}/var/log/lpd-errs
1481.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1491.32Sjtc		${DESTDIR}/var/log/maillog
1501.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1511.32Sjtc		${DESTDIR}/var/log/messages
1521.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1531.58Slukem		${DESTDIR}/var/log/secure
1541.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1551.32Sjtc		${DESTDIR}/var/log/wtmp
1561.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1571.69Sperry		${DESTDIR}/var/log/xferlog
1581.56Sthorpej	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
1591.39Scgd		${DESTDIR}/var/msgs/bounds
1601.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1611.32Sjtc		${DESTDIR}/var/run/utmp
1621.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1631.81Smrg		${DESTDIR}/var/games/atc_scores
1641.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1651.81Smrg		${DESTDIR}/var/games/battlestar.log
1661.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1671.81Smrg		${DESTDIR}/var/games/cfscores
1681.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1691.82Sperry		${DESTDIR}/var/games/criblog
1701.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1711.81Smrg		${DESTDIR}/var/games/robots_roll
1721.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1731.81Smrg		${DESTDIR}/var/games/rogue.scores
1741.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1751.81Smrg		${DESTDIR}/var/games/saillog
1761.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1771.81Smrg		${DESTDIR}/var/games/snakerawscores
1781.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1791.81Smrg		${DESTDIR}/var/games/snake.log
1801.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1811.81Smrg		${DESTDIR}/var/games/tetris.scores
1821.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1831.81Smrg		${DESTDIR}/var/games/larn/llog12.0
1841.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1851.81Smrg		${DESTDIR}/var/games/larn/lscore12.0
1861.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1871.81Smrg		${DESTDIR}/var/games/larn/playerids
1881.56Sthorpej	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
1891.6Scgd	    fstab.* ${DESTDIR}/etc)
1901.49Stls	(cd ${DESTDIR}/dev; ./MAKEDEV all)
1911.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
1921.90Skim.ifndef NO_SENDMAIL
1931.35Scgd	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
1941.90Skim.endif
1951.1Scgd
1961.1Scgd
1971.7Scgddistrib-dirs:
1981.56Sthorpej	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
1991.67Sperry	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
2001.28Sjtc	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
2011.99Scjs
2021.96Scjs.if !defined(RELEASEDIR)
2031.96Scjssnapshot snap_pre:
2041.96Scjs	@echo setenv RELEASEDIR before doing that!
2051.96Scjs	@false
2061.96Scjs.else
2071.100Scjsrelease snapshot: distribution snap_pre snap_md snap_kern 
2081.96Scjs	sh ../distrib/sets/maketars -s ../distrib/sets \
2091.96Scjs		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
2101.103Sfair.ifndef EXPORTABLE_SYSTEM
2111.103Sfair	sh ../distrib/sets/maketars -s ../distrib/sets \
2121.103Sfair		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
2131.103Sfair	(cd ${RELEASEDIR}/binary/security && \
2141.103Sfair		cksum -o 1 *.tgz >BSDSUM && \
2151.103Sfair		cksum *.tgz >CKSUM && \
2161.103Sfair		cksum -m *.tgz >MD5 && \
2171.103Sfair		cksum -o 2 *.tgz >SYSVSUM )
2181.103Sfair.endif
2191.96Scjs	(cd ${RELEASEDIR}/binary/sets && \
2201.96Scjs		cksum -o 1 *.tgz >BSDSUM && \
2211.96Scjs		cksum *.tgz >CKSUM && \
2221.96Scjs		cksum -m *.tgz >MD5 && \
2231.96Scjs		cksum -o 2 *.tgz >SYSVSUM )
2241.96Scjs	(cd ${RELEASEDIR}/binary/kernel && if [ -r *.gz ]; then \
2251.96Scjs		cksum -o 1 *.gz >BSDSUM && \
2261.96Scjs		cksum *.gz >CKSUM && \
2271.96Scjs		cksum -m *.gz >MD5 && \
2281.96Scjs		cksum -o 2 *.gz >SYSVSUM \
2291.96Scjs		; fi )
2301.41Scgd
2311.41Scgdsnap_pre:
2321.96Scjs	/bin/rm -rf ${RELEASEDIR}
2331.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
2341.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
2351.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
2361.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
2371.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
2381.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
2391.96Scjs
2401.96Scjs# the regular expression does a basename(1) on .CURDIR so that we don't
2411.96Scjs# have to keep looking up .. at compile time.
2421.96ScjsKERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
2431.96ScjsKERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
2441.96ScjsKERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
2451.96Scjs
2461.96Scjs# This target builds the GENERIC kernel (which must exist for all
2471.96Scjs# ports) and puts it in binary/sets/kern.tgz, and also builds any
2481.96Scjs# kernels specified in EXTRA_KERNELS and puts them in
2491.96Scjs# binary/kernel/netbsd.${KERN}.gz
2501.96Scjs#
2511.96Scjssnap_kern:
2521.96Scjs	cd ${KERNCONFDIR} && config \
2531.96Scjs		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
2541.97Scjs.ifndef UPDATE
2551.96Scjs	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
2561.96Scjs.endif
2571.96Scjs	cd ${KERNOBJDIR}/GENERIC &&	\
2581.96Scjs		${MAKE} depend && ${MAKE} ${_J} &&	\
2591.96Scjs		tar cf - netbsd |\
2601.96Scjs		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
2611.96Scjs.for kernel in ${EXTRA_KERNELS}
2621.96Scjs	cd ${KERNCONFDIR} && config \
2631.96Scjs		-b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
2641.98Scjs.ifndef UPDATE
2651.96Scjs	cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean 
2661.96Scjs.endif
2671.96Scjs	cd ${KERNOBJDIR}/${kernel} &&	\
2681.96Scjs		${MAKE} depend && ${MAKE} ${_J} &&	\
2691.102Sfair		gzip -c -9 < netbsd > \
2701.102Sfair			${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
2711.96Scjs.endfor # EXTRA_KERNELS
2721.96Scjs	
2731.96Scjs.endif # RELEASEDIR check
2741.41Scgd
2751.41Scgdsnap_md:
2761.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
2771.41Scgd
2781.34Scgd.endif	# DESTDIR check
2791.7Scgd
2801.1Scgd.include <bsd.prog.mk>
281