> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 10:12:17 up 14:11, 2 users, load average: 0.12, 0.13, 0.10
This commit is contained in:
@ -25,24 +25,12 @@ INCLUDES = $(addprefix -I, $(INC_PATH))
|
||||
CFLAGS := -O2 -MMD -Wall -Werror $(INCLUDES) $(CFLAGS)
|
||||
LDFLAGS := -O2 $(LDFLAGS)
|
||||
|
||||
# Define a variable to hold the test macro flag
|
||||
TEST_CFLAGS ?=
|
||||
|
||||
# Check if the user passed the "test any" command
|
||||
ifeq ("$(findstring test,$(MAKECMDGOALS))","test")
|
||||
TEST_CFLAGS += -D$(MAKECMDGOALS:~1)
|
||||
endif
|
||||
|
||||
# Add the test macro flag to the compilation flags
|
||||
CFLAGS += $(TEST_CFLAGS)
|
||||
|
||||
OBJS = $(SRCS:%.c=$(OBJ_DIR)/%.o) $(CXXSRC:%.cc=$(OBJ_DIR)/%.o)
|
||||
|
||||
# Compilation patterns
|
||||
$(OBJ_DIR)/%.o: %.c
|
||||
@echo + CC $<
|
||||
@mkdir -p $(dir $@)
|
||||
@echo + TEST_CFLAGS $(CFLAGS)
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
$(call call_fixdep, $(@:.o=.d), $@)
|
||||
|
||||
|
@ -47,4 +47,10 @@ $(clean-tools):
|
||||
clean-tools: $(clean-tools)
|
||||
clean-all: clean distclean clean-tools
|
||||
|
||||
.PHONY: run gdb run-env clean-tools clean-all $(clean-tools)
|
||||
|
||||
|
||||
test: NEMUARGS += -Dargs
|
||||
test: run
|
||||
|
||||
|
||||
.PHONY: run gdb run-env clean-tools clean-all $(clean-tools) test
|
||||
|
@ -143,8 +143,6 @@ static bool make_token(char *e) {
|
||||
int check_parentheses(const Token* arr, size_t p, size_t q) {
|
||||
int cnt = 0;
|
||||
bool is_surrounded = false;
|
||||
Assert (p >= 0 && q < nr_token, "invalid range on check_parentheses, "\
|
||||
"p = %"PRIuMAX", q = %"PRIuMAX"\n", p, q);
|
||||
for (size_t i = p; i <= q; i ++) {
|
||||
if (arr[i].type == '(') {
|
||||
if (i == p) {
|
||||
|
Reference in New Issue
Block a user