I am looking for a way to log compilation errors within a makefile but here is my problem:
the line without log function is as follows:
$(OBJ_PATH)/%.obj: $(SRC_PATH_ASW)/%.c
@echo -Compiling $<:
$(CC) $(INCLUDE_ASW) $(INCLUDE_ASW_AUTO) $(INCLUDE_BSW) -c $< $(CFLAGS)
I tried to redirect stderr and/or stdout in a log file using the following command
$(OBJ_PATH)/%.obj: $(SRC_PATH_ASW)/%.c
@echo -Compiling $<:
$(CC) $(INCLUDE_ASW) $(INCLUDE_ASW_AUTO) $(INCLUDE_BSW) -c $< $(CFLAGS) > $@.log
This solution won't display the message to the terminal but only within the log file. (i tried all possible kind of redirection without success)
I also tried with tee but the problem is different, in fact the makefile won't stop at first error since the tee command return code will always be successful.
$(OBJ_PATH)/%.obj: $(SRC_PATH_ASW)/%.c
@echo -Compiling $<:
$(CC) $(INCLUDE_ASW) $(INCLUDE_ASW_AUTO) $(INCLUDE_BSW) -c $< $(CFLAGS) | tee $@.log
What I would like if possible is to be able to log compilation result into a file as well as disply it but that the makefile stops at first compilation error and does not continue with other files compilation.
Thank you for your support.