xref: /original-bsd/sys/i386/stand/Makefile (revision 8e206d2f)
1#-
2# Copyright (c) 1990 The Regents of the University of California.
3# All rights reserved.
4#
5# This code is derived from software contributed to Berkeley by
6# William Jolitz.
7#
8#
9# Copying or redistribution in any form is explicitly forbidden
10# unless prior written permission is obtained from William Jolitz or an
11# authorized representative of the University of California, Berkeley.
12#
13# Freely redistributable copies of this code will be available in
14# the near future; for more information contact William Jolitz or
15# the Computer Systems Research Group at the University of California,
16# Berkeley.
17#
18# The name of the University may not be used to endorse or promote
19# products derived from this software without specific prior written
20# permission.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY
21# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23# PURPOSE.
24#	@(#)Makefile	7.1 (Berkeley) 04/24/90
25#
26DESTDIR=/
27INCPATH=-I. -I../h -I../AT386
28CC=gcc
29CFLAGS=	${COPTS}
30COPTS=	-O ${INCPATH} -DSTANDALONE -DAT386
31RELOC=	70000
32
33SRCS=	boot.c bootxx.c copy.c \
34	sys.c conf.c prf.c  kbdcga.c \
35	wd.c gets.c srt0.c \
36	wdboot.c
37DUMMIES= confxx.c
38DRIVERS= kbd.o cga.o wd.o disktab.o
39LIBSA=	libsa.a
40
41BOOTBLOCKS= bootwd
42DISKUTILS= boot copy cat ls
43ALL=	${BOOTBLOCKS} ${DISKUTILS}
44
45STANDDIR= ${DESTDIR}/stand
46all: ${ALL}
47
48${LIBSA}: sys.o conf.o ${DRIVERS} prf.o gets.o
49	ar crv ${LIBSA} $?
50	ranlib ${LIBSA}
51
52${DRIVERS}: # saio.h
53	${CC} -c ${COPTS} $*.c
54
55test: test.o prf.o kbd.o cga.o srt0.o gets.o
56	ld -N -o test srt0.o test.o kbd.o cga.o prf.o gets.o
57
58t: test.o prf.o kbd.o cga.o relsrt0.o gets.o
59	ld -N -T ${RELOC} -o t relsrt0.o test.o kbd.o cga.o prf.o gets.o
60
61mem: mem.o prf.o kbd.o cga.o srt0.o gets.o
62	ld -N -o mem srt0.o mem.o kbd.o cga.o prf.o gets.o
63
64# startups
65
66srt0.o: srt0.c
67	${CC} -E -DLOCORE -DRELOC=0x${RELOC} ${COPTS} srt0.c | a386 -o srt0.o
68
69relsrt0.o: srt0.c
70	${CC} -E -DLOCORE -DRELOC=0x${RELOC} -DREL ${COPTS} srt0.c | \
71	a386 -o relsrt0.o
72
73wdboot.o: wdboot.c ../h/disk.h ../32k/psr.h ../S375/devvm.h
74	${CC} -E -DLOCORE -DRELOC=0x${RELOC} ${COPTS} wdboot.c | as -o wdboot.o
75
76dtab.o: dtab.c ../h/disk.h
77	${CC} -E -DLOCORE -DRELOC=0x${RELOC} -DDISKLAB ${COPTS} dtab.c | \
78	as -o dtab.o
79
80
81# bootable from tape
82
83tpboot:	tpboot.o relsrt0.o ${LIBSA}
84	ld -N -o tpboot -T ${RELOC} relsrt0.o tpboot.o ${LIBSA} -lc3
85	strip tpboot
86
87tpboot.o: boot.c ../h/param.h ../h/inode.h ../h/fs.h
88tpboot.o: saio.h ../h/reboot.h ../h/vm.h
89	cp boot.c tpboot.c; chmod +w tpboot.c
90	${CC} -c ${CFLAGS} -DJUSTASK tpboot.c
91	rm -f tpboot.c
92
93tpcopy:	copy.o tpsrt0.o ${LIBSA}
94	ld -N -o tpcopy tpsrt0.o copy.o ${LIBSA} -lc3
95	strip tpcopy
96
97tpformat: format.o wdformat.o tpsrt0.o ${LIBSA}
98	cp format.c tpformat.c; chmod +w tpformat.c
99	${CC} -c ${CFLAGS} -DJUSTEXIT -DTP tpformat.c
100	rm -f tpformat.c
101	ld -N -o tpformat tpsrt0.o tpformat.o wdformat.o ${LIBSA} -lc3
102	strip tpformat
103
104tpdisklabel:	disklabel.o tpsrt0.o ${LIBSA}
105	cp disklabel.c tpdisklabel.c; chmod +w tpdisklabel.c
106	${CC} -c ${CFLAGS} -DJUSTEXIT -DTP tpdisklabel.c
107	rm -f tpdisklabel.c
108	ld -N -o tpdisklabel tpsrt0.o tpdisklabel.o ${LIBSA} -lc3
109
110# bootable from floppy or real disks
111
112boot:	boot.o relsrt0.o bootconf.o ${LIBSA}
113	ld -N -T ${RELOC} -o boot relsrt0.o boot.o bootconf.o ${LIBSA} -lc3
114
115dlbl:	dlbl.o srt0.o bootconf.o ${LIBSA}
116	ld -N -o dlbl srt0.o dlbl.o bootconf.o ${LIBSA} -lc3
117
118bootconf.o: conf.o
119	cp conf.c bootconf.c
120	${CC} -c ${CFLAGS} -DBOOT bootconf.c
121	rm -f bootconf.c
122
123cat:	cat.o srt0.o conf.o ${LIBSA}
124	ld -N -o cat srt0.o cat.o conf.o ${LIBSA} -lc3
125
126ls:	ls.o srt0.o conf.o ${LIBSA}
127	ld -N -o ls srt0.o ls.o conf.o ${LIBSA} -lc3
128
129copy:	copy.o srt0.o conf.o ${LIBSA}
130	ld -N -o copy srt0.o copy.o conf.o ${LIBSA} -lc3
131
132format:	format.o wdformat.o srt0.o conf.o ${LIBSA}
133	ld -N -o format srt0.o format.o wdformat.o conf.o ${LIBSA} -lc3
134
135disklabel:	disklabel.o srt0.o conf.o ${LIBSA}
136	ld -N -o disklabel srt0.o disklabel.o conf.o ${LIBSA} -lc3
137
138icheck:	icheck.o srt0.o conf.o ${LIBSA}
139	ld -N -o icheck srt0.o icheck.o conf.o ${LIBSA} -lc3
140
141# bootstrap from ether
142
143### not yet, rosin, not yet ###
144
145# getting booted from disc
146
147bootwd: wdboot.o bootxx.o confwd.o sm_wd.o sm_sys.o ${LIBSA}
148	ld -N -T ${RELOC} wdboot.o bootxx.o confwd.o sm_sys.o sm_wd.o \
149		${LIBSA} -lc3
150	size a.out
151	strip a.out;dd if=a.out of=bootwd ibs=32 skip=1;rm -f a.out
152	ls -l bootwd
153
154bootcst: tprelsrt0.o bootxx.o confcst.o sm_cst.o sm_sba.o sm_sys.o ${LIBSA}
155	ld -N -T ${RELOC} tprelsrt0.o bootxx.o confcst.o sm_sys.o \
156		sm_cst.o sm_sba.o ${LIBSA} -lc3
157	size a.out
158	strip a.out;dd if=a.out of=bootcst ibs=32 skip=1;rm -f a.out
159	ls -l bootcst
160
161bootswd: relsrt0.o dtab.o bootxx.o confswd.o sm_swd.o sm_sba.o sm_sys.o ${LIBSA}
162	ld -N -T ${RELOC} relsrt0.o sm_swd.o dtab.o bootxx.o confswd.o sm_sba.o \
163		sm_sys.o ${LIBSA} -lc3
164	size a.out
165	strip a.out;dd if=a.out of=bootswd ibs=32 skip=1;rm -f a.out
166	ls -l bootswd
167
168sm_wd.o: wd.o
169	-rm -f sm_wd.c
170	-ln -s wd.c sm_wd.c
171	${CC} -S -DSMALL ${CFLAGS} sm_wd.c
172	/lib/c2 -i sm_wd.s | as -o sm_wd.o
173	rm -f sm_wd.s sm_wd.c
174
175sm_cst.o: cst.o
176	-rm -f sm_cst.c
177	-ln -s cst.c sm_cst.c
178	${CC} -S -DSMALL ${CFLAGS} sm_cst.c
179	/lib/c2 -i sm_cst.s | as -o sm_cst.o
180	rm -f sm_cst.s sm_cst.c
181
182sm_swd.o: swd.o
183	-rm -f sm_swd.c
184	-ln -s swd.c sm_swd.c
185	${CC} -S -DSMALL ${CFLAGS} sm_swd.c
186	/lib/c2 -i sm_swd.s | as -o sm_swd.o
187	rm -f sm_swd.s sm_swd.c
188
189sm_sba.o: sba.o
190	-rm -f sm_sba.c
191	-ln -s sba.c sm_sba.c
192	${CC} -S -DSMALL ${CFLAGS} sm_sba.c
193	/lib/c2 -i sm_sba.s | as -o sm_sba.o
194	rm -f sm_sba.s sm_sba.c
195
196sm_sys.o: sys.o
197	-rm -f sm_sys.c
198	-ln -s sys.c sm_sys.c
199	${CC} -c -DSMALL ${CFLAGS} sm_sys.c
200	-rm -f sm_sys.c
201
202confwd.o: confwd.c confxx.o
203confswd.o: confswd.c confxx.o
204confcst.o: confcst.c confxx.o
205
206confxx.o:
207	touch confxx.o
208
209confwd.c: confxx.c
210	-rm -f confwd.c
211	sed -e 's/XX/wd/' -e 's/xx/wd/g' <confxx.c >confwd.c
212
213confswd.c: confxx.c
214	-rm -f confswd.c
215	sed -e 's/XX/swd/' -e 's/xx/swd/g' <confxx.c >confswd.c
216
217confcst.c: confxx.c
218	-rm -f confcst.c
219	echo "#define	TP" >confcst.c
220	sed -e 's/XX/cst/' -e 's/xx/cst/g' <confxx.c >>confcst.c
221
222# utilities
223
224print:
225	@pr makefile
226	@ls -l | pr
227	@pr *.h *.c
228
229clean:
230	rm -f *.o *.exe *.i errs sm_*.c
231	rm -f a.out boot cat tpboot tpcopy copy tpformat disklabel \
232		tpdisklabel ls
233	rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
234		conf[a-wyz]?.c conf[a-wyz]??.c
235	rm -f format core sboot bootconf.c
236
237lint:
238	lint ${COPTS} -hxbn boot.c ${SRCS} | \
239	    grep -v 'possible pointer alignment' | \
240	    grep -v 'struct/union .* never defined'
241
242install: ${ALL}
243	install -c -s boot ${DESTDIR}
244	cp ${DISKUTILS} ../dist/floppy
245	cp ${TAPEUTILS} ../dist/tp
246	cp ${BOOTBLOCKS} ${STANDDIR}
247	cp ${DISKUTILS} ${STANDDIR}
248
249depend:
250	for i in ${SRCS} ${DUMMIES}; do \
251	    ${CC} -M ${INCPATH} $$i | \
252	    awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
253		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
254		else rec = rec " " $$2 } } \
255		END { print rec } ' >> makedep; done
256	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
257	echo '$$r makedep' >>eddep
258	echo 'w' >>eddep
259	cp Makefile Makefile.bak
260	ed - Makefile < eddep
261	rm eddep makedep
262	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
263	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
264	echo '# see make depend above' >> Makefile
265
266# DO NOT DELETE THIS LINE -- make depend uses it
267
268
269sys.o: sys.c ./../h/param.h /usr/include/machine/machparam.h ../h/signal.h
270sys.o: /usr/include/sys/types.h ./../h/inode.h ./../h/fs.h ./../h/dir.h
271sys.o: ./saio.h
272
273conf.o: conf.c ./../h/param.h
274conf.o: /usr/include/machine/machparam.h ../h/signal.h /usr/include/sys/types.h
275conf.o: ./../h/inode.h ./../h/fs.h ./saio.h
276
277prf.o: prf.c
278prf.o: /usr/include/sys/types.h
279
280format.o: format.c ./../h/param.h /usr/include/machine/machparam.h
281format.o: ../h/signal.h /usr/include/sys/types.h ./../h/fs.h ./../h/inode.h
282format.o: ./../h/dkbad.h ./saio.h
283
284bootxx.o: bootxx.c ./../h/param.h /usr/include/machine/machparam.h
285bootxx.o: ../h/signal.h /usr/include/sys/types.h ./../h/inode.h ./../h/fs.h
286bootxx.o: /usr/include/sys/exec.h ./saio.h ./../h/reboot.h
287
288confxx.o: confxx.c ./../machine/pte.h ./../h/param.h
289confxx.o: /usr/include/machine/machparam.h ../h/signal.h
290confxx.o: /usr/include/sys/types.h ./../h/inode.h ./../h/fs.h ./saio.h
291# DEPENDENCIES MUST END AT END OF FILE
292# IF YOU PUT STUFF HERE IT WILL GO AWAY
293# see make depend above
294