4 ms·
It looks like it doesn't deal with C/C++/etc. header files?
by tom_ 3y ago
It looks like it doesn't deal with C/C++/etc. header files?
- gary_0 3y agoYeah, you have to run GCC with `-MMD -MP` so you get .d files along with your .o files. Then in my own Makefile I have: include $(shell find $(BUILD_DIR) -type f -name '\*.d') so that make will check for header file changes.
- oso2k 3y agoAlternative way without shelling out: SRC = $(wildcard src/\*.c) OBJ = $(SRC:.c=.o) SDEPS = $(SRC:.c=.d) EXE = myapp INC = include CFLAGS ?= -Os -MMD -MP LDFLAGS ?= %.o: %.c $(INC) Makefile $(CC) $(CFLAGS) -c $< -o $@ $(EXE): $(OBJ) $(LD) $^ $(LDFLAGS) -o $@ # near the bottom of your Makefile -include $(SDEPS)