From 578d4312b91527f867df3ab0bc99c3924783b48e Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Tue, 10 Mar 2026 10:49:05 +0800 Subject: [PATCH] fix multi core compile --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 58dcf68..2116d58 100644 --- a/Makefile +++ b/Makefile @@ -38,12 +38,12 @@ CPP_SRCDIR = $(AllDirs) CPP_SOURCES = $(foreach d,$(CPP_SRCDIR),$(wildcard $(d)/*.cpp) ) CPP_OBJS = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(CPP_SOURCES)) -default:init compile strip +default: init $(TARGET) strip -$(C_OBJS):$(OBJ_PATH)/%.o:%.c +$(C_OBJS):$(OBJ_PATH)/%.o:%.c | init $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ -$(CPP_OBJS):$(OBJ_PATH)/%.o:%.cpp +$(CPP_OBJS):$(OBJ_PATH)/%.o:%.cpp | init $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ init: @@ -55,7 +55,9 @@ test: @echo "CPP_SOURCES: $(CPP_SOURCES)" @echo "CPP_OBJS: $(CPP_OBJS)" -compile:$(C_OBJS) $(CPP_OBJS) +compile: $(TARGET) + +$(TARGET): $(C_OBJS) $(CPP_OBJS) $(CC) -O2 -o $(TARGET) $^ $(LINKFLAGS) $(LIBS) clean: @@ -67,7 +69,7 @@ install: $(TARGET) uninstall: rm -f $(PREFIX_BIN)/$(TARGET) -strip: +strip: $(TARGET) $(STRIP) $(TARGET) cp $(TARGET) ~/tftpboot