risc-v-tlm/tests/C/func3/Makefile

45 lines
994 B
Makefile
Raw Normal View History

2018-10-15 23:36:07 +08:00
TARGET = func3
TARGET_ARCH=riscv32
2019-01-10 06:03:08 +08:00
CC = riscv32-unknown-elf-gcc
2018-10-15 23:36:07 +08:00
2019-01-10 06:03:08 +08:00
# compiling flags here
CFLAGS = -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nosys.specs
2018-10-15 23:36:07 +08:00
LIBS = $(EXTRA_LIBS)
# change these to proper directories where each file should be
SRCDIR = ./
OBJDIR = .
BINDIR = ./
INCDIR = -I.
LIBDIR = -L.
SOURCES := $(wildcard $(SRCDIR)/*.c)
INCLUDES := $(wildcard $(INCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
rm = rm -f
$(BINDIR)/$(TARGET): $(OBJECTS)
2019-01-10 06:03:08 +08:00
# $(LINKER) $(OBJECTS) $(LDFLAGS) $(LIBS) $(LIBDIR) -o $@
2020-07-10 22:48:29 +08:00
riscv32-unknown-elf-objdump -d $< > dump
2018-10-15 23:36:07 +08:00
objcopy -Oihex $< $(TARGET).hex
2019-01-10 06:03:08 +08:00
@echo "Linking complete!"
2018-10-15 23:36:07 +08:00
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@echo "Compiling "$<" ..."
# $(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
$(CC) $(CFLAGS) $(INCDIR) $< -o $@
@echo "Done!"
.PHONY: clean
clean:
@$(rm) $(OBJECTS) *.hex dump
@echo "Cleanup complete!"
.PHONY: remove
remove: clean
@$(rm) $(BINDIR)/$(TARGET)
@echo "Executable removed!"