shithub: p9-stm32-example-os

ref: f801657f77f3923ec2388c25bdcb036c8019ba89
dir: /mkfile/

View raw version
</sys/src/mkfile.proto
<mkconfig

BIN=bin
loadaddr=0x08000000
dataaddr=0x20000000

LIBS=\
	kern\

TARG=\
	$BIN/kernel\
	$BIN/kernel.asm\

OFILES=\
	div-thumb.$O\
	thumb2.$O\
	clock.$O\
	error.$O\
	dma.$O\
	gpio.$O\
	uart.$O\
	alloc.$O\
	sub.$O\
	print.$O\
	main.$O\
	trap.$O\

PROGFILES=\
	prog/init0.$O\
	prog/kconsole.$O\
	prog/devicefs.$O\
	prog/dma2q.$O\
	prog/happy.$O\

PORTFILES=\
	port/alarm.$O\
	port/allocb.$O\
#	port/chan.$O\
	port/compat.$O\
#	port/dev.$O\
#	port/devcons.$O\
	port/env.$O\
#	port/devmnt.$O\
#	port/devroot.$O\
#	port/fpi.$O\
#	port/fpimem.$O\
#	port/latin1.$O\
	port/mul64fract.$O\
#	port/nocache.$O\
#	port/parse.$O\
#	port/pgrp.$O\
	port/portclock.$O\
	port/proc.$O\
	port/qio.$O\
	port/qlock.$O\
#	port/sysfile.$O\
	port/taslock.$O\
	port/tod.$O\

HFILES=\
	include/stdint.h\
	include/ureg.h\
	include/core_cm3.h\
	include/system_stm32f1xx.h\
	include/stm32f103xb.h\
	libkern/kern.h\
	libkern/fcall.h\
	port/portdat.h\
	port/portfns.h\
	thumb2.h\
	handlers.h\
	mem.h\
	dat.h\
	fns.h\
	debug.h\

LIBFILES=${LIBS:%=bin/lib%.a}
PORTOFILES=${PORTFILES:port/%=%}
PROGOFILES=${PROGFILES:prog/%=%}

all:V: kernel

bin:V:
	mkdir -p bin

clean:V:
	rm -rf $TARG *.$O

%.$O:	%.s
	$AS $ASFLAGS $stem.s

%.$O:	%.c
	$CC $CFLAGS $stem.c

%.$O:	$HFILES

kernel.asm kernel: l.$O $OFILES $PORTFILES $PROGFILES $LIBFILES
	$LD -a $LDFLAGS -o $BIN/kernel -R0 -T$loadaddr -D$dataaddr l.$O $OFILES $PORTOFILES $PROGOFILES $LIBFILES >$BIN/kernel.asm


$BIN/%:	%
	cp $stem $BIN/$stem