> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
 17:40:39  up  17:56,  2 users,  load average: 0.54, 0.46, 0.45
This commit is contained in:
tracer-ysyx 2024-01-12 17:40:39 +08:00 committed by xinyangli
parent 3ed5a7e2c2
commit 1b4338bb0f
5 changed files with 62 additions and 51 deletions

View file

@ -67,7 +67,7 @@
/* First part of user prologue. */ /* First part of user prologue. */
#line 1 "src/monitor/sdb/addr-exp.y" #line 1 "src/monitor/sdb/addrexp.y"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -76,7 +76,7 @@
fprintf(stderr, "Error: %s\n", s); fprintf(stderr, "Error: %s\n", s);
} }
#line 80 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 80 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
# ifndef YY_CAST # ifndef YY_CAST
# ifdef __cplusplus # ifdef __cplusplus
@ -99,7 +99,7 @@
# endif # endif
# endif # endif
#include "addr-exp.h" #include "addrexp.h"
/* Symbol kind. */ /* Symbol kind. */
enum yysymbol_kind_t enum yysymbol_kind_t
{ {
@ -1074,73 +1074,73 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 2: /* input: expression */ case 2: /* input: expression */
#line 15 "src/monitor/sdb/addr-exp.y" #line 15 "src/monitor/sdb/addrexp.y"
{ printf("Final Result: %d\n", yyvsp[0]); } { printf("Final Result: %d\n", yyvsp[0]); }
#line 1080 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1080 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 3: /* expression: term */ case 3: /* expression: term */
#line 19 "src/monitor/sdb/addr-exp.y" #line 19 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 1086 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1086 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 4: /* expression: expression '+' term */ case 4: /* expression: expression '+' term */
#line 20 "src/monitor/sdb/addr-exp.y" #line 20 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] + yyvsp[0]; } { yyval = yyvsp[-2] + yyvsp[0]; }
#line 1092 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1092 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 5: /* expression: expression '-' term */ case 5: /* expression: expression '-' term */
#line 21 "src/monitor/sdb/addr-exp.y" #line 21 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] - yyvsp[0]; } { yyval = yyvsp[-2] - yyvsp[0]; }
#line 1098 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1098 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 6: /* term: factor */ case 6: /* term: factor */
#line 25 "src/monitor/sdb/addr-exp.y" #line 25 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 1104 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1104 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 7: /* term: term '*' factor */ case 7: /* term: term '*' factor */
#line 26 "src/monitor/sdb/addr-exp.y" #line 26 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] * yyvsp[0]; } { yyval = yyvsp[-2] * yyvsp[0]; }
#line 1110 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1110 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 8: /* term: term '/' factor */ case 8: /* term: term '/' factor */
#line 27 "src/monitor/sdb/addr-exp.y" #line 27 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] / yyvsp[0]; } { yyval = yyvsp[-2] / yyvsp[0]; }
#line 1116 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1116 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 9: /* factor: NUMBER */ case 9: /* factor: NUMBER */
#line 31 "src/monitor/sdb/addr-exp.y" #line 31 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 1122 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1122 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 10: /* factor: HEX_NUMBER */ case 10: /* factor: HEX_NUMBER */
#line 32 "src/monitor/sdb/addr-exp.y" #line 32 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; } { yyval = yyvsp[0]; }
#line 1128 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1128 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 11: /* factor: '-' factor */ case 11: /* factor: '-' factor */
#line 33 "src/monitor/sdb/addr-exp.y" #line 33 "src/monitor/sdb/addrexp.y"
{ yyval = -yyvsp[0]; } { yyval = -yyvsp[0]; }
#line 1134 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1134 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
case 12: /* factor: '(' expression ')' */ case 12: /* factor: '(' expression ')' */
#line 34 "src/monitor/sdb/addr-exp.y" #line 34 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-1]; } { yyval = yyvsp[-1]; }
#line 1140 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1140 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break; break;
#line 1144 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c" #line 1144 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
default: break; default: break;
} }
@ -1333,5 +1333,5 @@ yyreturnlab:
return yyresult; return yyresult;
} }
#line 37 "src/monitor/sdb/addr-exp.y" #line 37 "src/monitor/sdb/addrexp.y"

View file

