pty range improvement
[minix3.git] / etc / Makefile
bloba8a6ecf9824ca6b00194f0484b01000239a06f89
1 # $NetBSD: Makefile,v 1.410 2013/08/19 16:34:29 matt Exp $
2 # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
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.
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, but can be overridden.
16 # KERNCONFDIR is where the configuration files for kernels are found;
17 # default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
18 # MKCRYPTO; if not `no', install crypto-related configuration
19 # MKPOSTFIX; if not `no', install postfix configuration
20 # MKUNPRIVED; if not `no', allow non-root installs.
21 # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
23 # Targets:
24 # distribution: makes a full NetBSD distribution in DESTDIR. If
25 # INSTALL_DONE is set, it will not do a `make install.'
26 # if DISTRIBUTION_DONE is set, it will not do anything.
27 # distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
28 # Called by distribution.
29 # snapshot: calls distribution, above, and then tars up the files
30 # into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}.
31 # Any port-dependent stuff for this target is found in
32 # etc.${MACHINE}/Makefile.inc.
33 # release: a synonym for `snapshot'
36 # For MK* vars
37 .include <bsd.own.mk>
39 .include <bsd.sys.mk> # for HOST_SH, TOOL_AWK, ...
40 .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
41 .include <bsd.endian.mk> # For TARGET_ENDIANNESS
43 .MAKEOVERRIDES+= USETOOLS
45 TZDIR= /usr/share/zoneinfo
46 LOCALTIME?= UTC
47 CKSUM?= ${TOOL_CKSUM}
48 MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
49 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
51 # Flags for creating ISO CDROM image
52 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools
53 # Note: At least mkisofs 2.0 should be used.
55 .if !defined(__MINIX)
56 # LSC: We do not yet support iso creation anyway, then do not try to find it.
57 .if !defined(MKISOFS)
58 MKISOFS!= (which mkisofs || echo true) 2>/dev/null
59 .endif
60 DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
61 # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
62 ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
63 MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \
64 -V ${ISO_VOLID} \
65 -publisher "The NetBSD Project" \
66 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
67 .if ${MKISOFS_FLAGS:N-v}
68 MKISOFS_FLAGS+= -quiet
69 .endif
70 .endif # !defined(__MINIX)
73 # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
74 # are empty, to preserve the old semantics of setting them below with "+=".
76 BIN1=
77 BIN2=
78 BIN3=
80 # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
81 # MD Makefile.inc files can add to this.
82 # NOTE: Parent directories must be listed before subdirectories.
84 INSTALLATION_DIRS= binary binary/sets binary/kernel installation
86 .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
87 .include "etc.${RELEASEMACHINE}/Makefile.inc"
88 .endif
90 # -rw-r--r--
91 BINOWN= root
92 BINGRP= operator
93 UTMPGRP= utmp
94 .if defined(__MINIX)
95 BIN1+= boot.cfg.default \
96 man.conf \
97 protocols rc rc.cd rc.subr \
98 rc.daemons.dist rs.inet rs.single \
99 services shells syslog.conf \
100 termcap utmp gettytab rc.shutdown
101 .else
102 BIN1+= bootptab changelist csh.cshrc csh.login \
103 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \
104 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \
105 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \
106 mrouted.conf named.conf netconfig networks newsyslog.conf \
107 nsswitch.conf ntp.conf passwd.conf pkgpath.conf phones printcap \
108 profile protocols rbootd.conf rc rc.conf rc.local rc.subr \
109 rc.shutdown remote rpc security security.conf services shells \
110 shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf
112 # Use machine-specific disktab if it exists, or the MI one otherwise
113 .if exists(etc.${MACHINE}/disktab)
114 BIN1+= etc.${MACHINE}/disktab
115 .else
116 BIN1+= disktab
117 .endif
119 .if exists(etc.${MACHINE}/ld.so.conf) && empty(MACHINE_ARCH:M*arm*hf*)
120 BIN1+= etc.${MACHINE}/ld.so.conf
121 .endif
123 .if exists(etc.${MACHINE}/ttyaction)
124 BIN1+= etc.${MACHINE}/ttyaction
125 .endif
127 # -rw-rw-r--
128 BIN2+= motd
129 FILESBUILD_motd= YES
131 # -rw-------
132 BIN3+= hosts.equiv
133 .endif # defined(__MINIX)
135 SYSPKG= etc
136 ETC_PKG=-T etc_pkg
137 BASE_PKG=-T base_pkg
138 ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
139 ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
141 .if ${TARGET_ENDIANNESS} == "1234"
142 PWD_MKDB_ENDIAN= -L
143 .elif ${TARGET_ENDIANNESS} == "4321"
144 PWD_MKDB_ENDIAN= -B
145 .else
146 PWD_MKDB_ENDIAN=
147 .endif
150 # distribution --
151 # Build a distribution
153 distribution: .PHONY .MAKE check_DESTDIR distrib-dirs
154 .if !defined(DISTRIBUTION_DONE)
155 .if !defined(INSTALL_DONE)
156 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
157 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
158 .endif # !INSTALL_DONE
159 ${MAKEDIRTARGET} . install-etc-files
160 . if ${MKX11} != "no"
161 . if ${X11FLAVOUR} == "Xorg"
162 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution
163 . else
164 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution
165 . endif
166 . endif
167 . if ${MKEXTSRC} != "no"
168 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution
169 . endif
170 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
171 .endif # !DISTRIBUTION_DONE
174 .if !defined(__MINIX)
175 # motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER
177 .if !empty(DISTRIBVER:M*.99.*)
178 MOTD_SOURCE= motd.current
179 .elif !empty(DISTRIBVER:M*BETA*)
180 MOTD_SOURCE= motd.beta
181 .elif !empty(DISTRIBVER:M*RC*)
182 MOTD_SOURCE= motd.rc
183 .elif !empty(DISTRIBVER:M*STABLE*)
184 MOTD_SOURCE= motd.stable
185 .else
186 MOTD_SOURCE= motd.default
187 .endif
188 CLEANFILES+= motd
189 motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS}
190 ${_MKTARGET_CREATE}
191 ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET}
192 .endif # !defined(__MINIX)
194 CLEANFILES+= MAKEDEV
195 .if !defined(__MINIX)
196 MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
197 ${.CURDIR}/etc.${MACHINE}/MAKEDEV.conf
198 ${_MKTARGET_CREATE}
199 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
200 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
201 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
202 > ${.TARGET}
203 .else
204 MAKEDEV: .PHONY
205 if [ ${MKUNPRIVED} != "yes" ]; then \
206 cd ${DESTDIR}/dev && sh ${NETBSDSRCDIR}/commands/MAKEDEV/MAKEDEV.sh -s; \
207 else \
208 sh ${NETBSDSRCDIR}/commands/MAKEDEV/MAKEDEV.sh -m -s >> ${DESTDIR}/METALOG; \
210 .endif # !defined(__MINIX)
212 .include "${NETBSDSRCDIR}/etc/Makefile.params"
213 CLEANFILES+= etc-release
214 etc-release: .EXEC .MAKE
215 ${_MKTARGET_CREATE}
216 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
217 echo ; \
218 cat ${NETBSDSRCDIR}/sys/conf/copyright; \
219 echo ; \
220 echo "Build settings:"; \
221 printf "%20s %s\n" "Build date" "$$(date -u)"; \
222 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \
223 echo ; \
224 ${PRINT_PARAMS} ; \
225 ) >${.OBJDIR}/${.TARGET}
227 install-etc-release: .PHONY etc-release
228 ${_MKMSG_INSTALL} etc/release
229 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
230 etc-release ${DESTDIR}/etc/release
233 FILESDIR= /etc
234 CONFIGFILES=
235 CONFIGSYMLINKS=
237 .for file in ${BIN1}
238 CONFIGFILES+= ${file}
239 FILESMODE_${file:T}= 644
240 .endfor
242 .for file in ${BIN2}
243 CONFIGFILES+= ${file}
244 FILESMODE_${file:T}= 664
245 .endfor
247 .for file in ${BIN3}
248 CONFIGFILES+= ${file}
249 FILESMODE_${file:T}= 600
250 .endfor
252 .if (${MKPOSTFIX} != "no")
253 CONFIGFILES+= aliases
254 FILESDIR_aliases= /etc/mail
255 FILESMODE_aliases= 644
256 .endif
258 .if !defined(__MINIX)
259 CONFIGFILES+= MAKEDEV.local
260 FILESDIR_MAKEDEV.local= /dev
261 FILESMODE_MAKEDEV.local=${BINMODE}
263 CONFIGFILES+= crontab
264 FILESDIR_crontab= /var/cron/tabs
265 FILESNAME_crontab= root
266 FILESMODE_crontab= 600
268 CONFIGFILES+= minfree
269 FILESDIR_minfree= /var/crash
270 FILESMODE_minfree= 600
272 CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
273 /usr/sbin/rmt /etc/rmt
274 .else
275 CONFIGSYMLINKS+= \
276 /usr/log /var/log \
277 /usr/tmp /var/tmp \
278 /proc/mounts /etc/mtab
280 .endif # !defined(__MINIX)
283 # install-etc-files --
284 # Install etc (config) files; not performed by "make build"
286 install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
287 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
288 ${ETC_INSTALL_FILE} -o root -g operator -m 600 \
289 master.passwd ${DESTDIR}/etc
290 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
291 ${DESTDIR}/etc/master.passwd
292 .if ${MKUNPRIVED} != "no"
294 mode=0600; \
295 for metaent in spwd.db passwd pwd.db; do \
296 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=operator tags=etc_pkg"; \
297 mode=0644; \
298 done; \
299 ) | ${METALOG.add}
300 .endif # MKUNPRIVED != no
301 .if defined(__MINIX)
302 # BJG: Unsafe (i.e. user-editable) files for Minix
303 .for owner group mode sdir tdir files in \
304 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ group \
305 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ hostname.file \
306 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ inet.conf \
307 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ mk.conf \
308 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ resolv.conf \
309 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ motd \
310 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ rc.conf \
311 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ profile
312 ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T}
313 if [ ! -e ${tdir} ]; then \
314 ${INSTALL_DIR} ${tdir}; \
315 fi; \
316 ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir};
317 .endfor
318 # LSC: We need a safe install target for etc files, as this is expected from
319 # our current user base. This safe version only leaves out the master.passwd
320 # file in order not to loose any user account created.
322 # BJG: For Minix, the -safe target *is* performed by "make build"
324 # LSC: To ensure minimal modifications, the logic is a bit contrived, i.e. the
325 # NetBSD build system expect install-etc-files to be unsafe, so what was done
326 # is to separate that step into two steps, with the unsafe version refering
327 # (not by dependency, to ensure correct order of actions) the safe step, and
328 # use the following mapping in the main Makefile:
329 # etcforce -> install-etc-files (default NetBSD target)
330 # etcfiles -> install-etc-files-safe (new -safe- target)
331 ${MAKEDIRTARGET} . install-etc-files-safe
333 install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV
334 # LSC Minix administrator group is operator, not wheel
335 .endif # defined(__MINIX)
336 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys
337 .if !defined(__MINIX)
338 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
339 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc
340 .else
341 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
342 ${.CURDIR}/ttys ${DESTDIR}/etc
343 .endif # !defined(__MINIX)
344 .if exists(etc.${MACHINE}/boot.cfg)
345 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg
346 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
347 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/
348 .endif
349 .if !defined(__MINIX)
350 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV
351 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
352 MAKEDEV ${DESTDIR}/dev
353 .else
354 .for owner group mode file in \
355 games games 664 /var/games/tetris.scores
356 ${_MKMSG_INSTALL} ${DESTDIR}${file}
357 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \
358 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
359 /dev/null ${DESTDIR}${file}; \
360 else true; fi
361 .endfor
362 .endif # !defined(__MINIX)
363 # TAC as software is imported, move the files from the .for block below
364 # TAC to the .for block above.
365 .if !defined(__MINIX)
366 .for owner group mode file in \
367 ${BINOWN} operator 664 /etc/dumpdates \
368 ${BINOWN} operator 600 /etc/skeykeys \
369 root wheel 600 /var/at/at.deny \
370 root wheel 644 /var/db/locate.database \
371 ${BINOWN} ${BINGRP} 600 /var/log/authlog \
372 root wheel 600 /var/log/cron \
373 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \
374 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \
375 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \
376 ${BINOWN} ${BINGRP} 600 /var/log/maillog \
377 ${BINOWN} ${BINGRP} 644 /var/log/messages \
378 ${BINOWN} ${BINGRP} 600 /var/log/secure \
379 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \
380 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \
381 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \
382 daemon staff 664 /var/msgs/bounds \
383 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \
384 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \
385 games games 664 /var/games/atc_score \
386 games games 664 /var/games/battlestar.log \
387 games games 664 /var/games/cfscores \
388 games games 664 /var/games/criblog \
389 games games 660 /var/games/hackdir/perm \
390 games games 660 /var/games/hackdir/record \
391 games games 664 /var/games/larn/llog12.0 \
392 games games 664 /var/games/larn/lscore12.0 \
393 games games 664 /var/games/larn/playerids \
394 games games 664 /var/games/robots_roll \
395 games games 664 /var/games/rogue.scores \
396 games games 664 /var/games/saillog \
397 games games 664 /var/games/snakerawscores \
398 games games 664 /var/games/snake.log \
399 ${_MKMSG_INSTALL} ${DESTDIR}${file}
400 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \
401 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
402 /dev/null ${DESTDIR}${file}; \
403 else true; fi
404 .endfor
405 .for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh
406 ${MAKEDIRTARGET} ${subdir} configinstall
407 .endfor
408 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall
409 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
410 .if (${MKPF} != "no")
411 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall
412 .endif
413 .if (${MKCRYPTO} != "no")
414 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall
415 .endif
416 .if (${MKPOSTFIX} != "no")
417 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall
418 .endif
419 .if (${MKATF} != "no")
420 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall
421 .endif
422 .if (${MKKYUA} != "no")
423 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall
424 .endif
425 .else # LSC Minix Specific
426 .for owner group mode sdir tdir files in \
427 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ daily \
428 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ dhcptags.conf \
429 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ rc \
430 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/usr/lib/ crontab \
431 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ system.conf \
432 ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/ Makefile \
433 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_storage.cfg \
434 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ block \
435 ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ singlechar \
436 ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/usr/ast/ .[aepv]* \
437 ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/root/ .[aepv]* \
438 ast users ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/home/ast/ .[aepv]* \
439 bin ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/ast/ ${DESTDIR}/home/bin/ .[aepv]* \
441 ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T}
442 if [ ! -e ${tdir} ]; then \
443 ${INSTALL_DIR} ${tdir}; \
444 fi; \
445 ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir};
446 .endfor
447 .if ${MACHINE_ARCH} == "earm"
448 ${_MKMSG_INSTALL} ${DESTDIR}/etc/rc.capes
449 ${INSTALL_DIR} ${DESTDIR}/etc/rc.capes
450 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/rc.capes/* ${DESTDIR}/etc/rc.capes
451 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/drivers/usbd/usbd.conf ${DESTDIR}/etc/system.conf.d/usbd
452 .endif # Minix/earm specific
453 .for subdir in . defaults mtree
454 ${MAKEDIRTARGET} ${subdir} configinstall
455 .endfor
456 ${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts
457 ${INSTALL_DIR} ${DESTDIR}/usr/lib/fonts
458 ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/fonts/*.fnt ${DESTDIR}/usr/lib/fonts/
459 .endif # LSC Minix Specific
462 # install-obsolete-lists --
463 # Install var/db/obsolete set lists; this is performed by "make build"
465 OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
466 .if !defined(__MINIX)
467 OBSOLETE.files= base comp etc games man misc text
468 .else
469 OBSOLETE.files= minix
470 .endif # !defined(__MINIX)
471 .if ${MKDEBUG} != "no"
472 OBSOLETE.files+= debug
473 .endif
474 .if ${MKKMOD} != "no"
475 OBSOLETE.files+= modules
476 .endif
477 .if ${MKATF} != "no"
478 OBSOLETE.files+= tests
479 .endif
480 .if ${MKX11} != "no"
481 OBSOLETE.files+= xbase xcomp xetc xfont xserver
482 .endif
484 # XXX make "makeobsolete" set wise; then generate files respectively
485 install-obsolete-lists: .PHONY .MAKE
486 mkdir -p ${OBSOLETE.dir}
487 .if ${MKX11} != "no"
488 (cd ${NETBSDSRCDIR}/distrib/sets && \
489 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
490 .else
491 (cd ${NETBSDSRCDIR}/distrib/sets && \
492 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
493 .endif
494 .for file in ${OBSOLETE.files}
495 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}
496 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \
497 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \
498 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
499 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \
500 else true; fi
501 .endfor
504 # distrib-dirs --
505 # Populate $DESTDIR with directories needed by NetBSD
507 distrib-dirs: .PHONY check_DESTDIR
508 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs
511 # release, snapshot --
512 # Build a full distribution including kernels & install media.
514 release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post
515 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
516 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
517 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@}
518 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
521 .if !defined(__MINIX)
522 # iso-image --
523 # Standalone target to create a CDROM image after the release
524 # was composed. Should be run after "make release" in src and xsrc.
525 # The do-iso-image is to be called from etc.$MACHINE/Makefile.inc
527 # Note: At least mkisofs 2.0 should be used.
529 CDROM_NAME_ADD?=
530 CDROM_IMAGE?=${RELEASEDIR}/iso/NetBSD-${DISTRIBVER}-${MACHINE}.iso
531 CDROM.dir= ${.OBJDIR}/cdrom.dir
532 CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist
534 iso-image:
536 .if ${MKISOFS} != true
537 do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
538 ${MAKESUMS} -t ${RELEASEDIR}/iso/ '*.iso'
539 @echo "iso-image created as: ${CDROM_IMAGE}"
540 .else
541 do-iso-image:
542 @echo iso-image: mkisofs not found
543 .endif
545 iso-image-setup: .PHONY check_RELEASEDIR
546 rm -f ${CDROM.pathlist}
547 .for extra in README SOURCE_DATE source
548 .if exists(${RELEASEDIR}/${extra})
549 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist}
550 .endif
551 .endfor
552 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist}
553 mkdir -p ${CDROM.dir}
554 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
556 # iso-image-mi --
557 # Create the image after the MD operations have completed.
559 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre
560 @if ! ${MKISOFS} --version; then \
561 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
562 false; \
564 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
565 -o ${CDROM_IMAGE} ${CDROM.dir}
567 # iso-image-md-pre --
568 # Setup ${CDROM.dir} to produce a bootable CD image.
569 # Overridden by etc.$MACHINE/Makefile.inc
571 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
572 # (empty -- look in the machine-dependent Makefile.inc)
574 # iso-image-md-post --
575 # Fixup the CD-image to be bootable.
576 # Overridden by etc.$MACHINE/Makefile.inc
578 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
579 # (empty -- look in the machine-dependent Makefile.inc)
582 # live-image --
583 # Standalone target to create live images after the release was composed.
584 # Should be run after "make release" in src and xsrc.
585 # LIVEIMG_RELEASEDIR specifies where to install live images and
586 # it can be set in MD etc.${MACHINE}/Makefile.inc.
588 LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images
590 live-image: .PHONY check_DESTDIR check_RELEASEDIR
591 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \
592 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR}
593 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz'
595 # install-image --
596 # Standalone target to create installation images
597 # after the release was composed.
598 # Should be run after "make release" in src and xsrc.
599 # INSTIMG_RELEASEDIR specifies where to install live images and
600 # it can be set in MD etc.${MACHINE}/Makefile.inc.
602 INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images
604 install-image: .PHONY check_DESTDIR check_RELEASEDIR
605 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \
606 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR}
607 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz'
608 .endif # !defined(__MINIX)
610 # snap_pre --
611 # Create ${RELEASEDIR} and necessary subdirectories.
613 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
614 ${INSTALL} -d -m 755 ${RELEASEDIR}
615 .if ${MKUPDATE} == "no"
616 # Could be a mount point, ignore the errors
617 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
618 .endif
619 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
620 .for dir in ${INSTALLATION_DIRS}
621 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
622 .endfor
624 # snap_post --
625 # Build the install media and notes from distrib
627 snap_post: .PHONY .MAKE build_kernelsets build_releasekernels
628 .if ${MKUPDATE} == "no"
629 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
630 .endif
631 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
632 ${MAKE} release
634 # build kernels --
635 # This target builds the kernels specified by each port.
636 # A port may specify the following kernels:
638 # KERNEL_SETS The list of kernels that will be
639 # packaged into sets, named
640 # kern-${kernel}.tgz. These kernels
641 # are also placed in the binary/kernel
642 # area of the release package as
643 # netbsd-${kernel}.gz.
645 # EXTRA_KERNELS Additional kernels to place in the
646 # binary/kernel area of the release
647 # package as netbsd-${kernel}.gz, but
648 # which are not placed into sets. This
649 # allows a port to provide e.g. a netbootable
650 # installation kernel containing a ramdisk.
652 # BUILD_KERNELS Additional kernels to build which are
653 # not placed into sets nor into the
654 # binary/kernel area of the release
655 # package. These are typically kernels
656 # that are built for inclusion only in
657 # installation disk/CD-ROM/tape images.
659 # A port may also specify KERNEL_SUFFIXES, which is an optional list
660 # of filename suffixes for kernels to include in the kernel sets and
661 # in the binary/kernel area of the release package (e.g. "netbsd" vs.
662 # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
663 # with these suffixes do not exist in the kernel build directory.
666 # A list of all the kernels to build, which can be overridden from
667 # external sources (such as make(1)'s environment or command line)
669 ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
670 .export ALL_KERNELS
672 GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \
673 END{ if (found == 0) print "netbsd"; }'
675 build_kernels: .PHONY
676 # Configure & compile kernels listed in ${ALL_KERNELS}
678 # The 'sync' is so that all writes during the build are pushed back
679 # to the disk. Not having it causes problems on some host systems
680 # (e.g. Linux) when building on NFS.
682 .if !defined(KERNELS_DONE) # {
683 .for configfile in ${ALL_KERNELS} # {
684 build_kernels: kern-${configfile}
685 kern-${configfile}: .PHONY .MAKE
686 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
687 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
688 .if ${MKUPDATE} == "no"
689 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
690 .endif
691 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
692 sync
693 .endfor # ALL_KERNELS # }
694 .endif # KERNELS_DONE # }
696 build_kernelsets: .PHONY
697 # Create kernel sets from ${KERNEL_SETS} into
698 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
700 .for configfile in ${KERNEL_SETS} # {
701 .for configsel in ${ALL_KERNELS}
702 .if ${configfile} == ${configsel}
703 build_kernelsets: kernset-${configfile}
704 kernset-${configfile}: .PHONY build_kernels snap_pre
705 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \
706 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
707 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
708 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
709 pax_cmd="COMPRESS_PROGRAM=${TOOL_GZIP:Q} GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
710 cd $${kerndir} && { \
711 kernels=; newest=; \
712 for kernel in $${kernlist}; do \
713 for s in "" $${kernsuffixes}; do \
714 ks="$${kernel}$${s}"; \
715 [ -f $${ks} ] || continue; \
716 kernels="$${kernels} $${ks}"; \
717 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
718 newest=$${ks}; \
719 done; \
720 done; \
721 [ $${kern_tgz} -nt "$${newest}" ] || { \
722 echo "echo $${kernels} | $${pax_cmd}"; \
723 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
724 echo ". type=dir optional"; \
725 for kernel in $${kernels}; do \
726 echo "./$${kernel} type=file"; \
727 done ) | eval $${pax_cmd}; \
730 .endif
731 .endfor
732 .endfor # KERNEL_SETS # }
734 build_releasekernels: .PHONY
735 # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
736 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
738 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
739 .for configsel in ${ALL_KERNELS}
740 .if ${configfile} == ${configsel}
741 build_releasekernels: releasekern-${configfile}
742 releasekern-${configfile}: .PHONY build_kernels snap_pre
743 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \
744 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
745 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
746 cd $${kerndir} && { \
747 for kernel in $${kernlist}; do \
748 for s in "" $${kernsuffixes}; do \
749 ks="$${kernel}$${s}"; \
750 [ ! -f $${ks} ] && continue; \
751 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \
752 [ $${knl_gz} -nt $${ks} ] && continue; \
753 rm -f $${knl_gz}; \
754 echo "${TOOL_GZIP} -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
755 ${TOOL_GZIP} -c -9 < $${ks} > $${knl_gz}; \
756 done; \
757 done; \
759 .endif
760 .endfor
761 .endfor # KERNEL_SETS EXTRA_KERNELS # }
763 # snap_md_post --
764 # Machine dependent distribution media operations.
765 # Overridden by etc.$MACHINE/Makefile.inc
767 snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
768 # (empty -- look in the machine-dependent Makefile.inc)
771 clean:
772 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
774 .if !defined(__MINIX)
775 SUBDIR= defaults rc.d mtree
776 .else
777 SUBDIR= devmand defaults mtree
778 .endif # !defined(__MINIX)
780 .include <bsd.prog.mk>
781 .include <bsd.subdir.mk>
783 test:
784 @echo ${OBSOLETE.files}