How to force revaluation of variables in makefile
问题 I have a makefile which runs a binary to generate the cpp files. I then compile the cpp files and generate .o files for each cpp file. The problem is when the makefile is first invoked, the folder is empty because the binary is not invoked yet and CPP_FILES=$(wildcard $(MY_DIR)/inc/output/*.cpp) will be an empty variable. So I changed the line to CPPFILES=$$(wildcard $(MY_DIR)/inc/output/*.cpp) OBJFILES=$$(patsubst $(MY_DIR)/*.cpp,$(MY_DIR)/*.o,$(CPPFILES)) and //ran the binary to generate