Home | History | Annotate | Line # | Download | only in common
      1  1.19     matt #	$NetBSD: Makefile.makedev,v 1.19 2014/08/10 05:56:36 matt Exp $
      2   1.1    lukem #
      3   1.1    lukem # Makefile snippet to add ${MAKEDEVTARGETS} devices to the mtree list
      4  1.14  tsutsui # (if set), otherwise copy .OBJDIR-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.13      apb #	IMAGEDEPENDS	may get ${MAKEDEVSCRIPT} added
     21  1.13      apb #	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.19     matt .if exists(${NETBSDSRCDIR}/etc/etc.${MACHINE_CPU}/MAKEDEV.conf)
     45  1.19     matt MAKEDEV_MACHINE=${MACHINE_CPU}
     46  1.19     matt .else
     47  1.19     matt MAKEDEV_MACHINE=${MACHINE}
     48  1.19     matt .endif
     49  1.19     matt 
     50  1.18     matt ${MAKEDEVSPEC}:	${MAKEDEVSCRIPT} Makefile \
     51  1.19     matt 		${NETBSDSRCDIR}/etc/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf
     52  1.18     matt 		
     53  1.10    lukem 	${_MKTARGET_CREATE}
     54  1.16    njoly 	rm -f ${.TARGET} ${.TARGET}.tmp
     55  1.19     matt 	MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
     56   1.9    lukem 	    ${HOST_SH} ${MAKEDEVSCRIPT} -s ${MAKEDEVTARGETS} \
     57  1.16    njoly 	    > ${.TARGET}.tmp
     58  1.16    njoly 	${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' ${.TARGET}.tmp \
     59  1.16    njoly 	    | sort -o ${.TARGET}
     60   1.1    lukem 
     61   1.1    lukem .else	# ! MAKEDEVTARGETS
     62   1.1    lukem 
     63   1.1    lukem #
     64   1.1    lukem #	MAKEDEVTARGETS isn't set; copy in /dev/MAKEDEV and rely upon
     65   1.3    lukem #	init(8) to mount an mfs /dev and recreate the devices by
     66   1.3    lukem #	(effectively) running "cd /dev ; ./MAKEDEV all"
     67   1.1    lukem #
     68   1.1    lukem LISTS+=		${DISTRIBDIR}/common/list.makedev
     69  1.13      apb IMAGEDEPENDS+=	${MAKEDEVSCRIPT}
     70   1.7    lukem PARSELISTENV+=	MAKEDEVSCRIPT=${MAKEDEVSCRIPT:Q}
     71   1.1    lukem 
     72   1.1    lukem ${MAKEDEVSPEC}:	.PHONY
     73   1.1    lukem 
     74   1.1    lukem .endif	# ! MAKEDEVTARGETS
     75   1.5    lukem 
     76   1.5    lukem 
     77   1.5    lukem .endif	# _MAKEFILE_MAKEDEV_
     78