Makefile.makedev revision 1.5 1 # $NetBSD: Makefile.makedev,v 1.5 2003/03/11 07:18:38 lukem Exp $
2 #
3 # Makefile snippet to add ${MAKEDEVTARGETS} devices to the mtree list
4 # (if set), otherwise copy etc.${MACHINE}/MAKEDEV to ./dev
5 #
6 # If this is to be used with Makefile.image, then this file should be
7 # .include-d first.
8 #
9 # Required variables:
10 # NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>)
11 # MACHINE machine name (set externally by build framework)
12 #
13 # Optional variables:
14 # MAKEDEVTARGETS targets to create with etc/etc.${MACHINE}/MAKEDEV
15 #
16 # Variables modified by this:
17 # MTREECONF may get "devices.spec" added to it
18 #
19
20 .if !defined(_MAKEFILE_MAKEDEV_)
21 _MAKEFILE_MAKEDEV_=1
22
23
24 MAKEDEVSPEC?= devices.spec
25
26 CLEANFILES+= ${MAKEDEVSPEC} ${MAKEDEVSPEC}.tmp
27
28
29 .if defined(MAKEDEVTARGETS)
30
31 #
32 # MAKEDEVTARGETS is set; add those devices to the mtree spec that's
33 # used to build the file system
34 #
35 _MAKEDEVSCRIPT= ${NETBSDSRCDIR}/etc/etc.${MACHINE}/MAKEDEV
36 _MAKEDEVWRAP= ${DISTRIBDIR}/common/MAKEDEV.wrapper
37 _MAKEDEV2SPEC= ${DISTRIBDIR}/common/makedev2spec.awk
38
39 MTREECONF+= ${MAKEDEVSPEC}
40
41 ${MAKEDEVSPEC}: ${_MAKEDEVSCRIPT} ${_MAKEDEVWRAP} ${_MAKEDEV2SPEC}
42 -rm -f ${.TARGET} ${.TARGET}.tmp
43 MAKEDEVSCRIPT=${_MAKEDEVSCRIPT:Q} \
44 sh ${_MAKEDEVWRAP} ${MAKEDEVTARGETS} | \
45 awk -f ${_MAKEDEV2SPEC} > ${.TARGET}.tmp \
46 && sort -o ${.TARGET} ${.TARGET}.tmp
47
48 .else # ! MAKEDEVTARGETS
49
50 #
51 # MAKEDEVTARGETS isn't set; copy in /dev/MAKEDEV and rely upon
52 # init(8) to mount an mfs /dev and recreate the devices by
53 # (effectively) running "cd /dev ; ./MAKEDEV all"
54 #
55 LISTS+= ${DISTRIBDIR}/common/list.makedev
56 IMAGEDEPENDS+= ${NETBSDSRCDIR}/etc/etc.${MACHINE}/MAKEDEV
57
58 ${MAKEDEVSPEC}: .PHONY
59
60 .endif # ! MAKEDEVTARGETS
61
62
63 .endif # _MAKEFILE_MAKEDEV_
64