3 # Copyright 2009-2014 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)
28 OBJS=lilo.o raid.o map.o geometry.o boot.o device.o common.o bsect.o cfg.o \
29 partition.o identify.o probe.o shs2.o edit.o temp.o
33 LIS=chain.lis disk.lis dparam.lis first.lis second.lis \
34 bootsect.lis third.lis mbr.lis bitmap.lis pseudo.lis mbr2.lis \
35 pseudo1.lis loader.lis pseudo3.lis
36 BFILES=first.b second.b third.b bitmap.b chain.b mbr.b mbr2.b \
37 bootsect.b pseudo1.b pseudo2.b pseudo3.b
38 CFILES=boot.c bsect.c cfg.c common.c device.c edit.c geometry.c \
39 identify.c lilo.c map.c partition.c probe.c raid.c shs2.c temp.c
40 HFILES=bdata.h bitmap.h boot.h bsect.h cfg.h common.h config.h device.h \
41 edit.h geometry.h identify.h lilo.h loader.h map.h md-int.h partition.h \
42 probe.h raid.h shs2.h temp.h version.h vesainfo.h
44 .SUFFIXES: .img .b .com .S .s
48 # everything needed to run, just short of installation
53 # everything above plus the statically linked version
55 alles: all diag1.img lilo.static
58 # make the bootable diagnostic floppies
60 floppy1: disk.com bootsect.b
62 @echo Creating Diagnostic Floppy 1.6
64 @echo Insert a blank, formatted, floppy into drive 0
65 @echo "Press <Enter> to continue, <^C> to abort ..."
67 cat bootsect.b disk.com | dd of=/dev/fd0 bs=512
71 @echo Creating Diagnostic Floppy 2.4
72 @$(MAKE) -C ../diagnose check
73 @$(MAKE) -C ../diagnose floppy
75 diagnostic: ../test.img diag1.img diag2.img diag3.img
81 $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
84 $(AS86) -w -l $*.lis -o $*.o $*.s
87 $(LD86) -s -o $*.img $*.o
90 dd if=$*.img of=$*.b bs=32 skip=1
93 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSTANDALONE -o edit $(EDIT)
95 loader.i: mkloader first.b second.b third.b bitmap.b mbr.b chain.b mbr2.b
101 disk.s: disk.S read.S bdata.h biosdata.S lilo.h Makefile
102 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -o disk.s disk.S
104 mbr.s: mbr.S lilo.h Makefile
105 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -DMBR=0xafbbe760 \
109 dd if=$*.img of=$*.b bs=32 skip=49
111 mbr2.s: mbr.S lilo.h Makefile
112 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -DMBX=0x93c00848 \
116 dd if=$*.img of=$*.b bs=32 skip=49
118 bootsect.s: bootsect.S disk.b
119 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
120 -DSIZEDISKB=`wc -c <disk.b | sed "s/ //g"` \
121 -o bootsect.s bootsect.S
123 pseudo1.s: bootsect.S pseudo.S disk.com
124 cat bootsect.S pseudo.S >$(TMP).S
125 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
126 -DSIZEKRNL=`wc -c <disk.com | sed "s/ //g"` \
127 -DSIZEDISKB=512 -o pseudo1.s $(TMP).S
130 pseudo2.s: bootsect.S pseudo.S
131 $(MAKE) -C ../diagnose all
132 cat bootsect.S pseudo.S >$(TMP).S
133 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
134 -DSIZEKRNL=`wc -c <../diagnose/test4.com | sed "s/ //g"` \
135 -DSIZEDISKB=512 -o pseudo2.s $(TMP).S
138 pseudo3.s: bootsect.S pseudo.S
139 $(MAKE) -C ../diagnose all
140 cat bootsect.S pseudo.S >$(TMP).S
141 $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
142 -DSIZEKRNL=`wc -c <../diagnose/test5.com | sed "s/ //g"` \
143 -DSIZEDISKB=512 -o pseudo3.s $(TMP).S
151 diag1.img: disk.com pseudo1.b
152 cat pseudo1.b disk.com >diag1.img
155 $(MAKE) -C ../diagnose all
156 cat pseudo2.b ../diagnose/test4.com >diag2.img
159 $(MAKE) -C ../diagnose all
160 cat pseudo3.b ../diagnose/test5.com >diag3.img
162 flags.i: ../test.img Makefile version $(CFILES) $(HFILES)
163 echo "#define CFLAGS \"" $(CFLAGS) "\"" >flags.i
164 tail -$$((`wc -l <Makefile`-`sed /\#\#\#/q <Makefile | wc -l`)) \
165 <Makefile | grep -v "0x" >$(TMP)
166 for i in $(CFILES) $(HFILES) ; do cat $$i >>$(TMP) ; done
167 echo "#define CSOURCE " `./version $(TMP)` >>flags.i
171 dparam.com: dparam.img
172 dd if=dparam.img of=dparam.com bs=288 skip=1
175 cp -p dparam.S dparam.s
178 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o lilo $(OBJS) $(LIBS)
181 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o lilo.static -static $(OBJS) $(LIBS)
184 $(CPP) $(CPPFLAGS) -C -traditional -DLILO_ASM -o common.s common.h
186 bitmap.o: bitmap.s common.s
187 third.o: third.s common.s
188 second.o: second.s common.s
189 first.o: first.s common.s
190 chain.o: chain.s common.s
192 first.s: first.S lilo.h version.h Makefile
193 $(CPP) $(CPPFLAGS) $(PCONFIG) -DFIRST=0x62177489 -o first.s first.S
195 second.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
196 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
197 $(CPP) $(CPPFLAGS) $(PCONFIG) -DTEXT=0x9dd476ec second.S -o second.s
199 third.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
200 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
201 $(CPP) $(CPPFLAGS) $(PCONFIG) -DMENU=0x2012a4a7 second.S -o third.s
203 bitmap.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
204 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
205 $(CPP) $(CPPFLAGS) $(PCONFIG) -DBITMAP=0x2ece2fbe second.S -o bitmap.s
207 chain.s: chain.S lilo.h version.h first.b Makefile
208 $(CPP) $(CPPFLAGS) $(PCONFIG) -DCHAIN=0x536a7646 chain.S -o chain.s
210 xxx.s: chain.S lilo.h Makefile
211 $(CPP) $(CPPFLAGS) chain.S -DXXX -o xxx.s
216 # shorthand install, if one knows that one has the 'bcc' compiler
221 # normal install, but doesn't make the diagnostic binaries
224 mkdir -p $$DESTDIR$(SBIN_DIR) $$DESTDIR$(CFG_DIR)
225 mkdir -p $$DESTDIR$(BOOT_DIR) $$DESTDIR$(USRSBIN_DIR)
227 @if [ -e $$DESTDIR$(BOOT_DIR)/boot.b -o -e $$DESTDIR$(BOOT_DIR)/boot.old ]; then \
228 rm -f $$DESTDIR$(BOOT_DIR)/boot.b; rm -f $$DESTDIR$(BOOT_DIR)/boot.old; fi
229 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-bmp.b -o -f $$DESTDIR$(BOOT_DIR)/boot-bmp.old ]; then \
230 rm -f $$DESTDIR$(BOOT_DIR)/boot-bmp.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-bmp.old; fi
231 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-menu.b -o -f $$DESTDIR$(BOOT_DIR)/boot-menu.old ]; then \
232 rm -f $$DESTDIR$(BOOT_DIR)/boot-menu.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-menu.old; fi
233 @if [ -f $$DESTDIR$(BOOT_DIR)/boot-text.b -o -f $$DESTDIR$(BOOT_DIR)/boot-text.old ]; then \
234 rm -f $$DESTDIR$(BOOT_DIR)/boot-text.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-text.old; fi
235 @if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
236 mv $$DESTDIR$(BOOT_DIR)/chain.b $$DESTDIR$(BOOT_DIR)/chain.old; fi
237 @if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
238 mv $$DESTDIR$(BOOT_DIR)/mbr.b $$DESTDIR$(BOOT_DIR)/mbr.old; fi
240 if [ -f chain.b -a $(BUILTIN) -eq 0 ]; then cp chain.b $$DESTDIR$(BOOT_DIR); fi
241 if [ -f mbr.b -a $(BUILTIN) -eq 0 ]; then cp mbr.b $$DESTDIR$(BOOT_DIR); fi
242 if [ -f diag1.img ]; then cp -f diag1.img $$DESTDIR$(BOOT_DIR); fi
243 if [ -f diag2.img ]; then cp -f diag2.img $$DESTDIR$(BOOT_DIR); fi
246 cp lilo $$DESTDIR$(SBIN_DIR)/lilo
247 if [ -f lilo.static ]; then \
249 cp lilo.static $$DESTDIR$(SBIN_DIR)/lilo.static; \
251 cp ../mkrescue $$DESTDIR$(USRSBIN_DIR)/mkrescue
252 cp ../keytab-lilo.pl $$DESTDIR$(USRSBIN_DIR)/keytab-lilo
255 sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
256 $(CPP) $(CFLAGS) $(CPPFLAGS) -MM *.c >>tmp_make
259 version: common.c lilo.h common.h
260 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSHS_MAIN -o version common.c
263 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DLILO_BINARY -o mkloader temp.c
267 rm -f core $(LIS) *.shs *.crc $(TMP)*
271 rm -f *.o *.s *.i *.img *.b tmp_make version
272 rm -f lilo lilo.static edit mkloader
275 rm -f *~ */*~ *.b *.com lilo*tar.gz
278 rm -f $$DESTDIR$(SBIN_DIR)/lilo
279 rm -f $$DESTDIR$(USRSBIN_DIR)/mkrescue
280 rm -f $$DESTDIR$(USRSBIN_DIR)/keytab-lilo
281 rm -f $$DESTDIR$(BOOT_DIR)/diag1.img
282 rm -f $$DESTDIR$(BOOT_DIR)/diag2.img
284 if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
285 rm -f $$DESTDIR$(BOOT_DIR)/chain.b; fi
286 if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
287 rm -f $$DESTDIR$(BOOT_DIR)/mbr.b; fi
291 boot.o: boot.c config.h lilo.h version.h common.h geometry.h device.h \
292 cfg.h map.h partition.h boot.h loader.h
293 bsect.o: bsect.c config.h lilo.h version.h common.h raid.h cfg.h device.h \
294 geometry.h map.h temp.h partition.h boot.h bsect.h bitmap.h probe.h \
295 loader.h edit.h shs2.h
296 cfg.o: cfg.c lilo.h version.h common.h temp.h cfg.h
297 common.o: common.c lilo.h version.h common.h
298 device.o: device.c config.h lilo.h version.h common.h temp.h device.h \
299 geometry.h partition.h cfg.h probe.h md-int.h
300 edit.o: edit.c config.h lilo.h version.h common.h cfg.h temp.h bsect.h \
302 geometry.o: geometry.c config.h lilo.h version.h common.h device.h raid.h \
303 geometry.h cfg.h md-int.h probe.h
304 identify.o: identify.c lilo.h version.h common.h cfg.h
305 lilo.o: lilo.c config.h lilo.h version.h common.h cfg.h raid.h boot.h \
306 device.h flags.i geometry.h map.h bsect.h identify.h partition.h \
307 probe.h temp.h loader.h md-int.h edit.h bitmap.h
308 map.o: map.c lilo.h version.h common.h geometry.h map.h
309 partition.o: partition.c config.h lilo.h version.h common.h cfg.h \
310 device.h geometry.h partition.h boot.h loader.h
311 probe.o: probe.c lilo.h version.h common.h device.h geometry.h \
312 partition.h bsect.h bdata.h probe.h
313 raid.o: raid.c config.h lilo.h version.h common.h raid.h boot.h device.h \
314 geometry.h bsect.h cfg.h partition.h md-int.h
315 shs2.o: shs2.c lilo.h version.h shs2.h
316 temp.o: temp.c lilo.h version.h common.h temp.h loader.i