Makefile revision 1.2
1#	$NetBSD: Makefile,v 1.2 2001/10/13 06:15:20 jmc Exp $
2
3TOP=		${.CURDIR}/..
4
5# This include just sets REV=XX
6.include "${TOP}/Makefile.inc"
7
8IMAGE=	ramdisk
9CBIN=	rd_bin
10
11TREE=	${TOP}/common/${IMAGE}.tree
12
13LISTS=	${TOP}/common/${CBIN}.list \
14	${TOP}/common/${IMAGE}.list
15
16KERNEL  = ${KERNOBJDIR}/RAMDISK/netbsd
17
18MOUNT_POINT?=	/mnt
19VND?=		vnd1
20VND_DEV?=	/dev/${VND}a
21VND_RDEV?=	/dev/r${VND}a
22
23# These are all the parameters for the root fs:
24DISKTYPE=	rdroot
25SIZE=		400k
26# bigendian, minfree, opt, b/i , cpg
27NEWFSARGS= -B be -m 0 -o space -i 4096 -c 20
28
29KERNELS= netbsd.RAMDISK 
30MTREE?=		mtree
31CLEANFILES= $(KERNELS) ${IMAGE}.fs netbsd-tmp
32
33all: $(KERNELS)
34
35netbsd.RAMDISK : ${IMAGE}.fs
36	cp ${KERNEL} netbsd-tmp
37	mdsetimage -v netbsd-tmp ${IMAGE}.fs
38	-mv -f netbsd-tmp $@
39
40${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN}
41	dd if=/dev/zero of=${IMAGE}.fs bs=${SIZE} count=1
42	vnconfig -t ${DISKTYPE} -v -c ${VND} ${IMAGE}.fs
43	disklabel -rw ${VND} ${DISKTYPE}
44	newfs ${NEWFSARGS} ${VND_RDEV}
45	mount ${VND_DEV} ${MOUNT_POINT}
46	${MTREE} -def ${TREE} -p ${MOUNT_POINT}/ -u
47	TOPDIR=${TOP} CURDIR=${.CURDIR} DESTDIR=${DESTDIR} \
48	  OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
49	  sh ${TOP}/common/RunList.sh ${LISTS}
50	sync
51	@echo ""
52	@df -i ${MOUNT_POINT}
53	@echo ""
54	umount ${MOUNT_POINT}
55	vnconfig -u ${VND}
56
57unconfig:
58	-umount -f ${MOUNT_POINT}
59	-vnconfig -u ${VND_DEV}
60	-/bin/rm -f ${IMAGE}.fs
61
62# Do not delete this if I change my mind and kill make...
63.PRECIOUS: ${IMAGE}.fs
64
65# Rules for making ${CBIN} ...
66.include "${TOP}/common/Make.crunch"
67
68# This is listed in rd_bin.conf but is built here.
69${CBIN} : libhack.o
70
71# Use stubs to eliminate some large stuff from libc
72HACKSRC=${TOP}/../utils/libhack
73.include "${HACKSRC}/Makefile.inc"
74
75clean cleandir distclean:
76	-rm -f a.out core *.core *.o *.cro *.c
77	-rm -f ${CLEANFILES}
78
79.if !defined(RELEASEDIR)
80release:
81	@echo setenv RELEASEDIR before doing that!
82	@false
83.else	# RELEASEDIR
84release: $(KERNELS)
85.for x in ${KERNELS}
86	gzip -c -9 < ${x} > \
87	 ${RELEASEDIR}/binary/kernel/${x}.gz
88.endfor # KERNELS
89.endif	# RELEASEDIR
90
91# Standard rules needed by the above...
92.include <bsd.obj.mk>
93.include <bsd.subdir.mk>
94