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