From 19c34a861be011a0e1af21034d6b8ee105893a45 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Thu, 18 Nov 2021 01:51:43 +0000 Subject: [PATCH] slightly optimize sw build --- build.sh | 4 ++-- docker_build.sh | 2 +- sw/riscv/Makefile | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 0038ea3..01e1a29 100755 --- a/build.sh +++ b/build.sh @@ -39,7 +39,7 @@ build_n64 () { if [ "$FORCE_CLEAN" = true ]; then make clean fi - make all + make all -j popd BUILT_N64=true @@ -50,7 +50,7 @@ build_riscv () { pushd sw/riscv if [ "$FORCE_CLEAN" = true ]; then - make clean + make clean -j fi make all popd diff --git a/docker_build.sh b/docker_build.sh index f6f4d4c..b86f26a 100755 --- a/docker_build.sh +++ b/docker_build.sh @@ -1,7 +1,7 @@ #!/bin/bash docker run \ - --rm \ + --user $(id -u):$(id -g) \ --mount type=bind,src="$(pwd)",target="/workdir" \ ghcr.io/polprzewodnikowy/sc64env:v1.2 \ ./build.sh $@ diff --git a/sw/riscv/Makefile b/sw/riscv/Makefile index 6f1fdfd..c7a619c 100644 --- a/sw/riscv/Makefile +++ b/sw/riscv/Makefile @@ -1,11 +1,10 @@ TOOLCHAIN = riscv32-unknown-elf- CC = $(TOOLCHAIN)gcc -AS = $(TOOLCHAIN)as OBJCOPY = $(TOOLCHAIN)objcopy OBJDUMP = $(TOOLCHAIN)objdump SIZE = $(TOOLCHAIN)size -FLAGS = -mabi=ilp32 -march=rv32i +FLAGS = -mabi=ilp32 -march=rv32i $(USER_FLAGS) CFLAGS = -Os -Wall -ffunction-sections -fdata-sections -ffreestanding -MMD -MP LDFLAGS = -nostartfiles -Wl,--gc-sections @@ -25,10 +24,10 @@ $(@info $(shell mkdir -p ./$(BUILD_DIR) &> /dev/null)) all: $(BUILD_DIR)/governor.hex $(BUILD_DIR)/%.c.o: %.c - $(CC) $(FLAGS) $(CFLAGS) $(USER_FLAGS) -c $< -o $@ + $(CC) $(FLAGS) $(CFLAGS) -c $< -o $@ $(BUILD_DIR)/%.S.o: %.S - $(AS) $(FLAGS) $(ASFLAGS) -c $< -o $@ + $(CC) -x assembler $(FLAGS) $(CFLAGS) -c $< -o $@ $(BUILD_DIR)/governor.hex: $(OBJS) SC64.ld $(CC) $(FLAGS) $(LDFLAGS) -TSC64.ld $(OBJS) -o $(BUILD_DIR)/governor.elf