Updated makefile
This commit is contained in:
parent
f1a03b96a3
commit
765f5b8328
@ -6,8 +6,16 @@ include $(TOPDIR)/Makefile.config
|
||||
#
|
||||
dumps:
|
||||
$(MAKE) dumps -C riscv_instructions/
|
||||
mkdir -p ${TOPDIR}/target
|
||||
find . -name '*.dump' -exec mv {} ${TOPDIR}/target \;
|
||||
mkdir -p ${TOPDIR}/target/dumps/
|
||||
find . -name '*.dump' -exec mv {} ${TOPDIR}/target/dumps/ \;
|
||||
|
||||
user_lib:
|
||||
$(MAKE) -C userlib/
|
||||
|
||||
tests: user_lib
|
||||
$(MAKE) tests -C riscv_instructions/
|
||||
mkdir -p ${TOPDIR}/target/guac/
|
||||
find . -name '*.guac' -exec mv {} ${TOPDIR}/target/guac/ \;
|
||||
|
||||
clean:
|
||||
rm -rf $(TOPDIR)/target
|
38
test_programs/Makefile.tests
Normal file
38
test_programs/Makefile.tests
Normal file
@ -0,0 +1,38 @@
|
||||
include $(TOPDIR)/Makefile.config
|
||||
USERLIB = $(TOPDIR)/userlib
|
||||
INCPATH += -I$(TOPDIR) -I$(USERLIB)
|
||||
LDFLAGS = $(RISCV_LDFLAGS) -T $(USERLIB)/ldscript.lds
|
||||
ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH)
|
||||
CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
|
||||
|
||||
# Rules
|
||||
%.o: %.s
|
||||
$(RISCV_AS) $(ASFLAGS) -c $<
|
||||
|
||||
%.o: %.c
|
||||
$(RISCV_GCC) $(CFLAGS) -c $<
|
||||
|
||||
%.dump: %.o
|
||||
$(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@
|
||||
|
||||
%.guac: %.o
|
||||
$(RISCV_LD) $(LDFLAGS) $+ -o $@
|
||||
|
||||
# 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 $@'
|
||||
|
||||
# Targets
|
||||
#clean:
|
||||
# rm -rf *.o 2> /dev/null
|
||||
# rm -rf *.dump 2> /dev/null
|
||||
# rm -rf *.guac 2> /dev/null
|
@ -2,3 +2,8 @@ dumps:
|
||||
make dumps -C boolean_logic/
|
||||
make dumps -C jump_instructions/
|
||||
make dumps -C simple_arithmetics/
|
||||
|
||||
tests:
|
||||
make tests -C boolean_logic/
|
||||
make tests -C jump_instructions/
|
||||
make tests -C simple_arithmetics/
|
@ -1,4 +1,9 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Makefile.dumps
|
||||
include $(TOPDIR)/Makefile.tests
|
||||
|
||||
dumps: comparisons.dump if.dump switch.dump
|
||||
|
||||
tests: comparisons.guac if.guac switch.guac
|
||||
|
||||
# Dependances
|
||||
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o
|
@ -1,4 +1,6 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Makefile.dumps
|
||||
include $(TOPDIR)/Makefile.tests
|
||||
|
||||
dumps: jump.dump ret.dump
|
||||
|
||||
tests: jump.guac ret.guac
|
@ -1,4 +1,6 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/Makefile.dumps
|
||||
include $(TOPDIR)/Makefile.tests
|
||||
|
||||
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
|
@ -1,3 +1,6 @@
|
||||
#include "userlib/syscall.h"
|
||||
#include "userlib/libnachos.h"
|
||||
|
||||
// EXPECTS TWO VARIABLES WITH A VALUE OF UNSIGNED 1
|
||||
int main() {
|
||||
unsigned int x = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user