I have a make rule which generates a dependencies file for a list of sources. This is the rule:
.depend: $(SRCS)
$(CC) $(INCLUDE) -MM $^ | sed 's-^\(.*\):-$(OBJDIR)\/\1:-'> .depend
What I want is: If gcc fails for any file in $(SRC) then .depend should not be created. Currently, if gcc fails on a source file I will get an incomplete .depend which will not be regenerated after I fix the issue. What can I do? I’d like to avoid having a .depend file for each source file
This should work: