1 # $NetBSD: Makefile.makedev,v 1.19 2014/08/10 05:56:36 matt Exp $
3 # Makefile snippet to add ${MAKEDEVTARGETS} devices to the mtree list
4 # (if set), otherwise copy .OBJDIR-of-etc/MAKEDEV to ./dev
6 # If this is to be used with Makefile.image, then this file should be
10 # NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>)
11 # MACHINE machine name (set externally by build framework)
14 # MAKEDEVTARGETS targets to create with .OBJDIR-of-etc/MAKEDEV
16 # Variables modified by this:
17 # MAKEDEVSCRIPT path to .OBJDIR-of-etc/MAKEDEV
18 # MTREECONF may get "devices.spec" added
19 # LISTS may get "list.makedev" added
20 # IMAGEDEPENDS may get ${MAKEDEVSCRIPT} added
21 # PARSELISTENV may get MAKEDEVSCRIPT=... added
24 .if !defined(_MAKEFILE_MAKEDEV_)
28 MAKEDEVSPEC?= devices.spec
30 _MAKEDEVOBJDIR!=cd ${NETBSDSRCDIR}/etc && ${PRINTOBJDIR}
31 MAKEDEVSCRIPT= ${_MAKEDEVOBJDIR}/MAKEDEV
33 CLEANFILES+= ${MAKEDEVSPEC} ${MAKEDEVSPEC}.tmp
36 .if defined(MAKEDEVTARGETS)
39 # MAKEDEVTARGETS is set; add those devices to the mtree spec that's
40 # used to build the file system
42 MTREECONF+= ${MAKEDEVSPEC}
44 .if exists(${NETBSDSRCDIR}/etc/etc.${MACHINE_CPU}/MAKEDEV.conf)
45 MAKEDEV_MACHINE=${MACHINE_CPU}
47 MAKEDEV_MACHINE=${MACHINE}
50 ${MAKEDEVSPEC}: ${MAKEDEVSCRIPT} Makefile \
51 ${NETBSDSRCDIR}/etc/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf
54 rm -f ${.TARGET} ${.TARGET}.tmp
55 MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
56 ${HOST_SH} ${MAKEDEVSCRIPT} -s ${MAKEDEVTARGETS} \
58 ${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' ${.TARGET}.tmp \
61 .else # ! MAKEDEVTARGETS
64 # MAKEDEVTARGETS isn't set; copy in /dev/MAKEDEV and rely upon
65 # init(8) to mount an mfs /dev and recreate the devices by
66 # (effectively) running "cd /dev ; ./MAKEDEV all"
68 LISTS+= ${DISTRIBDIR}/common/list.makedev
69 IMAGEDEPENDS+= ${MAKEDEVSCRIPT}
70 PARSELISTENV+= MAKEDEVSCRIPT=${MAKEDEVSCRIPT:Q}
72 ${MAKEDEVSPEC}: .PHONY
74 .endif # ! MAKEDEVTARGETS
77 .endif # _MAKEFILE_MAKEDEV_