burritos/test/Makefile.tests

47 lines
985 B
Makefile
Raw Normal View History

2023-03-08 13:02:03 +01:00
include $(TOPDIR)/Makefile.config
2023-03-28 19:35:24 +02:00
2023-03-08 13:02:03 +01:00
USERLIB = $(TOPDIR)/userlib
2023-03-28 19:35:24 +02:00
AS = $(RISCV_AS) -c
GCC = $(RISCV_GCC)
LD = $(RISCV_LD)
2023-03-08 13:02:03 +01:00
INCPATH += -I$(TOPDIR) -I$(USERLIB)
LDFLAGS = $(RISCV_LDFLAGS) -T $(USERLIB)/ldscript.lds
ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH)
CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
# Rules
%.o: %.s
2023-03-28 19:35:24 +02:00
$(AS) $(ASFLAGS) -c $<
2023-03-08 13:02:03 +01:00
%.o: %.c
2023-03-28 19:35:24 +02:00
$(GCC) $(CFLAGS) -c $<
2023-03-08 13:02:03 +01:00
%.dump: %.o
$(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@
%.guac: %.o
2023-03-28 19:35:24 +02:00
$(LD) $(LDFLAGS) $+ -o $@
2023-03-08 13:02:03 +01:00
# Dependencies
.%.d: %.s
@echo Generating dependencies for $<
@$(SHELL) -ec '$(GCC) -x assembler-with-cpp -M $(ASFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
.%.d: %.c
@echo Generating dependencies for $<
@$(SHELL) -ec '$(GCC) -M $(CFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
2023-03-28 19:35:24 +02:00
$(PROGRAMS):
$(LD) $(LDFLAGS) $+ -o $@
2023-03-08 13:02:03 +01:00
# Targets
#clean:
# rm -rf *.o 2> /dev/null
# rm -rf *.dump 2> /dev/null
# rm -rf *.guac 2> /dev/null