Sample Header Ad - 728x90

log output (stdout) from within make file

1 vote
0 answers
1540 views
How do I send the output (stdout) to a log file from WITHIN the make file? I am NOT interested in a command line solution such as "make > build.log". Listed below is my generic make file. # +--------------------------------------------------------------------------+ # : Uncomment the appropriate section below (comment all others) : # +--------------------------------------------------------------------------+ # --- For TERMINAL program library files --- # LIBS := -lm # --- For RAYLIB program library files --- LIBS := -l:raylib/libraylib.a -lm # --- For NCURSES program library files --- # LIBS := -lform -lmenu -lncurses -lm # --- For SDL program library files --- # SDLALL := -lSDL2_image -lSDL2_mixer -lSDL2_net -lSDL2_ttf -lSDL2_gfx # LIBS := sdl2-config --libs --cflags $(SDLALL) -lm # ------------------------- End of user editable code ------------------------- DASH := " +--------------------------+" VERSION := " : Script: 2024.02.12 :" TARGET := " : For Raylib Makefiles :" AUTHOR := " : By: Jan W. Zumwalt :" # set compiler CC := gcc # additional header files HDRS := # additional include files INCS := # additional source files SRCS := main.c # name of executable EXEC := test # generate object file names OBJS := $(SRCS:.c=.o) # set compiler flags CFLAGS := -ggdb3 -O0 $(LIBS) --std=c17 -Wall # default recipe all: $(EXEC) # recipe for building final executable $(EXEC): $(OBJS) $(HDRS) $(INCS) Makefile > build.log $(CC) -o $@ $(OBJS) $(CFLAGS) make clean @echo $(\n) @echo $(DASH) @echo $(VERSION) @echo $(TARGET) @echo $(AUTHOR) @echo $(DASH) @echo $(\n) # recipe for building object files # $(OBJS): $(@:.o=.c) $(HDRS) Makefile # $(CC) -o $@ $(@:.o=.c) -c $(CFLAGS) # recipe to clean workspace clean: rm -f $(OBJS) # recipe to clean workspace test: test ./test .PHONY: all clean test
Asked by jwzumwalt (299 rep)
Feb 17, 2024, 09:53 AM