xref: /original-bsd/sys/vax/stand/Makefile (revision 93ab02a6)
1#	@(#)Makefile	7.30 (Berkeley) 05/08/91
2
3DESTDIR=
4STAND=	../../stand
5INCPATH=-I. -I../.. -I${STAND}
6VPATH=	${STAND}:../vax
7
8CC=	cc
9C2=	/usr/libexec/c2
10AS=	as
11
12RELOC=	150000
13
14DEFS=	${INCPATH} -DSTANDALONE -DCOMPAT_42
15MACH=	-DVAX8600 -DVAX8200 -DVAX780 -DVAX750 -DVAX730 -DVAX630 -DVAX650
16
17# Collections of C options:
18#	COPTS	device drivers/assembler, not optimized
19#	SMOPTS	"small" versions for 7.5K bootxx programs
20#	730OPTS	"small" versions for 11/730-only versions
21#	CFLAGS	everything else
22COPTS=	${DEFS} ${MACH}
23SMOPTS=	${DEFS} -DSMALL -DVAX750 -DVAX630 -DVAX650
24730OPTS=-O ${DEFS} -DVAX730
25CFLAGS=	-O ${DEFS} ${MACH}
26
27DRIVERS=autoconf.c hp.c hpmaptype.c ht.c idc.c kdb.c mba.c mt.c qdcons.c \
28	qvcons.c rk.c rl.c tm.c tmscp.c ts.c uba.c uda.c up.c upmaptype.c \
29	ut.c
30DOBJS=	${DRIVERS:.c=.o}
31SRCS=	boot.c bootxx.c cat.c copy.c drtest.c format.c format.c machdep.c \
32	prf.c qfont.c conf.c ../vax/dkbad.c ${DRIVERS}
33DUMMIES=confxx.c
34SMOBJ=	bootxx.o sm_autoconf.o
35LIBS=	libsa/libsa.a libdrive.a ${DESTDIR}/usr/lib/libc.a
36SMLIBS=	libsmsa/libsmsa.a libdrive.a ${DESTDIR}/usr/lib/libc.a
37
38
39# These drivers don't have ecc correction and bad sector forwarding;
40# they are placed in the file system boot area for 750's.  If your
41# root has bad sectors you can try and squeeze the newer drivers in...
42ODRIVERS=sm_hp.o sm_up.o
43
44MDEC=	boothp boothk bootkra bootup bootra bootrl
45ALL=	boot tpboot cat copy tpcopy format tpformat drtest ls \
46	730boot 730copy 730format 730drtest ${MDEC}
47
48all: ${ALL}
49
50libsa/libsa.a::
51	cd libsa; make
52libsmsa/libsmsa.a::
53	cd libsa; make
54
55libdrive.a: conf.o dkbad.o machdep.o prf.o qfont.o ${DOBJS}
56	ar crv $@ $?
57	ranlib $@
58
59${DOBJS}:
60	${CC} -c -S ${COPTS} $*.c
61	${C2} -i $*.s | as -o $*.o
62	rm -f $*.s
63
64# startups
65
66srt0.o: srt0.c ../include/mtpr.h ../include/cpu.h
67	${CC} -E -DRELOC=0x${RELOC} ${COPTS} srt0.c | as -o srt0.o
68
69tpsrt0.o: srt0.c ../include/mtpr.h ../include/cpu.h
70	${CC} -E -DRELOC=0x${RELOC} -DTP ${COPTS} srt0.c | as -o tpsrt0.o
71
72relsrt0.o: srt0.c ../include/mtpr.h ../include/cpu.h
73	${CC} -E -DRELOC=0x${RELOC} -DREL ${COPTS} srt0.c | as -o relsrt0.o
74
75# bootable from tape
76
77tpboot: tpboot.o relsrt0.o ${LIBS}
78	ld -N -T ${RELOC} relsrt0.o tpboot.o ${LIBS}
79	strip a.out; dd if=a.out of=tpboot ibs=32 skip=1; rm -f a.out
80
81tpboot.o: boot.o
82	rm -f $*.c
83	ln -s boot.c $*.c
84	${CC} -c ${CFLAGS} -DJUSTASK $*.c
85	rm -f $*.c
86
87tpcopy: copy.o tpsrt0.o ${LIBS}
88	ld -N tpsrt0.o copy.o ${LIBS}
89	strip a.out; dd if=a.out of=tpcopy ibs=32 skip=1; rm -f a.out
90
91tpformat: tpformat.o tpsrt0.o confhpup.o ${LIBS}
92	ld -N tpsrt0.o tpformat.o confhpup.o ${LIBS}
93	strip a.out; dd if=a.out of=tpformat ibs=32 skip=1; rm -f a.out
94
95tpformat.o: format.o
96	rm -f $*.c
97	ln -s format.c $*.c
98	${CC} -c ${CFLAGS} -DJUSTEXIT $*.c
99	rm -f $*.c
100
101# bootable from floppy or real disks
102
103boot: boot.o relsrt0.o bootconf.o ${LIBS}
104	ld -N -T ${RELOC} -o $@ relsrt0.o boot.o bootconf.o ${LIBS}
105
106bootconf.o: conf.o
107	rm -f $*.c
108	ln -s conf.c $*.c
109	${CC} -c ${CFLAGS} -DBOOT $*.c
110	rm -f $*.c
111
112copy: copy.o srt0.o getfile.o ${LIBS}
113	ld -N -o $@ srt0.o copy.o getfile.o ${LIBS}
114
115cat: cat.o srt0.o getfile.o ${LIBS}
116	ld -N -o $@ srt0.o cat.o getfile.o ${LIBS}
117
118ls: ls.o srt0.o ${LIBS}
119	ld -N -o $@ srt0.o ls.o ${LIBS}
120
121format: format.o srt0.o confhpup.o ${LIBS}
122	ld -N -o $@ srt0.o format.o confhpup.o ${LIBS}
123
124drtest: drtest.o srt0.o confhpup.o ${LIBS}
125	ld -N -o $@ srt0.o drtest.o confhpup.o ${LIBS}
126
127# for 730s minimize size to avoid microcode botch
128# (won't load files larger than 12.5 Kbytes)
129
130730boot.o: boot.o
131	rm -f $*.c
132	ln -s boot.c $*.c
133	${CC} -c ${730OPTS} $*.c
134	rm -f $*.c
135
136730boot: 730boot.o relsrt0.o 730bootconf.o ${LIBS}
137	ld -N -T ${RELOC} -o 730boot relsrt0.o 730boot.o 730bootconf.o ${LIBS}
138
139730bootconf.o: conf.o
140	rm -f $*.c
141	ln -s conf.c $*.c
142	${CC} -c ${730OPTS} -DBOOT $*.c
143	rm -f $*.c
144
145730copy: copy.o srt0.o 730conf.o ${LIBS}
146	ld -N -o $@ srt0.o copy.o 730conf.o ${LIBS}
147
148730drtest: drtest.o srt0.o confup.o ${LIBS}
149	ld -N -o $@ srt0.o drtest.o confup.o ${LIBS}
150
151730format: format.o srt0.o confup.o ${LIBS}
152	ld -N -o $@ srt0.o format.o confup.o ${LIBS}
153
154730conf.o: conf.o
155	rm -f $*.c
156	ln -s conf.c $*.c
157	${CC} -c ${730OPTS} $*.c
158	rm -f $*.c
159
160# bootstrap from ether
161
162### not yet, rosin, not yet ###
163
164# getting booted from disc
165
166boothk: relsrt0.o confrk.o ${SMOBJ} ${LIBS}
167	ld -N -T ${RELOC} relsrt0.o confrk.o ${SMOBJ} ${LIBS}
168	size a.out
169	rm -f $@
170	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
171	ls -l $@
172
173boothp: relsrt0.o confhp.o sm_hp.o ${SMOBJ} ${SMLIBS}
174	ld -N -T ${RELOC} relsrt0.o confhp.o sm_hp.o ${SMOBJ} ${SMLIBS}
175	size a.out
176	rm -f $@
177	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
178	ls -l $@
179
180bootkra: relsrt0.o confkra.o ${SMOBJ} ${SMLIBS}
181	ld -N -T ${RELOC} relsrt0.o confkra.o ${SMOBJ} ${SMLIBS}
182	size a.out
183	rm -f $@
184	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
185	ls -l $@
186
187bootup: relsrt0.o confup.o sm_up.o ${SMOBJ} ${SMLIBS}
188	ld -N -T ${RELOC} relsrt0.o confup.o sm_up.o ${SMOBJ} ${SMLIBS}
189	size a.out
190	rm -f $@
191	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
192	ls -l $@
193
194bootra: relsrt0.o confra.o ${SMOBJ} ${SMLIBS}
195	ld -N -T ${RELOC} relsrt0.o confra.o ${SMOBJ} ${SMLIBS}
196	size a.out
197	rm -f $@
198	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
199	ls -l $@
200
201bootrl: relsrt0.o confrl.o ${SMOBJ} ${SMLIBS}
202	ld -N -T ${RELOC} relsrt0.o confrl.o ${SMOBJ} ${SMLIBS}
203	size a.out
204	rm -f $@
205	strip a.out;dd if=a.out of=$@ ibs=32 skip=1;rm -f a.out
206	ls -l $@
207
208sm_hp.o: hp.o
209	rm -f sm_hp.c
210	ln -s hp.c sm_hp.c
211	${CC} -S ${SMOPTS} sm_hp.c
212	${C2} -i sm_hp.s | as -o sm_hp.o
213	rm -f sm_hp.s sm_hp.c
214
215sm_up.o: up.o
216	rm -f sm_up.c
217	ln -s up.c sm_up.c
218	${CC} -S ${SMOPTS} sm_up.c
219	${C2} -i sm_up.s | as -o sm_up.o
220	rm -f sm_up.s sm_up.c
221
222sm_autoconf.o: autoconf.o
223	rm -f sm_autoconf.c
224	ln -s autoconf.c sm_autoconf.c
225	${CC} -c -O ${SMOPTS} sm_autoconf.c
226	rm -f sm_autoconf.c
227
228confrk.o: confrk.c confxx.o
229confhp.o: confhp.c confxx.o
230confkra.o: confkra.c confxx.o
231confup.o: confup.c confxx.o
232confra.o: confra.c confxx.o
233confrl.o: confrl.c confxx.o
234
235# These are currently not compiled using -DSMALL; doing so would result in
236# some extra space.  See the i386/stand code for examples.
237
238confxx.o:
239	touch confxx.o
240
241confrk.c: confxx.c ${STAND}/dev.c
242	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confrk.c
243	sed -e 's/XX/hk/' -e 's/xx/rk/g'	< confxx.c >> confrk.c
244confhp.c: confxx.c ${STAND}/dev.c
245	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confhp.c
246	sed -e 's/XX/hp/' -e 's/xx/hp/g'	< confxx.c >> confhp.c
247confkra.c: confxx.c ${STAND}/dev.c
248	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confkra.c
249	sed -e 's/XX/kra/' -e 's/xx/kra/g'	< confxx.c >> confkra.c
250confup.c: confxx.c ${STAND}/dev.c
251	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confup.c
252	sed -e 's/XX/up/' -e 's/xx/up/g'	< confxx.c >> confup.c
253confra.c: confxx.c ${STAND}/dev.c
254	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confra.c
255	sed -e 's/XX/ra/' -e 's/xx/ra/g'	< confxx.c >> confra.c
256confrl.c: confxx.c ${STAND}/dev.c
257	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confrl.c
258	sed -e 's/XX/rl/' -e 's/xx/rl/g'	< confxx.c >> confrl.c
259
260clean:
261	rm -f *.o *.exe *.i sm_*.c libsa.a
262	rm -f boot[a-wyz][a-z].c conf[a-wyz][a-z].c confkra.c
263	rm -f ${ALL} a.out core errs sboot bootconf.c
264	cd ${STAND}; make clean
265	cd ${STAND}/small; make clean
266
267cleandir: clean
268	rm -f ${MAN} tags .depend
269
270depend: ${SRCS}
271	mkdep ${INCPATH} -DSTANDALONE ${SRCS} ${DUMMIES}
272
273install:
274	install -c -s -o bin -g bin -m 644 \
275	    format cat copy drtest ls ${DESTDIR}/stand
276	[ -d ../vaxdist/tp ] || mkdir ../vaxdist/tp
277	cp tpcopy ../vaxdist/tp/copy
278	cp tpboot ../vaxdist/tp/boot
279	cp tpformat ../vaxdist/tp/format
280	cp boot a.out; strip a.out; \
281		dd if=a.out of=../floppy/boot bs=32 skip=1; rm a.out
282	cp 730boot a.out; strip a.out; \
283		dd if=a.out of=../cassette/boot.730 bs=32 skip=1; rm a.out
284	cp ../floppy/boot ../cassette/boot.750
285	cp ../floppy/boot ../consolerl/boot
286	cp copy a.out; strip a.out; \
287		dd if=a.out of=../floppy/copy bs=32 skip=1; rm a.out
288	cp 730copy a.out; strip a.out; \
289		dd if=a.out of=../cassette/copy.730 bs=32 skip=1; rm a.out
290	cp ../floppy/copy ../cassette/copy.750
291	cp ../floppy/copy ../consolerl/copy
292	cp format a.out; strip a.out; \
293		dd if=a.out of=../floppy/format bs=32 skip=1; rm a.out
294	cp 730format a.out; strip a.out; \
295		dd if=a.out of=../cassette/format.730 bs=32 skip=1; rm a.out
296	cp ../floppy/format ../cassette/format.750
297	cp ../floppy/format ../consolerl/format
298	cp drtest a.out; strip a.out; \
299		dd if=a.out of=../floppy/drtest bs=32 skip=1; rm a.out
300	cp 730drtest a.out; strip a.out; \
301		dd if=a.out of=../cassette/drtest.730 bs=32 skip=1; rm a.out
302	cp ../floppy/drtest ../cassette/drtest.750
303	cp ../floppy/drtest ../consolerl/drtest
304	install -c -o bin -g bin -m 444 ${MDEC} ${DESTDIR}/usr/mdec
305	rm -f ${DESTDIR}/usr/mdec/bootrd
306	ln ${DESTDIR}/usr/mdec/bootra ${DESTDIR}/usr/mdec/bootrd
307
308lint: ${SRCS}
309	lint ${COPTS} -hxbn boot.c ${SRCS} | \
310	    sed -e '/possible pointer alignment/d' \
311		-e '/struct\/union .* never defined/d'
312
313tags: ${SRCS}
314	ctags ${SRCS} ${DUMMIES}
315