objtype=386					# sic
</$objtype/mkfile
BIN=/dev/null

p=p
EXT=load
K=0
L16=l16r

TARG=\
	${p}pxe${EXT}\
	${p}pxe${EXT}acid\

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

LOAD=\
	apm.$O\
	boot.$O\
	conf.$O\
	i8250.$O\
	inflate.$O\
	load.$O\
	memory.$O\
	multiboot.$O\
	pci.$O\
	warp64.$O\

ETHER=\
	bootp.$O\
	ether.$O\
	ether2114x.$O\
	ether79c970.$O\
	ether8139.$O\
	ether8169.$O\
	ether82557.$O\
	ether82563.$O\
	etherigbe.$O\
	ethermii.$O\
	etherbcm4401.$O\
	ethervgbe.$O\

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

AFLAGS=-I.
CFLAGS=-FTVw -I.

all:V:	$TARG

install:V:	$TARG
	cp $TARG /$objtype
	test -d /n/9/$objtype && cp $TARG /n/9/$objtype

${p}${EXT}:	$L16.$O l32p.$O l32v.$O l64p.$O $CORE $LOAD $ETHER
	$LD -o $target -H3 -T0x$K^0010000 -l $prereq -lflate -lc -lip
	ls -l $target

${p}${EXT}acid:	$L16.$O l32p.$O l32v.$O l64p.$O $CORE $LOAD $ETHER
	$LD -o $target -T0x$K^0007c00 -l $prereq -lflate -lc -lip
	ls -l $target
	# acid $target
	# map({"text", 0x$K^0007c00, 0x${K}0090000, 0x00000020})

${p}pxe${EXT}:	$L16.$O l32p.$O lpxe.$O l64p.$O $CORE $LOAD $ETHER
#	$LD -o $target -H3 -T0x$K^0007C00 -l $prereq -lflate -lc -lip
	$LD -o $target -H3 -T0x$K^0007C00 -l $prereq -lflate -lc -lip
	ls -l $target
${p}pxe${EXT}acid:	$L16.$O l32p.$O lpxe.$O l64p.$O $CORE $LOAD $ETHER
	$LD -o $target -T0x$K^0007c00 -l $prereq -lflate -lc -lip
	ls -l $target
	# acid $target
	# map({"text", 0x${K}0007c00, 0x${K}0090000, 0x00000020})

lpxe.$O: l32v.s
	$AS $AFLAGS -DPXE -o $target l32v.s

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

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

%.$O:	$HFILES

l.$O:	x16.h

clock.$O floppy.$O trap.$O:	ureg.h
ether.$O:	etherif.h
bootp.$O:	ip.h

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