Makefile revision 1.13
1#	$NetBSD: Makefile,v 1.13 2000/06/10 03:01:14 tsutsui 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
16KERNEL3  = ${KERNOBJDIR}/RAMDISK/netbsd
17KERNEL3X = ${KERNOBJDIR}/RAMDISK3X/netbsd
18
19MOUNT_POINT?=	/mnt
20VND?=		vnd1
21VND_DEV?=	/dev/${VND}a
22VND_RDEV?=	/dev/r${VND}a
23
24# These are all the parameters for the root fs:
25DISKTYPE=	rdroot
26SIZE=		400k
27# bigendian, minfree, opt, b/i , cpg
28NEWFSARGS= -B be -m 0 -o space -i 4096 -c 20
29
30KERNELS= netbsd-RAMDISK netbsd-RAMDISK3X
31CLEANFILES= $(KERNELS) ${IMAGE}.fs netbsd-tmp
32
33all: $(KERNELS)
34
35netbsd-RAMDISK : ${IMAGE}.fs
36	cp ${KERNEL3} netbsd-tmp
37	mdsetimage -v netbsd-tmp ${IMAGE}.fs
38	-mv -f netbsd-tmp $@
39
40netbsd-RAMDISK3X : ${IMAGE}.fs
41	cp ${KERNEL3X} netbsd-tmp
42	mdsetimage -v netbsd-tmp ${IMAGE}.fs
43	-mv -f netbsd-tmp $@
44
45${IMAGE}.fs: ${TREE} ${LISTS} ${CBIN}
46	dd if=/dev/zero of=${IMAGE}.fs bs=${SIZE} count=1
47	vnconfig -t ${DISKTYPE} -v -c ${VND} ${IMAGE}.fs
48	disklabel -rw ${VND} ${DISKTYPE}
49	newfs ${NEWFSARGS} ${VND_RDEV}
50	mount ${VND_DEV} ${MOUNT_POINT}
51	mtree -def ${TREE} -p ${MOUNT_POINT}/ -u
52	TOPDIR=${TOP} CURDIR=${.CURDIR} DESTDIR=${DESTDIR} \
53	  OBJDIR=${.OBJDIR} TARGDIR=${MOUNT_POINT} \
54	  sh ${TOP}/common/RunList.sh ${LISTS}
55	sync
56	@echo ""
57	@df -i ${MOUNT_POINT}
58	@echo ""
59	umount ${MOUNT_POINT}
60	vnconfig -u ${VND}
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