xref: /original-bsd/sys/i386/stand/Makefile (revision 3705696b)
1#	@(#)Makefile	8.1 (Berkeley) 06/11/93
2
3DESTDIR=/
4STAND=	../../stand
5INCPATH=-I../../sys -I../../  -I${STAND}
6VPATH=	${STAND}
7STANDDIR= ${DESTDIR}/stand
8
9CC=	cc -traditional
10C2=	/usr/libexec/c2
11CPP=	cpp -traditional ${INCPATH} -DSTANDALONE -DAT386
12
13RELOC=	70000
14RELOC2=	70200
15
16CFLAGS=	-DSTANDALONE -DAT386 -O ${INCPATH}
17
18DRIVERS=cga.c fd.c kbd.c wd.c
19SRCS=	boot.c bootxx.c conf.c confxx.c copy.c fd.c fdbootblk.c prf.c \
20	srt0.c wdbootblk.c ${DRIVERS} ${SASRC}
21LIBS=	libsa/libsa.a libdrive.a ${DESTDIR}/usr/lib/libc.a
22SMLIBS=	libsmsa/libsmsa.a libdrive.a ${DESTDIR}/usr/lib/libc.a
23
24BOOTBLOCKS= wdboot bootwd fdboot bootfd
25DISKUTILS= boot copy cat ls
26ALL=	${BOOTBLOCKS} ${DISKUTILS}
27
28all: ${ALL}
29
30libsa/libsa.a::
31	cd libsa; make
32libsmsa/libsmsa.a::
33	cd libsmsa; make
34
35libdrive.a: conf.o prf.o ${DRIVERS:.c=.o}
36	ar crv $@ $?
37	ranlib $@
38
39# startups
40
41srt0.o: srt0.c
42	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} srt0.c | ${AS} -o srt0.o
43
44wsrt0.o: srt0.c
45	${CPP} -E -DLOCORE -DSMALL -DRELOC=0x${RELOC} -DREL srt0.c | \
46	    ${AS} -o wsrt0.o
47
48relsrt0.o: srt0.c
49	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} -DREL srt0.c | ${AS} -o relsrt0.o
50
51# block 0 boots
52
53wdbootblk.o: wdbootblk.c
54	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} wdbootblk.c | ${AS} -o $@
55
56fdbootblk.o: fdbootblk.c
57	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} fdbootblk.c | ${AS} -o $@
58
59# bootable from floppy or real disks
60
61boot:	boot.o bootconf.o cga.o relsrt0.o ${LIBS}
62	ld -N -T ${RELOC} -o $@ boot.o bootconf.o cga.o relsrt0.o ${LIBS}
63
64bootconf.o: conf.o
65	ln -s conf.c bootconf.c
66	${CC} -c ${CFLAGS} -DBOOT bootconf.c
67	rm -f bootconf.c
68
69# utilities
70
71cat:	cat.o srt0.o conf.o ${LIBS}
72	ld -N -o $@ srt0.o cat.o conf.o ${LIBS}
73
74ls:	ls.o srt0.o conf.o ${LIBS}
75	ld -N -o $@ srt0.o ls.o conf.o ${LIBS}
76
77copy:	copy.o srt0.o conf.o ${LIBS}
78	ld -N -o $@ srt0.o copy.o conf.o ${LIBS}
79
80# getting booted from disc
81
82wdboot: wdbootblk.o
83	ld -N -T ${RELOC} wdbootblk.o
84	cp a.out wdb
85	rm -f wdboot
86	strip a.out;dd if=a.out of=wdboot ibs=32 skip=1;rm -f a.out
87	ls -l wdboot
88
89bootwd: wdbootblk.o wsrt0.o bootxx.o sm_confwd.o sm_wd.o sm_cga.o ${SMLIBS}
90	ld -N -T ${RELOC2} wsrt0.o bootxx.o sm_confwd.o sm_wd.o \
91	    sm_cga.o ${SMLIBS}
92	size a.out
93	cp a.out bwd
94	rm -f bootwd
95	strip a.out;dd if=a.out of=bootwd ibs=32 skip=1;rm -f a.out
96	ls -l bootwd
97
98fdboot: fdbootblk.o
99	ld -N -T ${RELOC} fdbootblk.o
100	cp a.out fdb
101	rm -f fdboot
102	strip a.out;dd if=a.out of=fdboot ibs=32 skip=1;rm -f a.out
103	ls -l fdboot
104
105bootfd: fdbootblk.o wsrt0.o bootxx.o fd.o sm_cga.o sm_conffd.o ${SMLIBS}
106	ld -N -T ${RELOC2} wsrt0.o bootxx.o fd.o sm_cga.o sm_conffd.o ${SMLIBS}
107	size a.out
108	cp a.out bfd
109	rm -f bootfd
110	strip a.out; dd if=a.out of=bootfd ibs=32 skip=1;rm -f a.out
111	ls -l bootfd
112
113sm_conffd.o: conffd.c
114	rm -f sm_conffd.c
115	ln -s conffd.c sm_conffd.c
116	${CC} -S -DSMALL ${CFLAGS} sm_conffd.c
117	${AS} sm_conffd.s -o sm_conffd.o
118	rm -f sm_conffd.s sm_conffd.c
119
120sm_confwd.o: confwd.c
121	rm -f sm_confwd.c
122	ln -s confwd.c sm_confwd.c
123	${CC} -S -DSMALL ${CFLAGS} sm_confwd.c
124	${AS} sm_confwd.s -o sm_confwd.o
125	rm -f sm_confwd.s sm_confwd.c
126
127sm_cga.o: cga.c
128	rm -f sm_cga.c
129	ln -s cga.c sm_cga.c
130	${CC} -S -DSMALL ${CFLAGS} sm_cga.c
131	${AS} sm_cga.s -o sm_cga.o
132	rm -f sm_cga.s sm_cga.c
133
134sm_wd.o: wd.c
135	rm -f sm_wd.c
136	ln -s wd.c sm_wd.c
137	${CC} -S -DSMALL ${CFLAGS} sm_wd.c
138	${AS} sm_wd.s -o sm_wd.o
139	rm -f sm_wd.s sm_wd.c
140
141confwd.o: confwd.c confxx.o
142conffd.o: conffd.c confxx.o
143
144confxx.o:
145	touch confxx.o
146
147confwd.c: confxx.c
148	rm -f confwd.c
149	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > confwd.c
150	sed -e 's/XX/wd/' -e 's/xx/wd/g'	< confxx.c >> confwd.c
151
152conffd.c: confxx.c
153	rm -f conffd.c
154	sed -e 's/io->i_dev/0/g'		< ${STAND}/dev.c > conffd.c
155	sed -e 's/XX/fd/' -e 's/xx/fd/g'	< confxx.c >> conffd.c
156
157clean:
158	rm -f *.o *.exe *.i sm_*.c libdrive.a
159	rm -f a.out bfd bwd fdb wdb ${ALL}
160	rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
161		conf[a-wyz]?.c conf[a-wyz]??.c
162	rm -f format core sboot bootconf.c
163	cd libsa; make cleandir
164	cd libsmsa; make cleandir
165
166cleandir: clean
167	rm -f ${MAN} tags .depend
168
169depend: ${SRCS}
170	mkdep ${INCPATH} -DSTANDALONE ${SRCS} ${DUMMIES}
171
172install: ${ALL}
173	install -c -s boot ${DESTDIR}
174	cp ${DISKUTILS} ../dist/floppy
175	cp ${TAPEUTILS} ../dist/tp
176	cp ${BOOTBLOCKS} ${STANDDIR}
177	cp ${DISKUTILS} ${STANDDIR}
178