shithub: purgatorio

ref: dd16eef8365cb0b9e4805c23291aadcaa596dd87
dir: /os/boot/pc/mkfile/

View raw version
<../../../mkconfig
objtype=386
SYSTARG=$OSTARG
OBJTYPE=386
BIN=$ROOT/Inferno/$OBJTYPE
LIBDIR=$ROOT/Inferno/$OBJTYPE/lib
LIBDIRS=../libflate $ROOT/libkern
LIBS=\
	libflate\
	libkern\

LIBFILES=${LIBS:%=$LIBDIR/%.a}
<$ROOT/mkfiles/mkfile-$SYSTARG-$OBJTYPE

BIN=$ROOT/Inferno/$OBJTYPE

TARG=\
	9load\
	9pxeload\
	9loadlite\
	9loaddebug\
	9loadlitedebug\
	ld.com\
	mbr\
	pbs\
	pbslba\

CORE=\
	alarm.$O\
	cga.$O\
	clock.$O\
	console.$O\
	dosboot.$O\
	devfloppy.$O\
	dma.$O\
	fs.$O\
	ilock.$O\
	kbd.$O\
	kfsboot.$O\
	print.$O\
	queue.$O\
	trap.$O\
	getcallerpc.$O\

LOAD=\
	8250.$O\
	apm.$O\
	boot.$O\
	cis.$O\
	conf.$O\
	devbios.$O\
	devi82365.$O\
	devpccard.$O\
	devsd.$O\
	inflate.$O\
	load.$O\
	memory.$O\
	part.$O\
	pci.$O\
	sdata.$O\
	sdmylex.$O\
	sd53c8xx.$O\
	sdiahci.$O\
	sdscsi.$O\
	sdaoe.$O\
	sdbios.$O\

ETHER=\
	bootp.$O\
	eipfmt.$O\
	ether.$O\
	ether2114x.$O\
	ether2000.$O\
	ether589.$O\
	ether79c970.$O\
	ether8003.$O\
	ether8139.$O\
	ether8169.$O\
	ether82563.$O\
	ether82557.$O\
	ether83815.$O\
	ether8390.$O\
	etherec2t.$O\
	etherelnk3.$O\
	etherga620.$O\
	etherigbe.$O\
	ethermii.$O\
	etherrhine.$O\
	etherdp83820.$O\

BCOM=\
	bcom.$O\
	bootld.$O\
	devsd.$O\
	memory.$O\
	part.$O\
	pci.$O\
	sdata.$O\
	sdscsi.$O\

HFILES=\
	lib.h\
	mem.h\
	dat.h\
	fns.h\
	io.h\
	aoe.h\

CFLAGS=-FVTw -I. -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/include

all:V:	$TARG

9load:	l.$O $CORE $LOAD $ETHER $LIBFILES
	$LD -o $target -H3 -T0x80010000 -l $prereq
	ls -l $target

9pxeload:	l.$O $CORE $LOAD $ETHER $LIBFILES
	$LD -o $target -H3 -T0x80007C00 -l $prereq
	ls -l $target

9loaddebug:	l.$O $CORE $LOAD $ETHER $LIBFILES
	$LD -o $target -T0x80010000 -l $prereq
	ls -l $target
	# acid $target
	# map({"text", 0x80010000, 0x80090000, 0x00000020})

9loadlite:	l.$O $CORE $LOAD noether.$O $LIBFILES
	$LD -o $target -H3 -T0x80010000 -l $prereq
	ls -l $target

9loadlitedebug:	l.$O $CORE $LOAD noether.$O $LIBFILES
	$LD -o $target -T0x80010000 -l $prereq
	ls -l $target
	# acid $target
	# map({"text", 0x80010000, 0x80090000, 0x00000020})

ld.com:	ld.$O $CORE $BCOM $LIBFILES
	$LD -o $target -H3 -T0x80080100 -l $prereq
	ls -l $target

lddebug:	ld.$O $CORE $BCOM $LIBFILES
	$LD -o $target -T0x80080100 -l $prereq
	ls -l $target
	# acid $target
	# map({"text", 0x80080100, 0x800B0000, 0x00000020})

