From ef85921528829c4258195c1b6a2b4e6ec8a912ca Mon Sep 17 00:00:00 2001 From: David Li Date: Tue, 12 Jan 2016 09:09:44 -0700 Subject: Add dev header/makefile/linker script --- devkit/Makefile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 devkit/Makefile (limited to 'devkit/Makefile') 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/* -- cgit v1.2.3