I didn’t know about the -MM
switch in the c compiler - that’s really useful!
In the Makefile example, on line 15, it should have the depend target have prerequisites $(SRCS)
so that if the dependencies in the code changes, the depend file is rebuilt and make can see the new dependencies. That could be really confusing for someone if they didn’t have that in place.
depend: $(SRCS)
$(CC) -MM $(SRCS) > depend
The clean target should probably remove the depend
file as well.