Home | History | Annotate | Line # | Download | only in common
Makefile.makedev revision 1.10
      1  1.10  lukem #	$NetBSD: Makefile.makedev,v 1.10 2004/05/04 02:52:05 lukem Exp $
      2   1.1  lukem #
      3   1.1  lukem # Makefile snippet to add ${MAKEDEVTARGETS} devices to the mtree list
      4   1.7  lukem # (if set), otherwise copy .OJBDIR-of-etc/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.7  lukem #	MAKEDEVTARGETS	targets to create with .OBJDIR-of-etc/MAKEDEV
     15   1.1  lukem #
     16   1.1  lukem # Variables modified by this:
     17   1.7  lukem #	MAKEDEVSCRIPT	path to .OBJDIR-of-etc/MAKEDEV
     18   1.7  lukem #	MTREECONF	may get "devices.spec" added
     19   1.7  lukem #	LISTS		may get "list.makedev" added
     20   1.7  lukem #	IMAGEDEPENDS	may get ${MAKEDEVSCRIPT} added
     21   1.7  lukem #	PARSELISTENV	may get MAKEDEVSCRIPT=... added
     22   1.1  lukem #
     23   1.1  lukem 
     24   1.5  lukem .if !defined(_MAKEFILE_MAKEDEV_)
     25   1.5  lukem _MAKEFILE_MAKEDEV_=1
     26   1.5  lukem 
     27   1.5  lukem 
     28   1.1  lukem MAKEDEVSPEC?=	devices.spec
     29   1.1  lukem 
     30   1.7  lukem _MAKEDEVOBJDIR!=cd ${NETBSDSRCDIR}/etc && ${PRINTOBJDIR}
     31   1.7  lukem MAKEDEVSCRIPT=	${_MAKEDEVOBJDIR}/MAKEDEV
     32   1.7  lukem 
     33   1.1  lukem CLEANFILES+=	${MAKEDEVSPEC} ${MAKEDEVSPEC}.tmp
     34   1.1  lukem 
     35   1.1  lukem 
     36   1.1  lukem .if defined(MAKEDEVTARGETS)
     37   1.1  lukem 
     38   1.1  lukem #
     39   1.1  lukem #	MAKEDEVTARGETS is set; add those devices to the mtree spec that's
     40   1.1  lukem #	used to build the file system
     41   1.1  lukem #
     42   1.1  lukem MTREECONF+=	${MAKEDEVSPEC}
     43   1.1  lukem 
     44   1.8  lukem ${MAKEDEVSPEC}:	${MAKEDEVSCRIPT}
     45  1.10  lukem 	${_MKTARGET_CREATE}
     46   1.1  lukem 	-rm -f ${.TARGET} ${.TARGET}.tmp
     47   1.8  lukem 	MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
     48   1.9  lukem 	    ${HOST_SH} ${MAKEDEVSCRIPT} -s ${MAKEDEVTARGETS} \
     49   1.9  lukem 	    | sed -e 's,^\.,./dev,' > ${.TARGET}.tmp \
     50   1.1  lukem 	&& sort -o ${.TARGET} ${.TARGET}.tmp
     51   1.1  lukem 
     52   1.1  lukem .else	# ! MAKEDEVTARGETS
     53   1.1  lukem 
     54   1.1  lukem #
     55   1.1  lukem #	MAKEDEVTARGETS isn't set; copy in /dev/MAKEDEV and rely upon
     56   1.3  lukem #	init(8) to mount an mfs /dev and recreate the devices by
     57   1.3  lukem #	(effectively) running "cd /dev ; ./MAKEDEV all"
     58   1.1  lukem #
     59   1.1  lukem LISTS+=		${DISTRIBDIR}/common/list.makedev
     60   1.7  lukem IMAGEDEPENDS+=	${MAKEDEVSCRIPT}
     61   1.7  lukem PARSELISTENV+=	MAKEDEVSCRIPT=${MAKEDEVSCRIPT:Q}
     62   1.1  lukem 
     63   1.1  lukem ${MAKEDEVSPEC}:	.PHONY
     64   1.1  lukem 
     65   1.1  lukem .endif	# ! MAKEDEVTARGETS
     66   1.5  lukem 
     67   1.5  lukem 
     68   1.5  lukem .endif	# _MAKEFILE_MAKEDEV_
     69