1997-12-19 23:56:18 +00:00
|
|
|
# $Id: Makefile,v 1.3 1997/02/22 16:06:35 peter Exp $
|
|
|
|
|
1995-11-05 16:02:04 +00:00
|
|
|
PROG= mkdosfs
|
|
|
|
|
1997-12-19 23:56:18 +00:00
|
|
|
CFLAGS+= -Wall
|
1995-11-05 16:02:04 +00:00
|
|
|
|
|
|
|
###################################################################
|
|
|
|
#
|
|
|
|
# Everything below is solely intented for maintenance.
|
|
|
|
# As you can see, it requires as86/ld86 from the ``bcc'' package.
|
1997-12-19 23:56:18 +00:00
|
|
|
|
|
|
|
# Uncomment this for maintenance.
|
|
|
|
# Warning: doing this may result in the distribution copy of bootcode.h
|
|
|
|
# being rebuilt if an objects are built in the current directory.
|
1995-11-05 16:02:04 +00:00
|
|
|
#
|
1997-12-19 23:56:18 +00:00
|
|
|
#MKDOSFS_MAINTENANCE= yes
|
|
|
|
|
|
|
|
.if defined(MKDOSFS_MAINTENANCE)
|
|
|
|
CFLAGS+= -I.
|
|
|
|
CLEANFILES+= bootcode.h
|
1995-11-05 16:02:04 +00:00
|
|
|
|
|
|
|
AS86= as86
|
|
|
|
LD86= ld86
|
|
|
|
AS86FLAGS= -0
|
|
|
|
LD86FLAGS= -0 -s
|
|
|
|
|
|
|
|
CLEANFILES+= *.obj *.bin *.com
|
1997-12-19 23:56:18 +00:00
|
|
|
|
1995-11-05 16:02:04 +00:00
|
|
|
.SUFFIXES: .asm .obj .bin .com
|
|
|
|
|
|
|
|
.asm.obj:
|
|
|
|
${AS86} ${AS86FLAGS} -o ${.TARGET} ${.IMPSRC}
|
|
|
|
|
|
|
|
.obj.bin:
|
|
|
|
${LD86} ${LD86FLAGS} -T 0x7c00 -o ${.PREFIX}.tmp ${.IMPSRC}
|
|
|
|
dd bs=32 skip=1 of=${.TARGET} if=${.PREFIX}.tmp
|
|
|
|
rm -f ${.PREFIX}.tmp
|
|
|
|
|
|
|
|
# .com file is just for testing
|
|
|
|
.obj.com:
|
|
|
|
${LD86} ${LD86FLAGS} -T 0x100 -o ${.PREFIX}.tmp ${.IMPSRC}
|
|
|
|
dd bs=32 skip=1 of=${.TARGET} if=${.PREFIX}.tmp
|
|
|
|
rm -f ${.PREFIX}.tmp
|
|
|
|
|
1997-12-19 23:56:18 +00:00
|
|
|
all beforedepend: bootcode.h
|
|
|
|
|
|
|
|
bootcode.h: bootcode.bin
|
|
|
|
@echo converting ${.TARGET} into ${.TARGET}...
|
1995-11-05 16:02:04 +00:00
|
|
|
@perl -e 'if(read(STDIN,$$buf,512)<512) { \
|
|
|
|
die "Read error on .bin file\n"; \
|
|
|
|
} \
|
|
|
|
@arr = unpack("C*",$$buf); \
|
|
|
|
print "#ifndef BOOTCODE_H\n"; \
|
|
|
|
print "#define BOOTCODE_H 1\n\n"; \
|
|
|
|
print "/*\n * This file has been generated\n"; \
|
|
|
|
print " * automatically. Do not edit.\n */\n\n"; \
|
|
|
|
print "static unsigned char bootcode[512] = {\n"; \
|
|
|
|
for($$i=0; $$i<512; $$i++) { \
|
|
|
|
printf "0x%02x, ",$$arr[$$i]; \
|
|
|
|
if($$i % 12 == 11) {print "\n";} \
|
|
|
|
} \
|
|
|
|
print "};\n\n"; \
|
|
|
|
print "#endif /* BOOTCODE_H */\n";' \
|
1997-12-19 23:56:18 +00:00
|
|
|
< ${.ALLSRC} > ${.TARGET}
|
|
|
|
.endif
|
1995-11-05 16:02:04 +00:00
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|