ld.$O:	l.s
	$AS -DDOTCOM -o $target l.s

lpxe.$O:	l.s
	$AS -DPXE -o $target l.s

%.$O:	%.s
	$AS $stem.s

%.$O:	%.c
	$CC $CFLAGS $stem.c

%.$O:	$HFILES

l.$O pbs.$O pbslba.$O mbr.$O:	x16.h

clock.$O floppy.$O trap.$O:	ureg.h
bcom.$O conf.$O devfloppy.$O devsd.$O dosboot.$O fs.$O \
	kfsboot.$O load.$O part.$O:	dosfs.h fs.h kfs.h
ether.$O etherelnk3.$O:	etherif.h
devsd.$O part.$O sdata.$O sdscsi.$O: sd.h
bootp.$O:	ip.h

mbr:	mbr.$O
	$LD -o $target -H3 -T0x0600 -l $prereq
	ls -l $target

pbs&:	pbs%.$O
	$LD -o $target -H3 -T0x7C00 -l $prereq
	ls -l $target

pbs&.debug:	pbs%.$O
	$LD -o $target -T0x7C00 -l $prereq
	ls -l $target
	# acid $target
	# map({"text", 0x7C00, 0x7E00, 0x00000020})
	
# added to cause libflate to be made automatically:

$ROOT/Inferno/$OBJTYPE/lib/lib%.a:Q:	all-$SHELLTYPE
	#

rc-lib%.a nt-lib%.a:VQ:
	echo '@{builtin cd ' $ROOT/lib$stem ';mk SHELLTYPE=$SHELLTYPE SYSTARG=$SYSTARG OBJTYPE=$OBJTYPE install}'
	@{builtin cd  $ROOT/lib$stem ;mk 'SHELLTYPE='$SHELLTYPE 'SYSTARG='$SYSTARG 'OBJTYPE='$OBJTYPE install}

sh-lib%.a:VQ:
	echo "(cd $ROOT/lib$stem ; mk SHELLTYPE=$SHELLTYPE SYSTARG=$SYSTARG OBJTYPE=$OBJTYPE install)"
	(cd $ROOT/lib$stem ; mk SHELLTYPE=$SHELLTYPE SYSTARG=$SYSTARG OBJTYPE=$OBJTYPE install)

clean:
	rm -f *.[$OS] [$OS].out y.tab.? y.debug y.output $TARG 9loaddebug lddebug

install:V:
	for (i in $TARG)
		mk $MKFLAGS $i.install

%.install:V:	$BIN/%

$BIN/%:	%
	cp $stem $BIN/$stem

UPDATE=\
	mkfile\
	${CORE:%.$O=%.c}\
	${LOAD:%.$O=%.c}\
	${BCOM:%.$O=%.c}\
	${ETHER:%.$O=%.c}\
	$HFILES\
	l.s\
	noether.c\
	pbs.s\
	pbslba.s\
	mbr.s\
	x16.h\
	ureg.h\
	dosfs.h\
	fs.h\
	kfs.h\
	etherif.h\
	sd.h\
	ip.h\
	devfloppy.h\
	${TARG:%=/386/%}\

update:V:
	update $UPDATEFLAGS $UPDATE


%-sh:QV:
		for i in $LIBDIRS
		do
			echo "(cd $i ; mk SHELLTYPE=$SHELLTYPE SYSTARG=$SYSTARG OBJTYPE=$OBJTYPE $stem)"
			(cd $i; mk 'SHELLTYPE='$SHELLTYPE 'SYSTARG='$SYSTARG 'OBJTYPE='$OBJTYPE $stem)
		done

%-rc %-nt:QV:
		for (i in $LIBDIRS)
		{
			echo '@{cd $i ; mk SHELLTYPE=$SHELLTYPE SYSTARG=$SYSTARG OBJTYPE=$OBJTYPE $stem}'
			@{cd $i; mk 'SHELLTYPE='$SHELLTYPE 'SYSTARG='$SYSTARG 'OBJTYPE='$OBJTYPE $stem}
		}

nuke:V:		clean nuke-$SHELLTYPE