Makefile revision 1.96
11.96Scjs#	$NetBSD: Makefile,v 1.96 1999/02/05 03:01:49 cjs 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.96Scjs#   NO_SENDMAIL is normally undefined; if defined, it will not do a
201.96Scjs#	`make distribution' in the sendmail config file source directory.
211.96Scjs#   USE_BIND4 is normally unset; if set, it will install a named.boot
221.96Scjs#	instead of a named.conf in etc/namedb.
231.96Scjs#   EXTRA_KERNELS has a machine-dependent list of kernels to build added
241.96Scjs#	to it, but you may also set this to have extra ones built.
251.96Scjs# 
261.96Scjs# Targets:
271.96Scjs#    distribution: makes a full NetBSD distribution in DESTDIR. If
281.96Scjs#	INSTALL_DONE is set, it will not do a `make install.'
291.96Scjs#    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
301.96Scjs#	Called by distribution.
311.96Scjs#    snapshot: calls distribution, above, and then tars up the files
321.96Scjs#	into a release(7) format in RELEASEDIR. Any port-dependent
331.96Scjs#	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
341.96Scjs
351.91Stron# XXX: For NO_SENDMAIL and USE_BIND4
361.90Skim.include <bsd.own.mk>
371.90Skim
381.23ScgdTZDIR=		/usr/share/zoneinfo
391.90SkimLOCALTIME?=	US/Pacific
401.19Sderaadt
411.55Sperry# setting NOOBJ prevents "make obj" from doing anything;
421.55Sperry# an objdir would break the installation stuff below
431.1ScgdNOOBJ=	oobj
441.1Scgd
451.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
461.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
471.80SjonathanBIN1=	
481.80SjonathanBIN2=
491.80SjonathanBIN3=
501.80Sjonathan
511.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
521.71Scjs.include "etc.${MACHINE}/Makefile.inc"
531.71Scjs.endif
541.32Sjtc
551.96Scjs# Use multiple jobs for kernel builds, if NBUILDJOBS set.
561.96Scjs# (Taken from src/Makefile.)
571.96Scjs.if defined(NBUILDJOBS)
581.96Scjs_J= -j${NBUILDJOBS}
591.96Scjs.endif
601.96Scjs
611.21Scgd# -rw-r--r--
621.21ScgdBINOWN= root
631.21ScgdBINGRP= wheel
641.92SperryBIN1+=	aliases bootptab changelist csh.cshrc csh.login \
651.92Sperry	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
661.92Sperry	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
671.92Sperry	inetd.conf ld.so.conf lkm.conf mailer.conf man.conf \
681.92Sperry	monthly monthly.conf mrouted.conf netstart networks \
691.94Slukem	newsyslog.conf nsswitch.conf phones printcap profile protocols \
701.92Sperry	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
711.92Sperry	rc.shutdown remote rpc security security.conf services \
721.92Sperry	shells syslog.conf weekly weekly.conf etc.${MACHINE}/ttys \
731.92Sperry	etc.${MACHINE}/disktab
741.1Scgd
751.46Sderaadt# -rw-rw-r--
761.80SjonathanBIN2+=	motd
771.1Scgd
781.77Smycroft# -rw-------
791.80SjonathanBIN3+=	hosts.equiv
801.77Smycroft
811.95SmycroftNAMEDB=	127 root.cache
821.91Stron.ifdef USE_BIND4
831.91StronNAMEDB+=	named.boot
841.91Stron.else
851.90SkimNAMEDB+=	named.conf
861.90Skim.endif
871.1ScgdPCS=	pcs750.bin
881.1Scgd
891.88Slukemall clean cleandir depend distclean etc includes install lint:
901.1Scgd
911.34Scgd.ifndef DESTDIR
921.41Scgddistribution distrib-dirs snapshot:
931.36Scgd	@echo setenv DESTDIR before doing that!
941.34Scgd	@false
951.34Scgd.else
961.7Scgddistribution: distrib-dirs
971.87Sperry.if !defined(INSTALL_DONE)
981.53Scgd	(cd ..; ${MAKE} includes)
991.32Sjtc	(cd ..; ${MAKE} install)
1001.87Sperry.endif
1011.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
1021.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
1031.77Smycroft	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
1041.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 crontab \
1051.56Sthorpej	    ${DESTDIR}/var/cron/tabs/root
1061.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
1071.68Sperry	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
1081.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
1091.1Scgd	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1101.73Sperry	${INSTALL} -c -o root -g wheel -m 600 minfree \
1111.73Sperry	    ${DESTDIR}/var/crash
1121.1Scgd	(cd root; \
1131.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
1141.1Scgd		    ${DESTDIR}/root/.cshrc; \
1151.65Smikel		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
1161.1Scgd		    ${DESTDIR}/root/.klogin; \
1171.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.login \
1181.1Scgd		    ${DESTDIR}/root/.login; \
1191.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
1201.1Scgd		    ${DESTDIR}/root/.profile; \
1211.1Scgd		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
1221.1Scgd		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
1231.1Scgd		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
1241.83Smrg	(cd mtree; ${MAKE} install)
1251.63Smikel	(cd namedb; \
1261.63Smikel		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
1271.64Spk		    ${DESTDIR}/etc/namedb)
1281.19Sderaadt	/bin/rm -f ${DESTDIR}/etc/localtime
1291.19Sderaadt	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
1301.48Sderaadt	/bin/rm -f ${DESTDIR}/etc/rmt
1311.48Sderaadt	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
1321.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
1331.32Sjtc		${DESTDIR}/etc/dumpdates
1341.93Sabs	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
1351.44Sderaadt		${DESTDIR}/etc/skeykeys
1361.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
1371.38Scgd		${DESTDIR}/var/cron/log
1381.56Sthorpej	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
1391.32Sjtc		${DESTDIR}/var/db/locate.database
1401.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1411.69Sperry		${DESTDIR}/var/log/authlog
1421.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1431.32Sjtc		${DESTDIR}/var/log/lastlog
1441.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
1451.32Sjtc		${DESTDIR}/var/log/lpd-errs
1461.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1471.32Sjtc		${DESTDIR}/var/log/maillog
1481.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1491.32Sjtc		${DESTDIR}/var/log/messages
1501.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1511.58Slukem		${DESTDIR}/var/log/secure
1521.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1531.32Sjtc		${DESTDIR}/var/log/wtmp
1541.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1551.69Sperry		${DESTDIR}/var/log/xferlog
1561.56Sthorpej	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
1571.39Scgd		${DESTDIR}/var/msgs/bounds
1581.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1591.32Sjtc		${DESTDIR}/var/run/utmp
1601.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1611.81Smrg		${DESTDIR}/var/games/atc_scores
1621.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1631.81Smrg		${DESTDIR}/var/games/battlestar.log
1641.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1651.81Smrg		${DESTDIR}/var/games/cfscores
1661.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1671.82Sperry		${DESTDIR}/var/games/criblog
1681.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1691.81Smrg		${DESTDIR}/var/games/robots_roll
1701.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1711.81Smrg		${DESTDIR}/var/games/rogue.scores
1721.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1731.81Smrg		${DESTDIR}/var/games/saillog
1741.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1751.81Smrg		${DESTDIR}/var/games/snakerawscores
1761.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1771.81Smrg		${DESTDIR}/var/games/snake.log
1781.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1791.81Smrg		${DESTDIR}/var/games/tetris.scores
1801.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1811.81Smrg		${DESTDIR}/var/games/larn/llog12.0
1821.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1831.81Smrg		${DESTDIR}/var/games/larn/lscore12.0
1841.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1851.81Smrg		${DESTDIR}/var/games/larn/playerids
1861.56Sthorpej	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
1871.6Scgd	    fstab.* ${DESTDIR}/etc)
1881.49Stls	(cd ${DESTDIR}/dev; ./MAKEDEV all)
1891.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
1901.90Skim.ifndef NO_SENDMAIL
1911.35Scgd	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
1921.90Skim.endif
1931.1Scgd
1941.1Scgd
1951.7Scgddistrib-dirs:
1961.56Sthorpej	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
1971.67Sperry	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
1981.28Sjtc	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
1991.41Scgd
2001.96Scjs.if !defined(RELEASEDIR)
2011.96Scjssnapshot snap_pre:
2021.96Scjs	@echo setenv RELEASEDIR before doing that!
2031.96Scjs	@false
2041.96Scjs.else
2051.96Scjssnapshot: distribution snap_pre snap_md snap_kern 
2061.96Scjs	sh ../distrib/sets/maketars -s ../distrib/sets \
2071.96Scjs		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
2081.96Scjs	(cd ${RELEASEDIR}/binary/sets && \
2091.96Scjs		cksum -o 1 *.tgz >BSDSUM && \
2101.96Scjs		cksum *.tgz >CKSUM && \
2111.96Scjs		cksum -m *.tgz >MD5 && \
2121.96Scjs		cksum -o 2 *.tgz >SYSVSUM )
2131.96Scjs	(cd ${RELEASEDIR}/binary/kernel && if [ -r *.gz ]; then \
2141.96Scjs		cksum -o 1 *.gz >BSDSUM && \
2151.96Scjs		cksum *.gz >CKSUM && \
2161.96Scjs		cksum -m *.gz >MD5 && \
2171.96Scjs		cksum -o 2 *.gz >SYSVSUM \
2181.96Scjs		; fi )
2191.41Scgd
2201.41Scgdsnap_pre:
2211.96Scjs	/bin/rm -rf ${RELEASEDIR}
2221.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
2231.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
2241.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
2251.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
2261.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
2271.96Scjs	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
2281.96Scjs
2291.96Scjs# the regular expression does a basename(1) on .CURDIR so that we don't
2301.96Scjs# have to keep looking up .. at compile time.
2311.96ScjsKERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
2321.96ScjsKERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
2331.96ScjsKERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
2341.96Scjs
2351.96Scjs# This target builds the GENERIC kernel (which must exist for all
2361.96Scjs# ports) and puts it in binary/sets/kern.tgz, and also builds any
2371.96Scjs# kernels specified in EXTRA_KERNELS and puts them in
2381.96Scjs# binary/kernel/netbsd.${KERN}.gz
2391.96Scjs#
2401.96Scjssnap_kern:
2411.96Scjs	cd ${KERNCONFDIR} && config \
2421.96Scjs		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
2431.96Scjs.ifndef BUILD
2441.96Scjs	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
2451.96Scjs.endif
2461.96Scjs	cd ${KERNOBJDIR}/GENERIC &&	\
2471.96Scjs		${MAKE} depend && ${MAKE} ${_J} &&	\
2481.96Scjs		tar cf - netbsd |\
2491.96Scjs		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
2501.96Scjs.for kernel in ${EXTRA_KERNELS}
2511.96Scjs	cd ${KERNCONFDIR} && config \
2521.96Scjs		-b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
2531.96Scjs.ifndef BUILD
2541.96Scjs	cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean 
2551.96Scjs.endif
2561.96Scjs	cd ${KERNOBJDIR}/${kernel} &&	\
2571.96Scjs		${MAKE} depend && ${MAKE} ${_J} &&	\
2581.96Scjs		tar cf - netbsd |\
2591.96Scjs		gzip -c -9 > ${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
2601.96Scjs.endfor # EXTRA_KERNELS
2611.96Scjs	
2621.96Scjs.endif # RELEASEDIR check
2631.41Scgd
2641.41Scgdsnap_md:
2651.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
2661.41Scgd
2671.34Scgd.endif	# DESTDIR check
2681.7Scgd
2691.1Scgd.include <bsd.prog.mk>
270