File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ TOOLS_CXX_COMPILE = $(TOOLS_CC) $(TOOLS_CXXFLAGS) $(TOOLS_INCS)
4444# Command for ensuring the output directory for the rule exists.
4545DIR_GUARD = @$(MKDIR ) -p $(@D )
4646
47+ MAKE_CURPID := $(shell printf '% s' $$PPID)
48+
4749$(TOOLS_OBJS_DIR ) % .o : $(TOOLS_SRC_DIR ) % .c
4850 $(DIR_GUARD )
4951 $(CC ) $(TOOLS_CFLAGS ) $(TOOLS_INCS ) -c $< -o $@
@@ -60,10 +62,20 @@ $(TOOLS_OBJS_DIR)%.o : $(TOOLS_SRC_DIR)%.s
6062 $(DIR_GUARD )
6163 $(AS ) $(TOOLS_ASFLAGS ) $< -o $@
6264
63- $(TOOLS_BIN ) : $(TOOLS_OBJS ) $(TOOLS_LIB_ARCHIVES ) $(TOOLS_ADDITIONAL_DEPS )
65+ .INTERMEDIATE :: $(TOOLS_BIN ) _tmp$(MAKE_CURPID ) $(TOOLS_LIB ) _tmp$(MAKE_CURPID )
66+
67+ $(TOOLS_BIN ) _tmp$(MAKE_CURPID ) : $(TOOLS_OBJS ) $(TOOLS_LIB_ARCHIVES ) $(TOOLS_ADDITIONAL_DEPS )
68+ $(DIR_GUARD )
69+ $(CC ) $(TOOLS_LDFLAGS ) -o $@ $(TOOLS_OBJS ) $(TOOLS_LIB_ARCHIVES ) $(TOOLS_LIBS )
70+
71+ $(TOOLS_BIN ) : $(TOOLS_BIN ) _tmp$(MAKE_CURPID )
72+ $(DIR_GUARD )
73+ mv $< $@
74+
75+ $(TOOLS_LIB ) _tmp$(MAKE_CURPID ) : $(TOOLS_OBJS )
6476 $(DIR_GUARD )
65- $(CC ) $( TOOLS_LDFLAGS ) -o $( TOOLS_BIN ) $( TOOLS_OBJS ) $( TOOLS_LIB_ARCHIVES ) $( TOOLS_LIBS )
77+ $(AR ) cru $@ $<
6678
67- $(TOOLS_LIB ) : $(TOOLS_OBJS )
79+ $(TOOLS_LIB ) : $(TOOLS_LIB ) _tmp $( MAKE_CURPID )
6880 $(DIR_GUARD )
69- $( AR ) cru $( TOOLS_LIB ) $<
81+ mv $< $@
You can’t perform that action at this time.
0 commit comments