Makefile revision 1.98
1#	$NetBSD: Makefile,v 1.98 1999/02/09 19:55:58 cjs 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/KERNELNAME, but can be
16#	overridden.
17#   KERNCONFDIR is where the configuration files for kernels are found;
18#	default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
19#   UPDATE is normally undefined; if defined, don't do a 'make clean'
20#	before kernel compile
21#   NO_SENDMAIL is normally undefined; if defined, it will not do a
22#	`make distribution' in the sendmail config file source directory.
23#   USE_BIND4 is normally unset; if set, it will install a named.boot
24#	instead of a named.conf in etc/namedb.
25#   EXTRA_KERNELS has a machine-dependent list of kernels to build added
26#	to it, but you may also set this to have extra ones built.
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#    distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
32#	Called by distribution.
33#    snapshot: calls distribution, above, and then tars up the files
34#	into a release(7) format in RELEASEDIR. Any port-dependent
35#	stuff for this target is found in etc.${MACHINE}/Makefile.inc.
36
37# XXX: For NO_SENDMAIL and USE_BIND4
38.include <bsd.own.mk>
39
40TZDIR=		/usr/share/zoneinfo
41LOCALTIME?=	US/Pacific
42
43# setting NOOBJ prevents "make obj" from doing anything;
44# an objdir would break the installation stuff below
45NOOBJ=	oobj
46
47# MD Makefile.inc may append MD targets to BIN[123].  Make sure all
48# are empty, to preserve the old semantics of setting them below with "=".
49BIN1=	
50BIN2=
51BIN3=
52
53.if exists(etc.${MACHINE}/Makefile.inc)
54.include "etc.${MACHINE}/Makefile.inc"
55.endif
56
57# Use multiple jobs for kernel builds, if NBUILDJOBS set.
58# (Taken from src/Makefile.)
59.if defined(NBUILDJOBS)
60_J= -j${NBUILDJOBS}
61.endif
62
63# -rw-r--r--
64BINOWN= root
65BINGRP= wheel
66BIN1+=	aliases bootptab changelist csh.cshrc csh.login \
67	csh.logout daily daily.conf dm.conf floppytab ftpchroot \
68	ftpusers ftpwelcome gettytab group hosts hosts.lpd \
69	inetd.conf ld.so.conf lkm.conf mailer.conf man.conf \
70	monthly monthly.conf mrouted.conf netstart networks \
71	newsyslog.conf nsswitch.conf phones printcap profile protocols \
72	rbootd.conf rc rc.conf rc.lkm rc.local rc.subr \
73	rc.shutdown remote rpc security security.conf services \
74	shells syslog.conf weekly weekly.conf etc.${MACHINE}/ttys \
75	etc.${MACHINE}/disktab
76
77# -rw-rw-r--
78BIN2+=	motd
79
80# -rw-------
81BIN3+=	hosts.equiv
82
83NAMEDB=	127 root.cache
84.ifdef USE_BIND4
85NAMEDB+=	named.boot
86.else
87NAMEDB+=	named.conf
88.endif
89PCS=	pcs750.bin
90
91all clean cleandir depend distclean etc includes install lint:
92
93.ifndef DESTDIR
94distribution distrib-dirs snapshot:
95	@echo setenv DESTDIR before doing that!
96	@false
97.else
98distribution: distrib-dirs
99.if !defined(INSTALL_DONE)
100	(cd ..; ${MAKE} includes)
101	(cd ..; ${MAKE} install)
102.endif
103	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
104	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
105	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${BIN3} ${DESTDIR}/etc
106	${INSTALL} -c -o root -g wheel -m 600 crontab \
107	    ${DESTDIR}/var/cron/tabs/root
108	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
109	pwd_mkdb -p -d ${DESTDIR}/ ${DESTDIR}/etc/master.passwd
110	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
111	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
112	${INSTALL} -c -o root -g wheel -m 600 minfree \
113	    ${DESTDIR}/var/crash
114	(cd root; \
115		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
116		    ${DESTDIR}/root/.cshrc; \
117		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
118		    ${DESTDIR}/root/.klogin; \
119		${INSTALL} -c -o root -g wheel -m 644 dot.login \
120		    ${DESTDIR}/root/.login; \
121		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
122		    ${DESTDIR}/root/.profile; \
123		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
124		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
125		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
126	(cd mtree; ${MAKE} install)
127	(cd namedb; \
128		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \
129		    ${DESTDIR}/etc/namedb)
130	/bin/rm -f ${DESTDIR}/etc/localtime
131	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
132	/bin/rm -f ${DESTDIR}/etc/rmt
133	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
134	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
135		${DESTDIR}/etc/dumpdates
136	${INSTALL} -c -o ${BINOWN} -g operator -m 600 /dev/null \
137		${DESTDIR}/etc/skeykeys
138	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
139		${DESTDIR}/var/cron/log
140	${INSTALL} -c -o nobody -g ${BINGRP} -m 664 /dev/null \
141		${DESTDIR}/var/db/locate.database
142	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
143		${DESTDIR}/var/log/authlog
144	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
145		${DESTDIR}/var/log/lastlog
146	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
147		${DESTDIR}/var/log/lpd-errs
148	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
149		${DESTDIR}/var/log/maillog
150	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
151		${DESTDIR}/var/log/messages
152	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
153		${DESTDIR}/var/log/secure
154	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
155		${DESTDIR}/var/log/wtmp
156	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
157		${DESTDIR}/var/log/xferlog
158	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
159		${DESTDIR}/var/msgs/bounds
160	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
161		${DESTDIR}/var/run/utmp
162	${INSTALL} -c -o games -g games -m 664 /dev/null \
163		${DESTDIR}/var/games/atc_scores
164	${INSTALL} -c -o games -g games -m 664 /dev/null \
165		${DESTDIR}/var/games/battlestar.log
166	${INSTALL} -c -o games -g games -m 664 /dev/null \
167		${DESTDIR}/var/games/cfscores
168	${INSTALL} -c -o games -g games -m 664 /dev/null \
169		${DESTDIR}/var/games/criblog
170	${INSTALL} -c -o games -g games -m 664 /dev/null \
171		${DESTDIR}/var/games/robots_roll
172	${INSTALL} -c -o games -g games -m 664 /dev/null \
173		${DESTDIR}/var/games/rogue.scores
174	${INSTALL} -c -o games -g games -m 664 /dev/null \
175		${DESTDIR}/var/games/saillog
176	${INSTALL} -c -o games -g games -m 664 /dev/null \
177		${DESTDIR}/var/games/snakerawscores
178	${INSTALL} -c -o games -g games -m 664 /dev/null \
179		${DESTDIR}/var/games/snake.log
180	${INSTALL} -c -o games -g games -m 664 /dev/null \
181		${DESTDIR}/var/games/tetris.scores
182	${INSTALL} -c -o games -g games -m 664 /dev/null \
183		${DESTDIR}/var/games/larn/llog12.0
184	${INSTALL} -c -o games -g games -m 664 /dev/null \
185		${DESTDIR}/var/games/larn/lscore12.0
186	${INSTALL} -c -o games -g games -m 664 /dev/null \
187		${DESTDIR}/var/games/larn/playerids
188	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
189	    fstab.* ${DESTDIR}/etc)
190	(cd ${DESTDIR}/dev; ./MAKEDEV all)
191	(cd ../usr.bin/mail; ${MAKE} distribution)
192.ifndef NO_SENDMAIL
193	(cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
194.endif
195
196
197distrib-dirs:
198	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
199	-mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
200	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
201
202.if !defined(RELEASEDIR)
203snapshot snap_pre:
204	@echo setenv RELEASEDIR before doing that!
205	@false
206.else
207snapshot: distribution snap_pre snap_md snap_kern 
208	sh ../distrib/sets/maketars -s ../distrib/sets \
209		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
210	(cd ${RELEASEDIR}/binary/sets && \
211		cksum -o 1 *.tgz >BSDSUM && \
212		cksum *.tgz >CKSUM && \
213		cksum -m *.tgz >MD5 && \
214		cksum -o 2 *.tgz >SYSVSUM )
215	(cd ${RELEASEDIR}/binary/kernel && if [ -r *.gz ]; then \
216		cksum -o 1 *.gz >BSDSUM && \
217		cksum *.gz >CKSUM && \
218		cksum -m *.gz >MD5 && \
219		cksum -o 2 *.gz >SYSVSUM \
220		; fi )
221
222snap_pre:
223	/bin/rm -rf ${RELEASEDIR}
224	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
225	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
226	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
227	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
228	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
229	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
230
231# the regular expression does a basename(1) on .CURDIR so that we don't
232# have to keep looking up .. at compile time.
233KERNSRCDIR?=	${.CURDIR:C/[^\/]+$//}sys
234KERNOBJDIR?=	${KERNSRCDIR}/arch/${MACHINE}/compile
235KERNCONFDIR?=	${KERNSRCDIR}/arch/${MACHINE}/conf
236
237# This target builds the GENERIC kernel (which must exist for all
238# ports) and puts it in binary/sets/kern.tgz, and also builds any
239# kernels specified in EXTRA_KERNELS and puts them in
240# binary/kernel/netbsd.${KERN}.gz
241#
242snap_kern:
243	cd ${KERNCONFDIR} && config \
244		-b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
245.ifndef UPDATE
246	cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean 
247.endif
248	cd ${KERNOBJDIR}/GENERIC &&	\
249		${MAKE} depend && ${MAKE} ${_J} &&	\
250		tar cf - netbsd |\
251		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
252.for kernel in ${EXTRA_KERNELS}
253	cd ${KERNCONFDIR} && config \
254		-b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
255.ifndef UPDATE
256	cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean 
257.endif
258	cd ${KERNOBJDIR}/${kernel} &&	\
259		${MAKE} depend && ${MAKE} ${_J} &&	\
260		tar cf - netbsd |\
261		gzip -c -9 > ${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
262.endfor # EXTRA_KERNELS
263	
264.endif # RELEASEDIR check
265
266snap_md:
267# nothing here -- look in the machine-dependent Makefile.inc
268
269.endif	# DESTDIR check
270
271.include <bsd.prog.mk>
272