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