shithub: riscv

ref: b56909157f0cd2491cd2918f7923676f22b5707c
dir: /sys/src/9/pc64/mkfile/

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\
	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\

OBJ=\
	l.$O\
	cga.$O\
	i8253.$O\
	i8259.$O\
	main.$O\
	memory.$O\
	mmu.$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:	$CONF.c $OBJ $LIB
	$CC $CFLAGS '-DKERNDATE='`{date -n} $CONF.c
	$LD -o $target -T$KTZERO -R4096 -l $OBJ $CONF.$O $LIB
	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:				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.h 
apic.$O squidboy.$O:		mp.h
archmp.$O archacpi.$O:		mp.h

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

main.$O:			init.h reboot.h

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

trap.$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

init.h:D:		../port/initcode.c ../pc/init9.c
	$CC ../port/initcode.c
	$CC ../pc/init9.c
	$LD -l -R1 -s -o init.out init9.$O initcode.$O /$objtype/lib/libc.a
	{echo 'uchar initcode[]={'
	 xd -1x <init.out |
		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
	 echo '};'} > init.h

reboot.h:D:	rebootcode.s mem.h
	$AS rebootcode.s
	$LD -l -R1 -s -o reboot.out -T$REBOOTADDR rebootcode.$O
	{echo 'uchar rebootcode[]={'
	 dd -if reboot.out -bs 1 -iseek 40 | 
	 xd -1x |
	 sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
	 echo '};'} > $target

apbootstrap.h:D:	apbootstrap.s mem.h
	$AS apbootstrap.s
	$LD -l -R1 -s -o apbootstrap.out -T$APBOOTSTRAP apbootstrap.$O
	{echo 'uchar apbootstrap[]={'
	 dd -if apbootstrap.out -bs 1 -iseek 40 | 
	 xd -1x |
	 sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
	 echo '};'} > $target

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.* apbootstrap.h reboot.h init.h $PCHEADERS