diff --git a/nemu/Makefile b/nemu/Makefile index 03c8a4e..0a52cf2 100644 --- a/nemu/Makefile +++ b/nemu/Makefile @@ -49,6 +49,15 @@ CFLAGS_TRACE += -DITRACE_COND=$(if $(CONFIG_ITRACE_COND),$(call remove_quote,$(C CFLAGS += $(CFLAGS_BUILD) $(CFLAGS_TRACE) -D__GUEST_ISA__=$(GUEST_ISA) LDFLAGS += $(CFLAGS_BUILD) +include $(NEMU_HOME)/tests/Makefile +all-tests: TEST_OBJS = $(filter-out $(OBJ_DIR)/src/nemu-main.o, $(OBJS)) +all-tests: CFLAGS += $(shell pkg-config --cflags check) +all-tests: LDFLAGS += $(shell pkg-config --libs check) +all-tests: $(TEST_SRCS:%.c=$(OBJ_DIR)/%) + +test: all-tests + @$(OBJ_DIR)/tests/expr_test + # Include rules for menuconfig include $(NEMU_HOME)/scripts/config.mk @@ -61,12 +70,3 @@ include $(NEMU_HOME)/scripts/native.mk endif .PHONY: test - -include $(NEMU_HOME)/tests/Makefile -all-tests: TEST_OBJS = $(filter-out $(OBJ_DIR)/src/nemu-main.o, $(OBJS)) -all-tests: CFLAGS += $(shell pkg-config --cflags check) -all-tests: LDFLAGS += $(shell pkg-config --libs check) -all-tests: $(TEST_SRCS:%.c=$(OBJ_DIR)/%) - -test: all-tests - @$(OBJ_DIR)/tests/expr_test diff --git a/nemu/tests/Makefile b/nemu/tests/Makefile index 386d705..6804b41 100644 --- a/nemu/tests/Makefile +++ b/nemu/tests/Makefile @@ -1,6 +1,5 @@ TEST_SRCS += tests/expr_test.c YACC = bison -INC_PATH += $(NEMU_HOME)/src/isa/$(GUEST_ISA)/local-include $(OBJ_DIR)/%: %.c $(TEST_OBJS) app @mkdir -p $(dir $@)