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