Makefile revision 1.107 1 # $NetBSD: Makefile,v 1.107 1999/03/10 19:10:15 scottr 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
41 TZDIR= /usr/share/zoneinfo
42 LOCALTIME?= US/Pacific
43
44 # setting NOOBJ prevents "make obj" from doing anything;
45 # an objdir would break the installation stuff below
46 MKOBJ= 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 "=".
50 BIN1=
51 BIN2=
52 BIN3=
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--
65 BINOWN= root
66 BINGRP= wheel
67 BIN1+= 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 remote rpc security security.conf services \
75 shells syslog.conf weekly weekly.conf etc.${MACHINE}/ttys \
76 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")
84 BIN1+= ld.so.conf
85 .endif
86
87 # -rw-rw-r--
88 BIN2+= motd
89
90 # -rw-------
91 BIN3+= hosts.equiv
92
93 NAMEDB= 127 root.cache
94 .ifdef USE_BIND4
95 NAMEDB+= named.boot
96 .else
97 NAMEDB+= named.conf
98 .endif
99 PCS= pcs750.bin
100
101 all clean cleandir depend distclean etc includes install lint:
102
103 .ifndef DESTDIR
104 distribution distrib-dirs release snapshot:
105 @echo setenv DESTDIR before doing that!
106 @false
107 .else
108 distribution: 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 ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
153 ${DESTDIR}/var/log/authlog
154 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
155 ${DESTDIR}/var/log/lastlog
156 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
157 ${DESTDIR}/var/log/lpd-errs
158 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
159 ${DESTDIR}/var/log/maillog
160 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
161 ${DESTDIR}/var/log/messages
162 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
163 ${DESTDIR}/var/log/secure
164 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
165 ${DESTDIR}/var/log/wtmp
166 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
167 ${DESTDIR}/var/log/xferlog
168 ${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
169 ${DESTDIR}/var/msgs/bounds
170 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
171 ${DESTDIR}/var/run/utmp
172 ${INSTALL} -c -o games -g games -m 664 /dev/null \
173 ${DESTDIR}/var/games/atc_scores
174 ${INSTALL} -c -o games -g games -m 664 /dev/null \
175 ${DESTDIR}/var/games/battlestar.log
176 ${INSTALL} -c -o games -g games -m 664 /dev/null \
177 ${DESTDIR}/var/games/cfscores
178 ${INSTALL} -c -o games -g games -m 664 /dev/null \
179 ${DESTDIR}/var/games/criblog
180 ${INSTALL} -c -o games -g games -m 664 /dev/null \
181 ${DESTDIR}/var/games/robots_roll
182 ${INSTALL} -c -o games -g games -m 664 /dev/null \
183 ${DESTDIR}/var/games/rogue.scores
184 ${INSTALL} -c -o games -g games -m 664 /dev/null \
185 ${DESTDIR}/var/games/saillog
186 ${INSTALL} -c -o games -g games -m 664 /dev/null \
187 ${DESTDIR}/var/games/snakerawscores
188 ${INSTALL} -c -o games -g games -m 664 /dev/null \
189 ${DESTDIR}/var/games/snake.log
190 ${INSTALL} -c -o games -g games -m 664 /dev/null \
191 ${DESTDIR}/var/games/tetris.scores
192 ${INSTALL} -c -o games -g games -m 664 /dev/null \
193 ${DESTDIR}/var/games/larn/llog12.0
194 ${INSTALL} -c -o games -g games -m 664 /dev/null \
195 ${DESTDIR}/var/games/larn/lscore12.0
196 ${INSTALL} -c -o games -g games -m 664 /dev/null \
197 ${DESTDIR}/var/games/larn/playerids
198 (cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
199 fstab.* ${DESTDIR}/etc)
200 (cd ${DESTDIR}/dev; ./MAKEDEV all)
201 (cd ../usr.bin/mail; ${MAKE} distribution)
202 .ifndef NO_SENDMAIL
203 (cd ../usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
204 .endif
205
206
207 distrib-dirs:
208 ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
209 -mtree -def mtree/NetBSD.dist -p ${DESTDIR}/ -u
210 cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
211
212 .if !defined(RELEASEDIR)
213 release snapshot snap_pre:
214 @echo setenv RELEASEDIR before doing that!
215 @false
216 .else
217 release snapshot: distribution snap_pre snap_md snap_kern
218 sh ../distrib/sets/maketars -s ../distrib/sets \
219 -d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
220 .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
221 sh ../distrib/sets/maketars -s ../distrib/sets \
222 -d ${DESTDIR} -t ${RELEASEDIR}/binary/security secr
223 (cd ${RELEASEDIR}/binary/security && \
224 cksum -o 1 *.tgz >BSDSUM && \
225 cksum *.tgz >CKSUM && \
226 cksum -m *.tgz >MD5 && \
227 cksum -o 2 *.tgz >SYSVSUM )
228 .endif
229 (cd ${RELEASEDIR}/binary/sets && \
230 cksum -o 1 *.tgz >BSDSUM && \
231 cksum *.tgz >CKSUM && \
232 cksum -m *.tgz >MD5 && \
233 cksum -o 2 *.tgz >SYSVSUM )
234 .ifdef EXTRA_KERNELS
235 (cd ${RELEASEDIR}/binary/kernel && \
236 cksum -o 1 *.gz >BSDSUM && \
237 cksum *.gz >CKSUM && \
238 cksum -m *.gz >MD5 && \
239 cksum -o 2 *.gz >SYSVSUM )
240 .endif
241
242 snap_pre:
243 /bin/rm -rf ${RELEASEDIR}
244 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
245 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
246 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
247 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
248 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
249 ${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
250
251 # the regular expression does a basename(1) on .CURDIR so that we don't
252 # have to keep looking up .. at compile time.
253 KERNSRCDIR?= ${.CURDIR:C/[^\/]+$//}sys
254 KERNOBJDIR?= ${KERNSRCDIR}/arch/${MACHINE}/compile
255 KERNCONFDIR?= ${KERNSRCDIR}/arch/${MACHINE}/conf
256
257 # This target builds the GENERIC kernel (which must exist for all
258 # ports) and puts it in binary/sets/kern.tgz, and also builds any
259 # kernels specified in EXTRA_KERNELS and puts them in
260 # binary/kernel/netbsd.${KERN}.gz
261 #
262 snap_kern:
263 cd ${KERNCONFDIR} && config \
264 -b ${KERNOBJDIR}/GENERIC -s ${KERNSRCDIR} GENERIC
265 .ifndef UPDATE
266 cd ${KERNOBJDIR}/GENERIC && ${MAKE} clean
267 .endif
268 cd ${KERNOBJDIR}/GENERIC && \
269 ${MAKE} depend && ${MAKE} ${_J} && \
270 tar cf - netbsd |\
271 gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
272 .for kernel in ${EXTRA_KERNELS}
273 cd ${KERNCONFDIR} && config \
274 -b ${KERNOBJDIR}/${kernel} -s ${KERNSRCDIR} ${kernel}
275 .ifndef UPDATE
276 cd ${KERNOBJDIR}/${kernel} && ${MAKE} clean
277 .endif
278 cd ${KERNOBJDIR}/${kernel} && \
279 ${MAKE} depend && ${MAKE} ${_J} && \
280 gzip -c -9 < netbsd > \
281 ${RELEASEDIR}/binary/kernel/netbsd.${kernel}.gz
282 .endfor # EXTRA_KERNELS
283
284 .endif # RELEASEDIR check
285
286 snap_md:
287 # nothing here -- look in the machine-dependent Makefile.inc
288
289 .endif # DESTDIR check
290
291 .include <bsd.prog.mk>
292