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