@ -1,6 +1,6 @@
#line 1 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 1 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
#line 3 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 3 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
#define YY_NO_UNPUT 1 #define YY_NO_UNPUT 1
#define YY_NO_INPUT 1 #define YY_NO_INPUT 1
@ -449,11 +449,11 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0 #define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET #define YY_RESTORE_YY_MORE_OFFSET
char *yytext; char *yytext;
#line 1 "src/monitor/sdb/addr-lex.l" #line 1 "src/monitor/sdb/addrexp.l"
#line 2 "src/monitor/sdb/addr-lex.l" #line 2 "src/monitor/sdb/addrexp.l"
#include <addr-exp.h> #include <addrexp.h>
#line 455 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 455 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
#line 456 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 456 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
#define INITIAL 0 #define INITIAL 0
@ -670,10 +670,10 @@ YY_DECL
} }
{ {
#line 6 "src/monitor/sdb/addr-lex.l" #line 6 "src/monitor/sdb/addrexp.l"
#line 676 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 676 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{ {
@ -732,35 +732,35 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 8 "src/monitor/sdb/addr-lex.l" #line 8 "src/monitor/sdb/addrexp.l"
{ yylval = strtol(yytext, NULL, 16); return HEX_NUMBER; } { yylval = strtol(yytext, NULL, 16); return HEX_NUMBER; }
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 9 "src/monitor/sdb/addr-lex.l" #line 9 "src/monitor/sdb/addrexp.l"
{ yylval = atoi(yytext); return NUMBER; } { yylval = atoi(yytext); return NUMBER; }
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 10 "src/monitor/sdb/addr-lex.l" #line 10 "src/monitor/sdb/addrexp.l"
{ return *yytext; } { return *yytext; }
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 11 "src/monitor/sdb/addr-lex.l" #line 11 "src/monitor/sdb/addrexp.l"
{ } { }
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 12 "src/monitor/sdb/addr-lex.l" #line 12 "src/monitor/sdb/addrexp.l"
{ printf("Unexpected character: %s\n", yytext); } { printf("Unexpected character: %s\n", yytext); }
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 13 "src/monitor/sdb/addr-lex.l" #line 13 "src/monitor/sdb/addrexp.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 763 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c" #line 763 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.yy.c"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
yyterminate(); yyterminate();
@ -1765,6 +1765,6 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
#line 13 "src/monitor/sdb/addr-lex.l" #line 13 "src/monitor/sdb/addrexp.l"

View file

@ -30,7 +30,6 @@ OBJS = $(SRCS:%.c=$(OBJ_DIR)/%.o) $(CXXSRC:%.cc=$(OBJ_DIR)/%.o)
# Compilation patterns # Compilation patterns
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/%.o: %.c
@echo + CC $< @echo + CC $<
@echo $@ $<
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c -o $@ $< @$(CC) $(CFLAGS) -c -o $@ $<
$(call call_fixdep, $(@:.o=.d), $@) $(call call_fixdep, $(@:.o=.d), $@)
@ -41,6 +40,18 @@ $(OBJ_DIR)/%.o: %.cc
@$(CXX) $(CFLAGS) $(CXXFLAGS) -c -o $@ $< @$(CXX) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
$(call call_fixdep, $(@:.o=.d), $@) $(call call_fixdep, $(@:.o=.d), $@)
$(OBJ_DIR)/%.tag.c: %.y
@echo + YACC $<
@echo $@ $<
@mkdir -p $(dir $@)
@$(YACC) $(YFLAGS) --header=$(<:.y=.h) -o $@ $<
$(OBJ_DIR)/%.yy.c: %.l $(OBJ_DIR)/%.tag.c
@echo + LEX $<
@echo $@ $<
@mkdir -p $(dir $@)
@$(LEX) $(LFLAGS) -o $@ $<
# Depencies # Depencies
-include $(OBJS:.o=.d) -include $(OBJS:.o=.d)

View file

@ -35,8 +35,8 @@
especially those whose name start with YY_ or yy_. They are especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */ private implementation details that can be changed or removed. */
#ifndef YY_YY_SRC_MONITOR_SDB_ADDR_EXP_H_INCLUDED #ifndef YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED
# define YY_YY_SRC_MONITOR_SDB_ADDR_EXP_H_INCLUDED # define YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED
/* Debug traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
@ -81,4 +81,4 @@ extern YYSTYPE yylval;
int yyparse (void); int yyparse (void);
#endif /* !YY_YY_SRC_MONITOR_SDB_ADDR_EXP_H_INCLUDED */ #endif /* !YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED */

View file

@ -1,13 +1,13 @@
SRCS-y += src/monitor/sdb/addr-exp.c src/monitor/sdb/addr-lex.c SRCS-y += src/monitor/sdb/addrexp.tag.c src/monitor/sdb/addrexp.yy.c
INC_PATH += src/monitor/sdb INC_PATH += src/monitor/sdb
LFLAGS += -DYY_NO_UNPUT -DYY_NO_INPUT LFLAGS += -DYY_NO_UNPUT -DYY_NO_INPUT
/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c: src/monitor/sdb/addr-exp.y $(BUILD_DIR)/src/monitor/sdb/addr-exp.c: src/monitor/sdb/addr-exp.y
@echo + YACC $< @echo + YACC $<
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@$(YACC) $(YFLAGS) --header=$(<:.y=.h) -o $@ $< @$(YACC) $(YFLAGS) --header=$(<:.y=.h) -o $@ $<
/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-lex.c: src/monitor/sdb/addr-lex.l /home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addr-exp.c $(BUILD_DIR)/src/monitor/sdb/addr-lex.c: src/monitor/sdb/addr-lex.l $(BUILD_DIR)/src/monitor/sdb/addr-exp.c
@echo + LEX $< @echo + LEX $<
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@$(LEX) $(LFLAGS) -o $@ $< @$(LEX) $(LFLAGS) -o $@ $<