diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-12 09:09:44 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-12 09:09:44 -0700 |
commit | ef85921528829c4258195c1b6a2b4e6ec8a912ca (patch) | |
tree | 5afbc482d04d685d3977dad49d3de273751c58e9 /devkit/Makefile | |
parent | 73a1c6f06224a7e892c90186ff15567e11ced31c (diff) |
Add dev header/makefile/linker script
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/* |