xref: /original-bsd/sys/i386/stand/Makefile (revision d33e872c)
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.2 (Berkeley) 04/28/91
25#
26
27DESTDIR=/
28INCPATH=-I. -I../../sys -I../../  -I../../stand
29CC=cc -traditional
30CPP= cpp -traditional ${INCPATH} -DSTANDALONE -DAT386
31CFLAGS=	${COPTS}
32COPTS=	-O ${INCPATH} -DSTANDALONE -DAT386
33RELOC=	70000
34RELOC2=	70200
35
36SRCS=	boot.c bootxx.c copy.c \
37	sys.c conf.c prf.c  kbd.c cga.c \
38	wd.c fd.c gets.c srt0.c \
39	wdbootblk.c fdbootblk.c
40DUMMIES= confxx.c
41DRIVERS= kbd.o cga.o wd.o fd.o
42LIBSA=	libsa.a
43
44BOOTBLOCKS= wdboot bootwd fdboot bootfd
45DISKUTILS= boot copy cat ls mem
46ALL=	${BOOTBLOCKS} ${DISKUTILS}
47
48STANDDIR= ${DESTDIR}/stand
49all: ${ALL}
50
51${LIBSA}: sys.o conf.o ${DRIVERS} prf.o gets.o getfile.o
52	ar crv ${LIBSA} $?
53	ranlib ${LIBSA}
54
55${DRIVERS}:
56	${CC} -c ${COPTS} $*.c
57
58# startups
59
60srt0.o: srt0.c
61	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} srt0.c | ${AS} -o srt0.o
62
63wsrt0.o: srt0.c
64	${CPP} -E -DLOCORE -DSMALL -DRELOC=0x${RELOC} -DREL srt0.c | ${AS} -o wsrt0.o
65
66relsrt0.o: srt0.c
67	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} -DREL srt0.c | \
68	${AS} -o relsrt0.o
69
70# block 0 boots
71
72wdbootblk.o: wdbootblk.c
73	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} wdbootblk.c | \
74	as -o wdbootblk.o
75
76fdbootblk.o: fdbootblk.c
77	${CPP} -E -DLOCORE -DRELOC=0x${RELOC} fdbootblk.c | \
78	as -o fdbootblk.o
79
80# bootable from floppy or real disks
81
82boot:	boot.o relsrt0.o bootconf.o ${LIBSA}
83	ld -N -T ${RELOC} -o boot relsrt0.o boot.o bootconf.o ${LIBSA} -lc
84
85bootconf.o: conf.o
86	cp conf.c bootconf.c
87	${CC} -c ${CFLAGS} -DBOOT bootconf.c
88	rm -f bootconf.c
89
90cat:	cat.o srt0.o conf.o ${LIBSA}
91	ld -N -o cat srt0.o cat.o conf.o ${LIBSA} -lc
92
93ls:	ls.o srt0.o conf.o ${LIBSA}
94	ld -N -o ls srt0.o ls.o conf.o ${LIBSA} -lc
95
96copy:	copy.o srt0.o conf.o ${LIBSA}
97	ld -N -o copy srt0.o copy.o conf.o ${LIBSA} -lc
98
99mem: mem.o prf.o kbd.o cga.o srt0.o gets.o
100	ld -N -o mem srt0.o mem.o kbd.o cga.o prf.o gets.o
101
102# getting booted from disc
103
104wdboot: wdbootblk.o
105	ld -N -T ${RELOC} wdbootblk.o
106	cp a.out wdb
107	rm -f wdboot
108	strip a.out;dd if=a.out of=wdboot ibs=32 skip=1;rm -f a.out
109	ls -l wdboot
110
111bootwd: wdbootblk.o wsrt0.o bootxx.o confwd.o sm_wd.o sm_sys.o sm_cga.o ${LIBSA}
112	ld -N -T ${RELOC2} wsrt0.o bootxx.o confwd.o sm_sys.o \
113		sm_wd.o sm_cga.o ${LIBSA} -lc
114	size a.out
115	cp a.out bwd
116	rm -f bootwd
117	strip a.out;dd if=a.out of=bootwd ibs=32 skip=1;rm -f a.out
118	ls -l bootwd
119
120fdboot: fdbootblk.o
121	ld -N -T ${RELOC} fdbootblk.o
122	cp a.out fdb
123	rm -f fdboot
124	strip a.out;dd if=a.out of=fdboot ibs=32 skip=1;rm -f a.out
125	ls -l fdboot
126
127bootfd: fdbootblk.o wsrt0.o bootxx.o conffd.o fd.o sm_sys.o sm_cga.o ${LIBSA}
128	ld -N -T ${RELOC2} wsrt0.o bootxx.o conffd.o sm_sys.o \
129		fd.o sm_cga.o ${LIBSA} -lc
130	size a.out
131	cp a.out bfd
132	rm -f bootfd
133	strip a.out; dd if=a.out of=bootfd ibs=32 skip=1;rm -f a.out
134	ls -l bootfd
135
136sm_wd.o: wd.o
137	-rm -f sm_wd.c
138	-ln -s wd.c sm_wd.c
139	${CC} -S -DSMALL ${CFLAGS} sm_wd.c
140	${AS} sm_wd.s -o sm_wd.o
141	rm -f sm_wd.s sm_wd.c
142
143sm_cga.o: cga.o
144	-rm -f sm_cga.c
145	-ln -s cga.c sm_cga.c
146	${CC} -S -DSMALL ${CFLAGS} sm_cga.c
147	${AS} sm_cga.s -o sm_cga.o
148	rm -f sm_cga.s sm_cga.c
149
150sm_cst.o: cst.o
151	-rm -f sm_cst.c
152	-ln -s cst.c sm_cst.c
153	${CC} -S -DSMALL ${CFLAGS} sm_cst.c
154	/lib/c2 -i sm_cst.s | as -o sm_cst.o
155	rm -f sm_cst.s sm_cst.c
156
157sm_swd.o: swd.o
158	-rm -f sm_swd.c
159	-ln -s swd.c sm_swd.c
160	${CC} -S -DSMALL ${CFLAGS} sm_swd.c
161	/lib/c2 -i sm_swd.s | as -o sm_swd.o
162	rm -f sm_swd.s sm_swd.c
163
164sm_sys.o: sys.o
165	-rm -f sm_sys.c
166	-ln -s sys.c sm_sys.c
167	${CC} -c -DSMALL ${CFLAGS} sm_sys.c
168	-rm -f sm_sys.c
169
170confwd.o: confwd.c confxx.o
171conffd.o: conffd.c confxx.o
172
173confxx.o:
174	touch confxx.o
175
176confwd.c: confxx.c
177	-rm -f confwd.c
178	sed -e 's/XX/wd/' -e 's/xx/wd/g' <confxx.c >confwd.c
179
180conffd.c: confxx.c
181	-rm -f conffd.c
182	sed -e 's/XX/fd/' -e 's/xx/fd/g' <confxx.c >conffd.c
183
184# utilities
185
186print:
187	@pr makefile
188	@ls -l | pr
189	@pr *.h *.c
190
191clean:
192	rm -f *.o *.exe *.i errs sm_*.c
193	rm -f a.out boot cat tpboot tpcopy copy tpformat disklabel \
194		tpdisklabel ls
195	rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
196		conf[a-wyz]?.c conf[a-wyz]??.c
197	rm -f format core sboot bootconf.c
198
199lint:
200	lint ${COPTS} -hxbn boot.c ${SRCS} | \
201	    grep -v 'possible pointer alignment' | \
202	    grep -v 'struct/union .* never defined'
203
204install: ${ALL}
205	install -c -s boot ${DESTDIR}
206	cp ${DISKUTILS} ../dist/floppy
207	cp ${TAPEUTILS} ../dist/tp
208	cp ${BOOTBLOCKS} ${STANDDIR}
209	cp ${DISKUTILS} ${STANDDIR}
210
211depend:
212	for i in ${SRCS} ${DUMMIES}; do \
213	    ${CC} -M ${INCPATH} $$i | \
214	    awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
215		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
216		else rec = rec " " $$2 } } \
217		END { print rec } ' >> makedep; done
218	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
219	echo '$$r makedep' >>eddep
220	echo 'w' >>eddep
221	cp Makefile Makefile.bak
222	ed - Makefile < eddep
223	rm eddep makedep
224	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
225	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
226	echo '# see make depend above' >> Makefile
227
228# DO NOT DELETE THIS LINE -- make depend uses it
229
230