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 /Makefile | |
parent | 254ffbc869c2376e77ecc298dfd396f077e9d58a (diff) | |
download | sv-25108684fe235d4296c3cbc480298df209682586.tar.gz |
build system and some other stuff
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 14 insertions, 22 deletions
@@ -1,30 +1,22 @@ TARGET?=virt CROSS_COMPILE?=riscv64-unknown-elf- +GDB_PORT?=1234 +CFLAGS=-nostdlib -ffreestanding -mcmodel=medany -nostdinc -I${.CURDIR}/include +.export -BUILDDIR=build/${TARGET} -TARGETDIR=mainboard/${TARGET} +sys: ${SRC} lib/build/libc.a + @echo "building kernel" + (${MAKE} -C sys -e) -CFLAGS=-nostdlib -ffreestanding -mcmodel=medany +lib/build/libc.a: + @echo "building libc" + (${MAKE} -C lib -e) -.if !exists(${TARGETDIR}/conf/mainboard.mk) -.error 'ERROR: invalid target "${TARGET}"' -.else -.include <${TARGETDIR}/conf/mainboard.mk> -.endif - -all: ${BUILDDIR}/kernel.elf +debug: sys + (${MAKE} -C sys -e debug) clean: - rm -rf ${BUILDDIR} - -${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}\ - ${CFLAGS} -T kernel/lds/kernel.ld ${LDFLAGS}\ - -o $@ + (${MAKE} -C sys -e clean) + (${MAKE} -C lib -e clean) -.PHONY: all clean +.PHONY: sys debug all clean |