From 346c0c9f4916bfe42108f79478bfddadc0f14cae Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 5 May 2022 23:04:21 +0000 Subject: apos compiles on netbsd with LLVM=1 + Turns out I had a dumb debugging echo that was messing up my variables. Oh well. + I'd still like to get riscv64-unknown-elf-gcc to compile, currently I've only managed with riscv64--netbsd-gcc, weird. Also, I have learned that BSD make doesn't use $< for some reason, so all rules should reference the full file name henceforth. BSD make does use $@, but for consistency I did away with it as well. --- .gitignore | 2 +- Makefile | 10 +++++----- scripts/gen-deps | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 7c1c102..62e021c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ *.elf *.ld include/apos/gen/* -include/arch/*/gen/* +arch/*/include/gen/* deps.mk *.img diff --git a/Makefile b/Makefile index 7d7e04d..5f3eb47 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ GENELF = $(COMPILER) $(DEBUGFLAGS)\ GENLINK = $(COMPILER) $(COMPILE_FLAGS) $(PREPROCESS) $(DEPFLAGS) $(INCLUDE_FLAGS) STRIPLINK = sed -n '/^[^\#]/p' -KERN_SIZE = wc -c kernel.bin | cut -d ' ' -f 1 +KERN_SIZE = wc -c kernel.bin | awk '{print $$1}' KERN_INFO = sed "s//$$($(KERN_SIZE))/" KERNEL_LINK := arch/$(ARCH)/conf/kernel-link @@ -79,16 +79,16 @@ $(INIT_LD): kernel.bin lint: $(INIT_OBJECTS:.o=.o.l) $(KERNEL_OBJECTS:.o=.o.l) init.elf: $(INIT_OBJECTS) $(INIT_LD) - $(GENELF) -T $(INIT_LD) $(INIT_OBJECTS) -o $@ $(LINK_FLAGS) + $(GENELF) -T $(INIT_LD) $(INIT_OBJECTS) -o init.elf $(LINK_FLAGS) kernel.elf: $(KERNEL_OBJECTS) $(KERNEL_LD) - $(GENELF) -T $(KERNEL_LD) $(KERNEL_OBJECTS) -o $@ $(LINK_FLAGS) + $(GENELF) -T $(KERNEL_LD) $(KERNEL_OBJECTS) -o kernel.elf $(LINK_FLAGS) init.bin: init.elf - $(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ + $(OBJCOPY) $(OBJCOPY_FLAGS) init.elf init.bin kernel.bin: kernel.elf - $(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ + $(OBJCOPY) $(OBJCOPY_FLAGS) kernel.elf kernel.bin apos.bin: init.bin kernel.bin cat init.bin kernel.bin > apos.bin diff --git a/scripts/gen-deps b/scripts/gen-deps index 0dab1ea..674ead6 100755 --- a/scripts/gen-deps +++ b/scripts/gen-deps @@ -47,7 +47,6 @@ case "${2}" in func=genlink esac -echo "${3}" # create all subdirectories mkdir -p $(echo "${3}" | xargs -n 1 dirname | uniq | sed 's|^|build/|g') -- cgit v1.3