diff options
Diffstat (limited to 'devkit/Makefile')
-rw-r--r-- | devkit/Makefile | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/devkit/Makefile b/devkit/Makefile new file mode 100644 index 0000000..3890bc0 --- /dev/null +++ b/devkit/Makefile @@ -0,0 +1,39 @@ +SOURCES = $(wildcard *.c) +OBJECTS = $(patsubst %.c,obj/%.o,$(SOURCES)) +TARGETS = $(patsubst %.c,bin/%,$(SOURCES)) + +CC = riscv64-unknown-elf-gcc + +COMMONFLAGS += -Wall +# COMMONFLAGS += -Werror + +COMMONFLAGS += -O3 + +COMMONFLAGS += -static +# Use the 32-bit variant of RISC-V, with no floating-point support. +COMMONFLAGS += -m32 -msoft-float -march=RV32I + +# Add debugging symbols +COMMONFLAGS += -g3 + +# Use C11. +COMMONFLAGS += -std=c11 + +# Link options: disable system libraries, and use the program +# layout in test.x. +LINKFLAGS = $(FLAGS) -nostartfiles -nodefaultlibs +LINKFLAGS += -Wl,-T,cacheracer.x + +# Merge the common flags and the per-file FLAGS_xxx settings. +FLAGS = $(COMMONFLAGS) $(FLAGS_$(basename $(notdir $@))) + +all: $(TARGETS) + +$(TARGETS): bin/%: obj/%.o + $(CC) $(LINKFLAGS) $< -o $@ + +$(OBJECTS): obj/%.o: %.c + $(CC) $(FLAGS) -c $< -o $@ + +clean: + rm -f obj/*.o bin/* |