CONF=cpu
CONFLIST=cpu cpud term termd

objtype=amd64
</$objtype/mkfile
p=9

nix:V:	$p$CONF

<| awk -f ../mk/parse $CONF
<../mk/bootmkfile
<../mk/portmkfile

OBJ=$MACH $CONF.root.$O $DEVS $PORT
AGEN=sipi.h

#	$LD -o $target.elf -H5 -8 -T0xfffffffff0110000 -l $OBJ $CONF.$O $LIB

$p$CONF:Q:	$CONF.c $OBJ $LIB
	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
	echo $LD -o $target ...
	$LD -o $target -T0xfffffffff0110000 -R4096 -l $OBJ $CONF.$O $LIB
	size $target

install:V:	$p$CONF
	cp $p$CONF /$objtype/$p$CONF 

init.out:	init9.$O initcode.$O /$objtype/lib/libc.a
	$LD -l -R1 -s -o init.out init9.$O initcode.$O -lc

l32p.$O:	${objtype}l.h
l64idt.$O:	${objtype}l.h
l64syscall.$O:	${objtype}l.h
l64sipi.$O:	${objtype}l.h
l64v.$O:	${objtype}l.h

${objtype}l.h:	$objtype.h
	rc ../mk/mkenum $objtype.h > $target

apic.$O:	apic.h io.h
devarch.$O:	../port/error.h /$objtype/include/ureg.h
fpu.$O:		amd64.h
fpu.$O:		/$objtype/include/ureg.h
ioapic.$O:	apic.h io.h
main.$O:	init.h
memory.$O:	amd64.h
mmu.$O:		amd64.h
mp.$O:		apic.h
sipi.$O:	apic.h sipi.h
vsvm.$O:		amd64.h /$objtype/include/ureg.h
syscall.$O:	../port/error.h /sys/src/libc/9syscall/sys.h
syscall.$O:	/sys/include/tos.h /$objtype/include/ureg.h
syscall.$O:	amd64.h
trap.$O:	../port/error.h io.h
trap.$O:	/sys/include/tos.h /$objtype/include/ureg.h

devaoe.$O:	../port/error.h ../port/netif.h ../ip/ip.h etherif.h
devether.$O:	../port/error.h ../port/netif.h etherif.h
pci.$O pcidev.$O:	io.h
devrtc.$O:	../port/error.h
ether8169.$O:	../port/error.h ../port/ethermii.h ../port/netif.h io.h
ether8169.$O:	etherif.h io.h
ether82557.$O:	../port/netif.h
ether82557.$O:	etherif.h io.h
etherigbe.$O:	../port/error.h ../port/ethermii.h ../port/netif.h
etherigbe.$O:	etherif.h io.h
etherm10g.$O:	../port/error.h ../port/netif.h
etherm10g.$O:	etherif.h io.h
etherm10g.$O:	etherm10g2k.i etherm10g4k.i
i8259.$O:	io.h
kbd.$O:		../port/error.h io.h
pci.$O:		io.h
sdaoe.$O:	../port/error.h ../port/netif.h ../port/sd.h
sdaoe.$O:	../port/aoe.h etherif.h io.h
sdscsi.$O:	../port/error.h
sdahci.$O:	ahci.h io.h

random.$O:	../port/error.h
devacpi.$O: acpi.h
physalloc.$O: acpi.h

sipi.h:D:		l64sipi.$O
	$LD -o l64sipi.out -T0xfffffffff0003000 -R4 -l -s $prereq
	{echo 'uchar sipihandler[]={'
	 xd -1x l64sipi.out |
	 sed -e 's/^[0-9a-f]+ //'				\
	     -e '1,2d' -e '3s/^ .. .. .. .. .. .. .. ..//'	\
	     -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
	 echo '};'} > $target
