Makefile revision 1.123
11.123Sis#	$NetBSD: Makefile,v 1.123 1999/07/22 20:10:16 is 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.119Sross#   BUILD_KERNELS are a machine-dependent list of kernels that should just
281.119Sross#	be built in place but not made into sets or installed, e.g., an
291.119Sross#	INSTALL kernel used later in src/distrib/.
301.96Scjs# 
311.96Scjs# Targets:
321.96Scjs#    distribution: makes a full NetBSD distribution in DESTDIR. If
331.96Scjs#	INSTALL_DONE is set, it will not do a `make install.'
341.96Scjs#    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
351.96Scjs#	Called by distribution.
361.96Scjs#    snapshot: calls distribution, above, and then tars up the files
371.96Scjs#	into a release(7) format in RELEASEDIR. Any port-dependent
381.96Scjs#	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
391.106Scjs#    release: a synonym for `snapshot'
401.96Scjs
411.91Stron# XXX: For NO_SENDMAIL and USE_BIND4
421.90Skim.include <bsd.own.mk>
431.90Skim
441.23ScgdTZDIR=		/usr/share/zoneinfo
451.90SkimLOCALTIME?=	US/Pacific
461.19Sderaadt
471.55Sperry# setting NOOBJ prevents "make obj" from doing anything;
481.55Sperry# an objdir would break the installation stuff below
491.101SlukemMKOBJ=	no
501.1Scgd
511.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
521.80Sjonathan# are empty, to preserve the old semantics of setting them below with "=".
531.80SjonathanBIN1=	
541.80SjonathanBIN2=
551.80SjonathanBIN3=
561.80Sjonathan
571.117Ssimonb# Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
581.117Ssimonb# add to this.
591.117Ssimonb# NOTE: Parent directories must be listed before subdirectories.
601.117SsimonbINSTALLATION_DIRS= \
611.117Ssimonb	binary binary/sets binary/kernel binary/security installation
621.117Ssimonb
631.71Scjs.if exists(etc.${MACHINE}/Makefile.inc)
641.71Scjs.include "etc.${MACHINE}/Makefile.inc"
651.71Scjs.endif
661.32Sjtc
671.96Scjs# Use multiple jobs for kernel builds, if NBUILDJOBS set.
681.96Scjs# (Taken from src/Makefile.)
691.96Scjs.if defined(NBUILDJOBS)
701.96Scjs_J= -j${NBUILDJOBS}
711.96Scjs.endif
721.96Scjs
731.21Scgd# -rw-r--r--
741.21ScgdBINOWN= root
751.21ScgdBINGRP= wheel
761.122SmycroftBIN1+=	bootptab changelist csh.cshrc csh.login \
771.92Sperry	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
781.92Sperry	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
791.105Smycroft	inetd.conf lkm.conf mailer.conf man.conf \
801.92Sperry	monthly monthly.conf mrouted.conf netstart networks \
811.94Slukem	newsyslog.conf nsswitch.conf phones printcap profile protocols \
821.92Sperry	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
831.108Sdrochner	rc.shutdown rc.wscons remote rpc security security.conf services \
841.109Sdrochner	shells syslog.conf weekly weekly.conf wscons.conf \
851.109Sdrochner	etc.${MACHINE}/ttys etc.${MACHINE}/disktab
861.105Smycroft
871.121Sfvdl.if	(${MACHINE_ARCH} == "m68k") || \
881.105Smycroft	(${MACHINE_ARCH} == "ns32k") || \
891.105Smycroft	(${MACHINE_ARCH} == "vax") || \
901.105Smycroft	(${MACHINE_ARCH} == "arm32")
911.105SmycroftBIN1+=	ld.so.conf
921.105Smycroft.endif
931.120Sitojun
941.120Sitojun# IPv6
951.120SitojunBIN1+=	rtadvd.conf
961.1Scgd
971.46Sderaadt# -rw-rw-r--
981.80SjonathanBIN2+=	motd
991.1Scgd
1001.77Smycroft# -rw-------
1011.80SjonathanBIN3+=	hosts.equiv
1021.77Smycroft
1031.95SmycroftNAMEDB=	127 root.cache
1041.91Stron.ifdef USE_BIND4
1051.91StronNAMEDB+=	named.boot
1061.91Stron.else
1071.90SkimNAMEDB+=	named.conf
1081.90Skim.endif
1091.1ScgdPCS=	pcs750.bin
1101.1Scgd
1111.88Slukemall clean cleandir depend distclean etc includes install lint:
1121.1Scgd
1131.34Scgd.ifndef DESTDIR
1141.106Scjsdistribution distrib-dirs release snapshot:
1151.36Scgd	@echo setenv DESTDIR before doing that!
1161.34Scgd	@false
1171.34Scgd.else
1181.7Scgddistribution: distrib-dirs
1191.87Sperry.if !defined(INSTALL_DONE)
1201.107Sscottr	(cd ..; ${MAKE} _DISTRIB= includes)
1211.107Sscottr	(cd ..; ${MAKE} _DISTRIB= install)
1221.87Sperry.endif
1231.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
1241.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
1251.77Smycroft	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
1261.122Smycroft	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 aliases ${DESTDIR}/etc
1271.122Smycroft	/usr/libexec/sendmail/sendmail -O AliasFile=${DESTDIR}/etc/aliases -bi
1281.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 crontab \
1291.56Sthorpej	    ${DESTDIR}/var/cron/tabs/root
1301.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
1311.68Sperry	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
1321.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
1331.1Scgd	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
1341.73Sperry	${INSTALL} -c -o root -g wheel -m 600 minfree \
1351.73Sperry	    ${DESTDIR}/var/crash
1361.1Scgd	(cd root; \
1371.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
1381.1Scgd		    ${DESTDIR}/root/.cshrc; \
1391.65Smikel		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
1401.1Scgd		    ${DESTDIR}/root/.klogin; \
1411.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.login \
1421.1Scgd		    ${DESTDIR}/root/.login; \
1431.56Sthorpej		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
1441.1Scgd		    ${DESTDIR}/root/.profile; \
1451.1Scgd		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
1461.1Scgd		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
1471.1Scgd		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
1481.83Smrg	(cd mtree; ${MAKE} install)
1491.63Smikel	(cd namedb; \
1501.63Smikel		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
1511.64Spk		    ${DESTDIR}/etc/namedb)
1521.19Sderaadt	/bin/rm -f ${DESTDIR}/etc/localtime
1531.19Sderaadt	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
1541.48Sderaadt	/bin/rm -f ${DESTDIR}/etc/rmt
1551.48Sderaadt	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
1561.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
1571.32Sjtc		${DESTDIR}/etc/dumpdates
1581.93Sabs	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
1591.44Sderaadt		${DESTDIR}/etc/skeykeys
1601.56Sthorpej	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
1611.38Scgd		${DESTDIR}/var/cron/log
1621.56Sthorpej	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
1631.32Sjtc		${DESTDIR}/var/db/locate.database
1641.113Sfair	${INSTALL} -c -o uucp -g dialer -m 640 /dev/null \
1651.113Sfair		${DESTDIR}/var/log/aculog
1661.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1671.69Sperry		${DESTDIR}/var/log/authlog
1681.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1691.32Sjtc		${DESTDIR}/var/log/lastlog
1701.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
1711.32Sjtc		${DESTDIR}/var/log/lpd-errs
1721.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1731.32Sjtc		${DESTDIR}/var/log/maillog
1741.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1751.32Sjtc		${DESTDIR}/var/log/messages
1761.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1771.58Slukem		${DESTDIR}/var/log/secure
1781.58Slukem	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
1791.32Sjtc		${DESTDIR}/var/log/wtmp
1801.69Sperry	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
1811.69Sperry		${DESTDIR}/var/log/xferlog
1821.56Sthorpej	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
1831.39Scgd		${DESTDIR}/var/msgs/bounds
1841.56Sthorpej	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
1851.32Sjtc		${DESTDIR}/var/run/utmp
1861.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1871.81Smrg		${DESTDIR}/var/games/atc_scores
1881.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1891.81Smrg		${DESTDIR}/var/games/battlestar.log
1901.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1911.81Smrg		${DESTDIR}/var/games/cfscores
1921.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1931.82Sperry		${DESTDIR}/var/games/criblog
1941.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1951.81Smrg		${DESTDIR}/var/games/robots_roll
1961.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1971.81Smrg		${DESTDIR}/var/games/rogue.scores
1981.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
1991.81Smrg		${DESTDIR}/var/games/saillog
2001.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2011.81Smrg		${DESTDIR}/var/games/snakerawscores
2021.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2031.81Smrg		${DESTDIR}/var/games/snake.log
2041.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2051.81Smrg		${DESTDIR}/var/games/tetris.scores
2061.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2071.81Smrg		${DESTDIR}/var/games/larn/llog12.0
2081.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2091.81Smrg		${DESTDIR}/var/games/larn/lscore12.0
2101.81Smrg	${INSTALL} -c -o games -g games -m 664 /dev/null \
2111.81Smrg		${DESTDIR}/var/games/larn/playerids
2121.56Sthorpej	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
2131.6Scgd	    fstab.* ${DESTDIR}/etc)
2141.49Stls	(cd ${DESTDIR}/dev; ./MAKEDEV all)
2151.62Sperry	(cd ../usr.bin/mail; ${MAKE} distribution)
2161.90Skim.ifndef NO_SENDMAIL
2171.35Scgd	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
2181.90Skim.endif
2191.112Sperry.ifdef BUILD_POSTFIX
2201.110Smrg	(cd ../usr.sbin/postfix/etc; ${MAKE} distribution)
2211.111Ssimonb.endif
2221.1Scgd
2231.1Scgd
2241.7Scgddistrib-dirs:
2251.56Sthorpej	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
2261.67Sperry	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
2271.28Sjtc	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
2281.99Scjs
2291.96Scjs.if !defined(RELEASEDIR)
2301.117Ssimonbrelease snapshot snap_pre snap_md_pre snap_md_post:
2311.96Scjs	@echo setenv RELEASEDIR before doing that!
2321.96Scjs	@false
2331.96Scjs.else
2341.117Ssimonbrelease snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post
2351.96Scjs	sh ../distrib/sets/maketars -s ../distrib/sets \
2361.96Scjs		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
2371.104Sitohy.if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
2381.103Sfair	sh ../distrib/sets/maketars -s ../distrib/sets \
2391.103Sfair		-d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
2401.123Sis	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/security
2411.103Sfair.endif
2421.123Sis	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/sets
2431.104Sitohy.ifdef EXTRA_KERNELS
2441.123Sis	sh ../distrib/sets/makesums -t ${RELEASEDIR}/binary/kernel '*.gz'
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.117Ssimonb.for dir in ${INSTALLATION_DIRS}
2511.117Ssimonb	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir}
2521.117Ssimonb.endfor
2531.96Scjs
2541.96Scjs# the regular expression does a basename(1) on .CURDIR so that we don't
2551.96Scjs# have to keep looking up .. at compile time.
2561.96ScjsKERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
2571.96ScjsKERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
2581.96ScjsKERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
2591.96Scjs
2601.96Scjs# This target builds the GENERIC kernel (which must exist for all
2611.96Scjs# ports) and puts it in binary/sets/kern.tgz, and also builds any
2621.114Sfair# kernels specified in EXTRA_KERNELS. Since NetBSD's kernel build
2631.114Sfair# system can create more than one kernel from a single configuration
2641.114Sfair# we figure out how many there are, what they're named, and move them
2651.114Sfair# to binary/kernel/${KERNEL}.${CONFIGFILE}.gz - most often KERNEL will
2661.116Sfair# simply be "netbsd". If we don't find the "config" line, assume the
2671.116Sfair# kernel will be "netbsd" (some config files are simple additions on
2681.116Sfair# GENERIC, and just include it).
2691.116Sfair#
2701.116SfairGETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
2711.116Sfair		END{ if (found == 0) print "netbsd"; }'
2721.96Scjs#
2731.118Sgwr.if !target(snap_kern)
2741.96Scjssnap_kern:
2751.96Scjs	cd ${KERNCONFDIR} && config \
2761.96Scjs		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
2771.97Scjs.ifndef UPDATE
2781.96Scjs	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
2791.96Scjs.endif
2801.115Sfair	cd ${KERNOBJDIR}/GENERIC && ${MAKE} depend && ${MAKE} ${_J}
2811.96Scjs	cd ${KERNOBJDIR}/GENERIC &&	\
2821.116Sfair		tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\
2831.96Scjs		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
2841.117Ssimonb# XXX use same loop for ${EXTRA_KERNELS} and ${BUILD_KERNELS} but
2851.117Ssimonb# XXX only install ${EXTRA_KERNELS} in binary/kernel???
2861.114Sfair.for configfile in ${EXTRA_KERNELS}
2871.96Scjs	cd ${KERNCONFDIR} && config \
2881.114Sfair		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
2891.98Scjs.ifndef UPDATE
2901.114Sfair	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
2911.96Scjs.endif
2921.115Sfair	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
2931.114Sfair	cd ${KERNOBJDIR}/${configfile} &&	\
2941.116Sfair		for kernel in `${GETKERNELAWK} \
2951.114Sfair			${KERNCONFDIR}/${configfile}` ; {   \
2961.114Sfair		gzip -c -9 < $${kernel} > \
2971.114Sfair			${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; }
2981.96Scjs.endfor # EXTRA_KERNELS
2991.117Ssimonb.for configfile in ${BUILD_KERNELS}
3001.117Ssimonb	cd ${KERNCONFDIR} && config \
3011.117Ssimonb		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
3021.117Ssimonb.ifndef UPDATE
3031.117Ssimonb	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
3041.117Ssimonb.endif
3051.117Ssimonb	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
3061.117Ssimonb.endfor # BUILD_KERNELS
3071.118Sgwr.endif # no target(snap_kern)
3081.108Sdrochner
3091.96Scjs.endif # RELEASEDIR check
3101.41Scgd
3111.117Ssimonbsnap_md_pre:
3121.117Ssimonb# nothing here -- look in the machine-dependent Makefile.inc
3131.117Ssimonb
3141.117Ssimonbsnap_md_post:
3151.41Scgd# nothing here -- look in the machine-dependent Makefile.inc
3161.41Scgd
3171.34Scgd.endif	# DESTDIR check
3181.7Scgd
3191.1Scgd.include <bsd.prog.mk>
320