code: 9ferno

ref: b548687a8ed1d0a159c9d3f3f921d93bbb56908e
dir: /os/pc64/mkfile/

View raw version
<../../mkconfig

#Configurable parameters

CONF=pc64			#default configuration
CONFLIST=pc64
CLEANCONFLIST=pc64

SYSTARG=Inferno # $OSTARG
OBJTYPE=amd64 # 386
INSTALLDIR=$ROOT/Inferno/$OBJTYPE/	#path of directory where kernel is installed
#INSTALLDIR=/$OBJTYPE

# must match mem.h
REBOOTADDR=0x2000
APBOOTSTRAP=0x3000
KTZERO=0x200000

#end configurable parameters

<$ROOT/mkfiles/mkfile-$SYSTARG-$OBJTYPE	#set vars based on target system

<| $SHELLNAME ../port/mkdevlist $CONF	#sets $IP, $DEVS, $ETHERS, $VGAS, $PORT, $MISC, $LIBS, $OTHERS

OBJ=\
	l.$O\
	forth.$O\
	fpu.$O\
	portclock.$O\
	tod.$O\
	main.$O\
	memmap.$O\
	memory.$O\
	mmu.$O\
	trap.$O\
	bootargs.$O\
	$CONF.root.$O\
	$IP\
	$DEVS\
	$ETHERS\
	$LINKS\
	$PORT\
	$MISC\
	$OTHERS\

LIBNAMES=${LIBS:%=lib%.a}

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

# use the CFLAGS set in ../../mkfiles/mkfile-Inferno-amd64
CFLAGS=$CFLAGS -I$ROOT/libinterp -I$ROOT/libip -I../port
KERNDATE=`{$NDATE}

default:V: i$CONF i$CONF.acid

ETHERS=`{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'}

i$CONF: $OBJ $CONF.c $CONF.root.h $LIBNAMES
	$CC $CFLAGS '-DKERNDATE='$KERNDATE $CONF.c
	$LD -v -a -o $target -T$KTZERO -R4096 -l $OBJ $CONF.$O $LIBFILES > $target.loader
	$LD -o $target -T$KTZERO -R4096 -l $OBJ $CONF.$O $LIBFILES
	$KSIZE $target

install:V: i$CONF # i$CONF.acid
	cp i$CONF $INSTALLDIR/i$CONF
	test -d /amd64/ && cp i$CONF /amd64/i$CONF

# copies generated by the rule below
PCHEADERS=usbehci.h mp.h ahci.h yukdump.h vga.h audio.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

<../port/portmkfile

clock.$O:	$ROOT/Inferno/$OBJTYPE/include/ureg.h
devether.$O:	$ROOT/Inferno/$OBJTYPE/include/ureg.h
fault386.$O:	$ROOT/Inferno/$OBJTYPE/include/ureg.h
main.$O:	$ROOT/Inferno/$OBJTYPE/include/ureg.h rebootcode.i
trap.$O:	$ROOT/Inferno/$OBJTYPE/include/ureg.h

forth.$O:	forth.h bindings.s
forth.h:	forth.head.h mkdict.awk primitives-nasm.s words-nasm.s
	cp forth.head.h $target
	cat primitives-nasm.s words-nasm.s | ./mkdict.awk >> $target
devforth.$O: forth.h

CLEANEXTRA=words.s primitives.s forth.h

devether.$O $ETHERS:	etherif.h ../port/netif.h
$IP devip.$O:		../ip/ip.h
$VGA mouse.$O:		screen.h ../../include/memdraw.h

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

$SDEV:				../port/sd.h
sdiahci.$O:			ahci.h

ether8169.$O:			../port/ethermii.h

$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

# to be moved to port/interp 
bench.h:D: ../../module/bench.m
	rm -f $target && limbo -a -I../../module ../../module/bench.m > $target
benchmod.h:D:  ../../module/bench.m
	rm -f $target && limbo -t Bench -I../../module ../../module/bench.m > $target
devbench.$O: bench.h benchmod.h
$VGA screen.$O:	screen.h vga.h