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