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

5
test/riscv_instructions/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*
!.gitignore
!*.c
!*.md
!**/Makefile

View File

@ -1,7 +1,7 @@
build: build:
make build -C boolean_logic/ make build -C boolean_logic/
# make build -C jump_instructions/ make build -C jump_instructions/
# make build -C simple_arithmetics/ make build -C simple_arithmetics/
dumps: dumps:
make dumps -C boolean_logic/ make dumps -C boolean_logic/

View File

@ -1,11 +1,17 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
build: comparisons if switch PROGRAMS = comparisons if switch
build: $(PROGRAMS)
dumps: comparisons.dump if.dump switch.dump dumps: comparisons.dump if.dump switch.dump
tests: comparisons.guac if.guac switch.guac tests: comparisons.guac if.guac switch.guac
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
clean:
$(RM) comparisons comparisons.o if if.o
# Dependances # Dependances
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o $(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o

View File

@ -1,6 +1,15 @@
TOPDIR = ../.. PROGRAMS = jump ret
include $(TOPDIR)/Makefile.tests
build: $(PROGRAMS)
dumps: jump.dump ret.dump dumps: jump.dump ret.dump
tests: jump.guac ret.guac tests: jump.guac ret.guac
clean:
$(RM) jump jump.o ret ret.o
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o

View File

@ -1,6 +1,16 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests PROGRAMS = unsigned_addition unsigned_division unsigned_multiplication unsigned_substraction
build: $(PROGRAMS)
dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump
tests: unsigned_addition.guac unsigned_division.guac unsigned_multiplication.guac unsigned_substraction.guac tests: unsigned_addition.guac unsigned_division.guac unsigned_multiplication.guac unsigned_substraction.guac
clean:
$(RM) unsigned_addition unsigned_addition.o unsigned_division unsigned_division.o unsigned_multiplication unsigned_multiplication.o unsigned_substraction unsigned_substraction.o
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o