'make' does not recompile when source file has been edited

前端 未结 3 548
栀梦
栀梦 2021-01-19 13:31

I\'m writing a little implementation of Conway\'s Game of Life in C. The source code is split in three files: main.c and functions.c/function

3条回答
  •  梦毁少年i
    2021-01-19 14:29

    Because you haven't told it that recompilation depends on functions.h.

    Try adding this to your Makefile:

    %.o : functions.h
    

    Alternatively, modify your existing rule to be:

    %.o : %.c functions.h
        $(CC) -c $< -o $@
    

提交回复
热议问题