# Makefile to build a boot diskette

# configuration: set these to your 3inch and 5inch drives
3INCH=/dev/fd0H1440
5INCH=/dev/fd1h1200

DIRS = lib bin dev etc tmp mnt sbin boot

BINFILES = cp dd gzip tar ls sh rm ln mkdir mv mknod chmod
USRBINFILES = label
SBINFILES = e2fsck mke2fs mkswap swapon mount umount sync update
ETCFILES = group passwd termcap  
BOOTFILES = boot.b bootactv.bin
BOOTFILES2 = message
DELFILES = boot/boot.??* dev/MAKEDEV etc/lilo.conf

3inch:
	mkfs $(3INCH) 1440
	mount $(3INCH) /mnt
	gcc -s -N -o fdisk fdisk.c
	(cd /mnt; mkdir $(DIRS))
	cp $(BINROOTDIR)/dev/MAKEDEV /mnt/dev
	(cd /mnt/dev;./MAKEDEV generic >& /dev/null)
	cp ./linux.* /mnt
	cp $(BINROOTDIR)/lib/libc-lite.so.4.5.21 /mnt/lib/libc.so.4.5.21
	ln -s libc.so.4.5.21 /mnt/lib/libc.so.4
	cp /lib/ld.so /mnt/lib
	(cd $(BINROOTDIR)/bin;cp $(BINFILES) /mnt/bin)
	(cd $(BINROOTDIR)/sbin;cp $(SBINFILES) /mnt/sbin)
	(cd $(BINROOTDIR)/etc;cp $(ETCFILES) /mnt/etc)
	cp fdisk /mnt/sbin
	(cd $(BINROOTDIR)/usr/bin;cp $(USRBINFILES) /mnt/bin)
	(cd $(BINROOTDIR)/boot;cp $(BOOTFILES) /mnt/boot)
	cp $(BOOTFILES2) /mnt/boot
	cp config.3 /mnt/etc/lilo.conf
	cp doadmin /mnt/bin
	cp $(BINROOTDIR)/sbin/doconfig /mnt/sbin
	cp rc X11list /mnt/etc
	(cd /mnt/etc;$(BINROOTDIR)/sbin/lilo -C /etc/lilo.conf -r /mnt)
	sync
	(cd /mnt;rm -f $(DELFILES))
	sync
	umount /mnt
	rm -f *.o fdisk

# I don't have a 5.25 drive a, so I just build its image on my a:
5inch:
	mkfs $(3INCH) 1200
	mount $(3INCH) /mnt
	gcc -s -N -o fdisk fdisk.c
	(cd /mnt; mkdir $(DIRS))
	cp $(BINROOTDIR)/dev/MAKEDEV /mnt/dev
	(cd /mnt/dev;./MAKEDEV generic >& /dev/null)
	cp ./vmlinuz /mnt
	cp $(BINROOTDIR)/lib/libc-lite.so.4.5.19 /mnt/lib/libc.so.4.5.19
	ln -s libc.so.4.5.19 /mnt/lib/libc.so.4
	cp /lib/ld.so /mnt/lib
	(cd $(BINROOTDIR)/bin;cp $(BINFILES) /mnt/bin)
	(cd $(BINROOTDIR)/sbin;cp $(SBINFILES) /mnt/sbin)
	(cd $(BINROOTDIR)/etc;cp $(ETCFILES) /mnt/etc)
	cp fdisk /mnt/sbin
	(cd $(BINROOTDIR)/usr/bin;cp $(USRBINFILES) /mnt/bin)
	(cd $(BINROOTDIR)/boot;cp $(BOOTFILES) /mnt/boot)
	cp $(BOOTFILES2) /mnt/boot
	cp config.5 /mnt/etc/lilo.conf
	cp doadmin /mnt/bin
	cp $(BINROOTDIR)/sbin/doconfig /mnt/sbin
	cp rc X11list /mnt/etc
#	(cd /mnt/sbin;./lilo -C /etc/lilo.conf -r /mnt)
	sync
#	(cd /mnt;rm -f $(DELFILES))
	sync
	umount /mnt
	rm -f *.o fdisk
