Makefile revision 1.1
1#	$NetBSD: Makefile,v 1.1 2001/05/18 00:16:40 fredette 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 
30CLEANFILES= $(KERNELS) ${IMAGE}.fs netbsd-tmp
31
32all: $(KERNELS)
33
34netbsd.RAMDISK : ${IMAGE}.fs
35	cp ${KERNEL} netbsd-tmp
36	mdsetimage -v netbsd-tmp ${IMAGE}.fs
37	-mv -f netbsd-tmp $@
38
39${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN}
40	dd if=/dev/zero of=${IMAGE}.fs bs=${SIZE} count=1
41	vnconfig -t ${DISKTYPE} -v -c ${VND} ${IMAGE}.fs
42	disklabel -rw ${VND} ${DISKTYPE}
43	newfs ${NEWFSARGS} ${VND_RDEV}
44	mount ${VND_DEV} ${MOUNT_POINT}
45	mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
46	TOPDIR=${TOP} CURDIR=${.CURDIR} DESTDIR=${DESTDIR} \
47	  OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
48	  sh ${TOP}/common/RunList.sh ${LISTS}
49	sync
50	@echo ""
51	@df -i ${MOUNT_POINT}
52	@echo ""
53	umount ${MOUNT_POINT}
54	vnconfig -u ${VND}
55
56unconfig:
57	-umount -f ${MOUNT_POINT}
58	-vnconfig -u ${VND_DEV}
59	-/bin/rm -f ${IMAGE}.fs
60
61# Do not delete this if I change my mind and kill make...
62.PRECIOUS: ${IMAGE}.fs
63
64# Rules for making ${CBIN} ...
65.include "${TOP}/common/Make.crunch"
66
67# This is listed in rd_bin.conf but is built here.
68${CBIN} : libhack.o
69
70# Use stubs to eliminate some large stuff from libc
71HACKSRC=${TOP}/../utils/libhack
72.include "${HACKSRC}/Makefile.inc"
73
74clean cleandir distclean:
75	-rm -f a.out core *.core *.o *.cro *.c
76	-rm -f ${CLEANFILES}
77
78.if !defined(RELEASEDIR)
79release:
80	@echo setenv RELEASEDIR before doing that!
81	@false
82.else	# RELEASEDIR
83release: $(KERNELS)
84.for x in ${KERNELS}
85	gzip -c -9 < ${x} > \
86	 ${RELEASEDIR}/binary/kernel/${x}.gz
87.endfor # KERNELS
88.endif	# RELEASEDIR
89
90# Standard rules needed by the above...
91.include <bsd.obj.mk>
92.include <bsd.subdir.mk>
93