3 # Copyright 2009-2013 Joachim Wiedorn
6 # Licensed under the terms contained in the file 'COPYING'
7 # in the source directory.
14 # Do not modify anything below this point
19 CPP=$(CC) -E -P -ffreestanding
23 G=`cat foo1 foo2 | grep version | cut -d " " -f 3`
25 CFLAGS=$(OPT) -Wall $(PCONFIG)
26 LDFLAGS=#-Xlinker -qmagic
29 OBJS=lilo.o raid.o map.o geometry.o boot.o device.o common.o bsect.o cfg.o \
30 partition.o identify.o probe.o shs2.o edit.o temp.o
34 LIS=chain.lis disk.lis dparam.lis first.lis second.lis \
35 bootsect.lis third.lis mbr.lis bitmap.lis pseudo.lis mbr2.lis \
36 pseudo1.lis loader.lis pseudo3.lis
37 BFILES=first.b second.b third.b bitmap.b chain.b mbr.b mbr2.b \
38 bootsect.b pseudo1.b pseudo2.b pseudo3.b
39 CFILES=boot.c bsect.c cfg.c common.c device.c edit.c geometry.c \
40 identify.c lilo.c map.c partition.c probe.c raid.c shs2.c temp.c
41 HFILES=bdata.h bitmap.h boot.h bsect.h cfg.h common.h config.h device.h \
42 edit.h geometry.h identify.h lilo.h loader.h map.h md-int.h partition.h \
43 probe.h raid.h shs2.h temp.h version.h vesainfo.h
45 .SUFFIXES: .img .b .com .S .s
49 # everything needed to run, just short of installation
54 # everything above plus the statically linked version
56 alles: all diag1.img lilo.static
59 # make the bootable diagnostic floppies
61 floppy1: disk.com bootsect.b
63 @echo Creating Diagnostic Floppy 1.6
65 @echo Insert a blank, formatted, floppy into drive 0
66 @echo "Press <Enter> to continue, <^C> to abort ..."
68 cat bootsect.b disk.com | dd of=/dev/fd0 bs=512
72 @echo Creating Diagnostic Floppy 2.4
73 @$(MAKE) -C ../diagnose check
74 @$(MAKE) -C ../diagnose floppy
76 diagnostic: ../test.img diag1.img diag2.img diag3.img
82 $(CC) -c $(CFLAGS) $*.c
85 $(AS86) -w -l $*.lis -o $*.o $*.s
88 $(LD86) -s -o $*.img $*.o
91 dd if=$*.img of=$*.b bs=32 skip=1
94 $(CC) $(CFLAGS) -DSTANDALONE -o edit $(EDIT) $(LDFLAGS)
96 loader.i: mkloader first.b second.b third.b bitmap.b mbr.b chain.b mbr2.b
102 disk.s: disk.S read.S bdata.h biosdata.S lilo.h Makefile
103 $(CPP) -traditional $(PCONFIG) -o disk.s disk.S
105 mbr.s: mbr.S lilo.h Makefile
106 $(CPP) -traditional $(PCONFIG) -DMBR=0xafbbe760 \
110 dd if=$*.img of=$*.b bs=32 skip=49
112 mbr2.s: mbr.S lilo.h Makefile
113 $(CPP) -traditional $(PCONFIG) -DMBX=0x93c00848 \
117 dd if=$*.img of=$*.b bs=32 skip=49
119 bootsect.s: bootsect.S disk.b
120 $(CPP) -traditional $(PCONFIG) \
121 -DSIZEDISKB=`wc -c <disk.b | sed "s/ //g"` \
122 -o bootsect.s bootsect.S
124 pseudo1.s: bootsect.S pseudo.S disk.com
125 cat bootsect.S pseudo.S >$(TMP).S
126 $(CPP) -traditional $(PCONFIG) \
127 -DSIZEKRNL=`wc -c <disk.com | sed "s/ //g"` \
128 -DSIZEDISKB=512 -o pseudo1.s $(TMP).S
131 pseudo2.s: bootsect.S pseudo.S
132 $(MAKE) -C ../diagnose all
133 cat bootsect.S pseudo.S >$(TMP).S
134 $(CPP) -traditional $(PCONFIG) \
135 -DSIZEKRNL=`wc -c <../diagnose/test4.com | sed "s/ //g"` \
136 -DSIZEDISKB=512 -o pseudo2.s $(TMP).S
139 pseudo3.s: bootsect.S pseudo.S
140 $(MAKE) -C ../diagnose all
141 cat bootsect.S pseudo.S >$(TMP).S
142 $(CPP) -traditional $(PCONFIG) \
143 -DSIZEKRNL=`wc -c <../diagnose/test5.com | sed "s/ //g"` \
144 -DSIZEDISKB=512 -o pseudo3.s $(TMP).S
152 diag1.img: disk.com pseudo1.b
153 cat pseudo1.b disk.com >diag1.img
156 $(MAKE) -C ../diagnose all
157 cat pseudo2.b ../diagnose/test4.com >diag2.img
160 $(MAKE) -C ../diagnose all
161 cat pseudo3.b ../diagnose/test5.com >diag3.img
163 flags.i: ../test.img Makefile version $(CFILES) $(HFILES)
164 echo "#define CFLAGS \"" $(CFLAGS) "\"" >flags.i
165 tail -$$((`wc -l <Makefile`-`sed /\#\#\#/q <Makefile | wc -l`)) \
166 <Makefile | grep -v "0x" >$(TMP)
167 for i in $(CFILES) $(HFILES) ; do cat $$i >>$(TMP) ; done
168 echo "#define CSOURCE " `./version $(TMP)` >>flags.i
172 dparam.com: dparam.img
173 dd if=dparam.img of=dparam.com bs=288 skip=1
176 cp -p dparam.S dparam.s
179 $(CC) -o lilo $(LDFLAGS) $(OBJS) $(LIBS)
182 $(CC) -o lilo.static -static $(LDFLAGS) $(OBJS) $(LIBS)
185 $(CPP) -C -traditional -DLILO_ASM -o common.s common.h
187 bitmap.o: bitmap.s common.s
188 third.o: third.s common.s
189 second.o: second.s common.s
190 first.o: first.s common.s
191 chain.o: chain.s common.s
193 first.s: first.S lilo.h version.h Makefile
194 $(CPP) $(PCONFIG) -DFIRST=0x62177489 -o first.s first.S
196 second.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
197 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
198 $(CPP) $(PCONFIG) -DTEXT=0x9dd476ec second.S -o second.s
200 third.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
201 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
202 $(CPP) $(PCONFIG) -DMENU=0x2012a4a7 second.S -o third.s
204 bitmap.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
205 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
206 $(CPP) $(PCONFIG) -DBITMAP=0x2ece2fbe second.S -o bitmap.s
208 chain.s: chain.S lilo.h version.h first.b Makefile
209 $(CPP) $(PCONFIG) -DCHAIN=0x536a7646 chain.S -o chain.s
211 xxx.s: chain.S lilo.h Makefile
212 $(CPP) chain.S -DXXX -o xxx.s
217 # shorthand install, if one knows that one has the 'bcc' compiler
222 # normal install, but doesn't make the diagnostic binaries
225 mkdir -p $$DESTDIR$(SBIN_DIR) $$DESTDIR$(CFG_DIR)
226 mkdir -p $$DESTDIR$(BOOT_DIR) $$DESTDIR$(USRSBIN_DIR)
228 @if [ -e $$DESTDIR$(BOOT_DIR)/boot.b -o -e $$DESTDIR$(BOOT_DIR)/boot.old ]; then \
229 rm -f $$DESTDIR$(BOOT_DIR)/boot.b; rm -f $$DESTDIR$(BOOT_DIR)/boot.old; fi
230 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-bmp.b -o -f $$DESTDIR$(BOOT_DIR)/boot-bmp.old ]; then \
231 rm -f $$DESTDIR$(BOOT_DIR)/boot-bmp.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-bmp.old; fi
232 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-menu.b -o -f $$DESTDIR$(BOOT_DIR)/boot-menu.old ]; then \
233 rm -f $$DESTDIR$(BOOT_DIR)/boot-menu.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-menu.old; fi
234 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-text.b -o -f $$DESTDIR$(BOOT_DIR)/boot-text.old ]; then \
235 rm -f $$DESTDIR$(BOOT_DIR)/boot-text.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-text.old; fi
236 @if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
237 mv $$DESTDIR$(BOOT_DIR)/chain.b $$DESTDIR$(BOOT_DIR)/chain.old; fi
238 @if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
239 mv $$DESTDIR$(BOOT_DIR)/mbr.b $$DESTDIR$(BOOT_DIR)/mbr.old; fi
241 if [ -f chain.b -a $(BUILTIN) -eq 0 ]; then cp chain.b $$DESTDIR$(BOOT_DIR); fi
242 if [ -f mbr.b -a $(BUILTIN) -eq 0 ]; then cp mbr.b $$DESTDIR$(BOOT_DIR); fi
243 if [ -f diag1.img ]; then cp -f diag1.img $$DESTDIR$(BOOT_DIR); fi
244 if [ -f diag2.img ]; then cp -f diag2.img $$DESTDIR$(BOOT_DIR); fi
247 cp lilo $$DESTDIR$(SBIN_DIR)/lilo
248 [ -x lilo.static ] && strip lilo.static
249 cp ../mkrescue $$DESTDIR$(USRSBIN_DIR)/mkrescue
250 cp ../keytab-lilo.pl $$DESTDIR$(USRSBIN_DIR)/keytab-lilo
253 sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
254 $(CPP) $(CFLAGS) -MM *.c >>tmp_make
257 version: common.c lilo.h common.h
258 $(CC) $(CFLAGS) -DSHS_MAIN -o version common.c
261 $(CC) $(CFLAGS) -DLILO_BINARY -o mkloader temp.c
265 rm -f core $(LIS) *.shs *.crc $(TMP)*
269 rm -f *.o *.s *.i *.img *.b tmp_make version
270 rm -f lilo lilo.static edit mkloader
273 rm -f *~ */*~ *.b *.com lilo*tar.gz
276 rm -f $$DESTDIR$(SBIN_DIR)/lilo
277 rm -f $$DESTDIR$(USRSBIN_DIR)/mkrescue
278 rm -f $$DESTDIR$(USRSBIN_DIR)/keytab-lilo
279 rm -f $$DESTDIR$(BOOT_DIR)/diag1.img
280 rm -f $$DESTDIR$(BOOT_DIR)/diag2.img
282 if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
283 rm -f $$DESTDIR$(BOOT_DIR)/chain.b; fi
284 if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
285 rm -f $$DESTDIR$(BOOT_DIR)/mbr.b; fi
289 boot.o: boot.c config.h lilo.h version.h common.h geometry.h device.h \
290 cfg.h map.h partition.h boot.h loader.h
291 bsect.o: bsect.c config.h lilo.h version.h common.h raid.h cfg.h device.h \
292 geometry.h map.h temp.h partition.h boot.h bsect.h bitmap.h probe.h \
293 loader.h edit.h shs2.h
294 cfg.o: cfg.c lilo.h version.h common.h temp.h cfg.h
295 common.o: common.c lilo.h version.h common.h
296 device.o: device.c config.h lilo.h version.h common.h temp.h device.h \
297 geometry.h partition.h cfg.h probe.h md-int.h
298 edit.o: edit.c config.h lilo.h version.h common.h cfg.h temp.h bsect.h \
300 geometry.o: geometry.c config.h lilo.h version.h common.h device.h raid.h \
301 geometry.h cfg.h md-int.h probe.h
302 identify.o: identify.c lilo.h version.h common.h cfg.h
303 lilo.o: lilo.c config.h lilo.h version.h common.h cfg.h raid.h boot.h \
304 device.h flags.i geometry.h map.h bsect.h identify.h partition.h \
305 probe.h temp.h loader.h md-int.h edit.h bitmap.h
306 map.o: map.c lilo.h version.h common.h geometry.h map.h
307 partition.o: partition.c config.h lilo.h version.h common.h cfg.h \
308 device.h geometry.h partition.h boot.h loader.h
309 probe.o: probe.c lilo.h version.h common.h device.h geometry.h \
310 partition.h bsect.h bdata.h probe.h
311 raid.o: raid.c config.h lilo.h version.h common.h raid.h boot.h device.h \
312 geometry.h bsect.h cfg.h partition.h md-int.h
313 shs2.o: shs2.c lilo.h version.h shs2.h
314 temp.o: temp.c lilo.h version.h common.h temp.h loader.i