summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-04 06:01:50 +0000
committerstefan <stefan@s00.xyz>2023-04-04 06:01:50 +0000
commit25108684fe235d4296c3cbc480298df209682586 (patch)
tree59f051e13154764da2b98dfdc1ce66e363d801da /Makefile
parent254ffbc869c2376e77ecc298dfd396f077e9d58a (diff)
downloadsv-25108684fe235d4296c3cbc480298df209682586.tar.gz
build system and some other stuff
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 14 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 3c2a981..e683c86 100644
--- a/Makefile
+++ b/Makefile
@@ -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