diff --git a/nemu/configs/defconfig b/nemu/configs/rv32_defconfig similarity index 100% rename from nemu/configs/defconfig rename to nemu/configs/rv32_defconfig diff --git a/nemu/flake.nix b/nemu/flake.nix index 64632c6..a137c83 100644 --- a/nemu/flake.nix +++ b/nemu/flake.nix @@ -50,13 +50,21 @@ libllvm ]; - bulidPhase = '' - make defconfig + configurePhase = '' + echo NEMU_HOME=$NEMU_HOME + make -f scripts/config.mk rv32_defconfig + ''; + + buildPhase = '' make app ''; installPhase = '' - cp + make install + ''; + + checkPhase = '' + make test ''; NEMU_HOME = src; diff --git a/nemu/scripts/build.mk b/nemu/scripts/build.mk index 55edd75..6d8c623 100644 --- a/nemu/scripts/build.mk +++ b/nemu/scripts/build.mk @@ -43,12 +43,12 @@ $(OBJ_DIR)/%.o: %.cc $(OBJ_DIR)/%.tag.c: %.y @echo + YACC $< @mkdir -p $(dir $@) - @$(YACC) $(YFLAGS) --header=$(<:.y=.h) -o $@ $< + @$(YACC) $(YFLAGS) --header=$(dir %)/$(<:.y=.h) -o $@ $< $(OBJ_DIR)/%.yy.c: %.l $(OBJ_DIR)/%.tag.c @echo + LEX $< @mkdir -p $(dir $@) - @$(LEX) $(LFLAGS) --header=$(<:.l=_lex.h) -o $@ $< + @$(LEX) $(LFLAGS) --header=$(dir %)/$(<:.l=_lex.h) -o $@ $< $(OBJ_DIR)/%.tag.o: $(OBJ_DIR)/%.tag.c @echo + CC $< diff --git a/nemu/src/monitor/sdb/filelist.mk b/nemu/src/monitor/sdb/filelist.mk index 394a8a3..440694a 100644 --- a/nemu/src/monitor/sdb/filelist.mk +++ b/nemu/src/monitor/sdb/filelist.mk @@ -1,3 +1,3 @@ SRCS-y += src/monitor/sdb/addrexp.tag.c src/monitor/sdb/addrexp.yy.c -INC_PATH += src/monitor/sdb +INC_PATH += $(OBJ_DIR)/src/monitor/sdb LFLAGS += -DYY_NO_UNPUT -DYY_NO_INPUT