From e57e2391ee691fa43755aeb3b7271a77e9978d28 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Sat, 13 Jan 2024 14:15:08 +0800 Subject: [PATCH] =?UTF-8?q?>=20compile=20NEMU=20ysyx=5F22040000=20?= =?UTF-8?q?=E6=9D=8E=E5=BF=83=E6=9D=A8=20Linux=20calcite=206.1.71=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Jan=20=205=2014:18:41=20UT?= =?UTF-8?q?C=202024=20x86=5F64=20GNU/Linux=20=2014:15:08=20=20up=20=20=203?= =?UTF-8?q?:09,=20=202=20users,=20=20load=20average:=200.44,=200.56,=200.6?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/configs/{defconfig => rv32_defconfig} | 0 nemu/flake.nix | 14 +++++++++++--- nemu/scripts/build.mk | 4 ++-- nemu/src/monitor/sdb/filelist.mk | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) rename nemu/configs/{defconfig => rv32_defconfig} (100%) 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