diff options
author | stefan <stefan@s00.xyz> | 2023-04-04 06:01:50 +0000 |
---|---|---|
committer | stefan <stefan@s00.xyz> | 2023-04-04 06:01:50 +0000 |
commit | 25108684fe235d4296c3cbc480298df209682586 (patch) | |
tree | 59f051e13154764da2b98dfdc1ce66e363d801da /sys/Makefile | |
parent | 254ffbc869c2376e77ecc298dfd396f077e9d58a (diff) | |
download | sv-25108684fe235d4296c3cbc480298df209682586.tar.gz |
build system and some other stuff
Diffstat (limited to 'sys/Makefile')
-rw-r--r-- | sys/Makefile | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/Makefile b/sys/Makefile new file mode 100644 index 0000000..865a5a3 --- /dev/null +++ b/sys/Makefile @@ -0,0 +1,36 @@ +BUILDDIR=build/${TARGET} +TARGETDIR=../mainboard/${TARGET} + +.if !exists(${TARGETDIR}/conf/mainboard.conf) +.error 'ERROR: invalid target "${TARGET}"' +.else +.include <${TARGETDIR}/conf/mainboard.conf> +.endif + +SRC=\ + kern/entry.S\ + kern/init.c\ + kern/kernel_earlyprintf.c\ + kern/mm/kalloc.c\ + dev/sbi.c + +${BUILDDIR}/kernel.elf: ${SRC} + mkdir -p ${BUILDDIR} + ${CROSS_COMPILE}gcc ${SRC} \ + -Wl,--defsym=LOAD_ADDR=${LOAD_ADDR}\ + -Wl,--defsym=PAGE_SIZE=${PAGE_SIZE}\ + -Wl,--defsym=NPROC=${NPROC}\ + -DPAGE_SIZE=${PAGE_SIZE}\ + -I ./include\ + ${CFLAGS} -T kern/kernel.lds ${LDFLAGS}\ + -L../lib/${BUILDDIR}/\ + -l:libc.a\ + -o $@ + +debug: ${BUILDDIR}/kernel.elf + ${DEBUG} ${BUILDDIR}/kernel.elf + +clean: + rm -rf ${BUILDDIR} + +.PHONY: debug clean |