shithub: riscv

ref: 5af0a7ce737f9f42d5fb153a84aa986850c97d62
dir: /sys/src/9/pc64/mkfile/

View raw version
CONF=pc64
CONFLIST=pc64 pccpu64

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

KTZERO=0xffffffff80110000
APBOOTSTRAP=0xffffffff80003000
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\
	rdb.$O\
	rebootcmd.$O\
	segment.$O\
	swap.$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\
	pcrandom.$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\

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=wifi.h usbehci.h screen.h etherif.h ethermii.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 apbootstrap.$O:		mem.h

$ETHER: 			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

archmp.$O mp.$O:		apbootstrap.h
apic.$O archmp.$O mp.$O:	mp.h
squidboy.$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: ../port/usb.h
usbehci.$O usbehcipc.$O:	usbehci.h

trap.$O:			/sys/include/tos.h
ethermii.$O:			ethermii.h
etheriwl.$O:			wifi.h
etherwpi.$O:			wifi.h
etherrt2860.$O: 		wifi.h
wifi.$O:			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:	rebootcode.s
	$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:	apbootstrap.s
	$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