xref: /netbsd-src/distrib/alpha/rz25dist/Makefile (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1# $NetBSD: Makefile,v 1.25 2000/08/30 23:51:49 jhawk Exp $
2
3.include "../../../Makefile.inc"
4
5# Make a distribution for the alpha, on a spare disk.
6# This creates a large, gzipped disk image in ${.OBJDIR}
7
8TARGETS=	bin.tar.gz etc.tar.gz x11.tar.gz diskimage.gz
9
10.if !defined(DESTDIR) || !defined(DESTDISK)
11all:
12	@echo both 'DESTDIR' and 'DESTDISK' must be defined.
13	@false
14.else
15
16KERNEL?= ${KERNOBJDIR}/GENERIC/netbsd
17
18SECPERCYL=	343
19CYLS=		1189
20
21all: ${TARGETS}
22
23mount-fs:
24	disklabel -W ${DESTDISK}
25	-dd if=/dev/zero of=/dev/r${DESTDISK}c bs=`expr ${SECPERCYL} \* 512` \
26	    count=${CYLS}
27	disklabel -w -r ${DESTDISK} ImageDisk
28	disklabel -W ${DESTDISK}
29	newfs -B le -O /dev/r${DESTDISK}a
30	newfs -B le -O /dev/r${DESTDISK}d
31	mount /dev/${DESTDISK}a ${DESTDIR}
32	mkdir ${DESTDIR}/usr
33	mount /dev/${DESTDISK}d ${DESTDIR}/usr
34
35build-fs:
36	cd ${.CURDIR}/../../../etc && ${MAKE} distribution
37	if [ -d ${.CURDIR}/../../../toolchain ]; then \
38		cd ${.CURDIR}/../../../toolchain && \
39		    ${MAKE} prefix=${DESTDIR}/usr/local install; \
40	else \
41		true; \
42	fi
43	if [ -d ${.CURDIR}/../../../xc ]; then \
44		cd ${.CURDIR}/../../../xc && ${MAKE} install install.man; \
45	else \
46		true; \
47	fi
48	cp ${KERNEL} ${DESTDIR}
49	ln -s gcc ${DESTDIR}/usr/local/bin/cc
50	(cd ${DESTDIR}/usr/libexec && ln -s \
51	    ../local/lib/gcc-lib/alpha-unknown-netbsd*/*/cpp .)
52	ln -s ../local/bin/ar ${DESTDIR}/usr/bin
53	ln -s ../local/bin/as ${DESTDIR}/usr/bin
54	ln -s ../local/bin/cc ${DESTDIR}/usr/bin
55	ln -s ../local/bin/gcc ${DESTDIR}/usr/bin
56	ln -s ../local/bin/ld ${DESTDIR}/usr/bin
57	ln -s ../local/bin/nm ${DESTDIR}/usr/bin
58	ln -s ../local/bin/ranlib ${DESTDIR}/usr/bin
59	ln -s ../local/bin/size ${DESTDIR}/usr/bin
60	ln -s ../local/bin/strip ${DESTDIR}/usr/bin
61	cp -p ${DESTDIR}/usr/mdec/boot ${DESTDIR}/
62	sync; sleep 1; sync; sleep 1
63	${DESTDIR}/usr/mdec/installboot -v /dev/r${DESTDISK}c \
64	    ${DESTDIR}/usr/mdec/bootxx_ffs
65
66unmount-fs:
67	umount ${DESTDIR}/usr ${DESTDIR}
68	fsck -f -t ffs /dev/r${DESTDISK}a /dev/r${DESTDISK}d
69
70diskimage.gz: mount-fs build-fs unmount-fs
71	mount /dev/${DESTDISK}a ${DESTDIR}
72	mount /dev/${DESTDISK}d ${DESTDIR}/usr
73#	mkdir ${DESTDIR}/alphadist
74#	cp -p ${DESTDIR}/usr/sbin/sysctl ${DESTDIR}/alphadist
75#	mv ${DESTDIR}/etc/rc ${DESTDIR}/alphadist/rc.real
76#	cp ${.CURDIR}/rc.hack ${DESTDIR}/alphadist/rc.hack
77#	cp -p ${DESTDIR}/alphadist/rc.hack ${DESTDIR}/etc/rc
78	umount ${DESTDIR}/usr ${DESTDIR}
79	/bin/rm -f $@
80	dd if=/dev/r${DESTDISK}c bs=`expr ${SECPERCYL} \* 512` \
81	    count=${CYLS} | gzip -9 > $@
82
83bin.tar.gz: mount-fs build-fs
84	/bin/rm -f $@
85	(cd ${DESTDIR} ; find . | grep -v '^./etc' | \
86	    grep -v '^./usr/X11R6' | grep -v '^./netbsd' | \
87	    grep -v '^./boot' | pax -w -d | gzip -9) > $@
88
89etc.tar.gz: mount-fs build-fs
90	/bin/rm -f $@
91	(cd ${DESTDIR} ; find ./etc | pax -w -d | gzip -9) > $@
92
93x11.tar.gz: mount-fs build-fs
94	/bin/rm -f $@
95	(cd ${DESTDIR} ; find ./usr/X11R6 | pax -w -d | gzip -9) > $@
96
97.endif
98
99# clean dependencies in case somebody decides to shortcut the build.
100clean cleandir distclean:
101	/bin/rm -f ${TARGETS}
102	/bin/rm -f mount-fs build-fs unmount-fs
103
104.include <bsd.kernobj.mk>
105.include <bsd.own.mk>
106.include <bsd.obj.mk>
107