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