shithub: plan9front

ref: fdbe335d3ac0ba5307b2b5ab97d694af0d2256a7

View raw version
CONF=pc64
CONFLIST=pc64 pccpu64

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

# must match mem.h
KTZERO=0xffffffff80110000
APBOOTSTRAP=0xffffffff80007000
REBOOTADDR=0x11000

DEVS=`{rc ../port/mkdevlist $CONF}

PORT=\
	alarm.$O\
	alloc.$O\
	allocb.$O\
	auth.$O\
	cache.$O\
	chan.$O\
	dev.$O\
	edf.$O\
	fault.$O\
	iomap.$O\
	memmap.$O\
	page.$O\
	parse.$O\
	pgrp.$O\
	portclock.$O\
	print.$O\
	proc.$O\
	qio.$O\
	qlock.$O\
	random.$O\
	rdb.$O\
	rebootcmd.$O\
	segment.$O\
	syscallfmt.$O\
	sysfile.$O\
	sysproc.$O\
	taslock.$O\
	tod.$O\
	xalloc.$O\
	userinit.$O\

OBJ=\
	l.$O\
	cga.$O\
	fpu.$O\
	i8253.$O\
	i8259.$O\
	main.$O\
	memory.$O\
	mmu.$O\
	irq.$O\
	trap.$O\
	bootargs.$O\
	$CONF.root.$O\
	$CONF.rootc.$O\
	$DEVS\
	$PORT\

LIB=\
	/$objtype/lib/libmemlayer.a\
	/$objtype/lib/libmemdraw.a\
	/$objtype/lib/libdraw.a\
	/$objtype/lib/libip.a\
	/$objtype/lib/libsec.a\
	/$objtype/lib/libmp.a\
	/$objtype/lib/libc.a\
	/$objtype/lib/libfis.a\
	/$objtype/lib/libaml.a\
	/$objtype/lib/libdtracy.a\

ETHER=`{cd ../pc; echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
AUDIO=`{cd ../pc; echo devaudio.c audio*.c | sed 's/\.c/.'$O'/g'}
VGA=`{cd ../pc; echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
SDEV=`{cd ../pc; echo devsd.c sd*.c | sed 's/\.c/.'$O'/g'}

$p$CONF:	$OBJ $CONF.$O $LIB
	$LD -o $target -T$KTZERO -R4096 -l $prereq
	size $target

install:V:	$p$CONF
	cp $p$CONF /$objtype/
	for(i in $EXTRACOPIES)
		import $i / /n/$i && cp $p$CONF $p$CONF.gz /n/$i/$objtype/


# copies generated by the rule below
PCHEADERS=usbehci.h screen.h mp.h io.h ahci.h \
	yukdump.h

REPCH=`{echo $PCHEADERS | sed 's/\.h//g; s/ /|/g'}
^($REPCH)\.h:R:	../pc/\1.h
	cp $prereq .

REPCC=`{../port/mkfilelist ../pc}
^($REPCC)\.$O:R:	'../pc/\1.c'
	$CC $CFLAGS -I. -. ../pc/$stem1.c

<../boot/bootmkfile
<../port/portmkfile
<|../port/mkbootrules $CONF

l.$O rebootcode.$O apbootstrap.$O:	mem.h

$ETHER: 			../port/etherif.h ../port/netif.h
$AUDIO:				../port/audioif.h
ether8003.$O ether8390.$O:	ether8390.h
etheryuk.$O:			yukdump.h
$VGA mouse.$O:			screen.h /sys/include/memdraw.h
vgavesa.$O:			/386/include/ureg.h

mp.$O:				mp.h apbootstrap.i
apic.$O squidboy.$O:		mp.h
archmp.$O archacpi.$O:		mp.h

sd53c8xx.$O:			../pc/sd53c8xx.i
../pc/sd53c8xx.i:		../pc/sd53c8xx.n
	cd ../pc && mk sd53c8xx.i

$SDEV:				../port/sd.h
sdiahci.$O:			ahci.h
devaoe.$O sdaoe.$O:		../port/aoe.h
main.$O:			rebootcode.i

devusb.$O usbuhci.$O usbohci.$O usbehci.$O usbehcipc.$O usbxhci.$O: ../port/usb.h
usbehci.$O usbehcipc.$O:	usbehci.h

trap.$O main.$O:		/sys/include/tos.h

ether8169.$O:			../port/ethermii.h
etherdp83820.$O:		../port/ethermii.h
etherigbe.$O:			../port/ethermii.h
ethervgbe.$O:			../port/ethermii.h
ethervt6102.$O:			../port/ethermii.h
ethervt6105m.$O:		../port/ethermii.h

etheriwl.$O:			../port/wifi.h
etherwpi.$O:			../port/wifi.h
etherrt2860.$O: 		../port/wifi.h

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

$O.rebootcode:		rebootcode.$O
	$LD -l -R1 -s -o $target -T$REBOOTADDR $prereq
rebootcode.out:		$O.rebootcode
	dd -if $prereq(1) -of $target -bs 1 -iseek 40

$O.apbootstrap:		apbootstrap.$O
	$LD -l -R1 -s -o $target -T$APBOOTSTRAP $prereq
apbootstrap.out:	$O.apbootstrap
	dd -if $prereq(1) -of $target -bs 1 -iseek 40

sd53c8xx.i:	sd53c8xx.n
	aux/na $prereq > $target

acid:V:
	$CC -a -w main.c>acid

%.clean:V:
	rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* $O.rebootcode $O.apbootstrap $PCHEADERS