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