Fix build makefiles

This commit is contained in:
Quentin Legot
2023-03-28 19:35:24 +02:00
parent 7a32aa503c
commit e170256c9b
6 changed files with 53 additions and 14 deletions

View File

@@ -1,5 +1,11 @@
include $(TOPDIR)/Makefile.config
USERLIB = $(TOPDIR)/userlib
AS = $(RISCV_AS) -c
GCC = $(RISCV_GCC)
LD = $(RISCV_LD)
INCPATH += -I$(TOPDIR) -I$(USERLIB)
LDFLAGS = $(RISCV_LDFLAGS) -T $(USERLIB)/ldscript.lds
ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH)
@@ -7,16 +13,16 @@ CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
# Rules
%.o: %.s
$(RISCV_AS) $(ASFLAGS) -c $<
$(AS) $(ASFLAGS) -c $<
%.o: %.c
$(RISCV_GCC) $(CFLAGS) -c $<
$(GCC) $(CFLAGS) -c $<
%.dump: %.o
$(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@
%.guac: %.o
$(RISCV_LD) $(LDFLAGS) $+ -o $@
$(LD) $(LDFLAGS) $+ -o $@
# Dependencies
.%.d: %.s
@@ -31,6 +37,9 @@ CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
$(PROGRAMS):
$(LD) $(LDFLAGS) $+ -o $@
# Targets
#clean:
# rm -rf *.o 2> /dev/null