+ 3
How can I make a makefile in C detects the modifications in header files ?
4 odpowiedzi
+ 3
List used header files as dependencies for the object files that use them, that way when a header is modified the objects that use it get rebuilt.
+ 2
The problem is that the compiler generate other files when I do this
+ 2
Abdelhaq El Amraoui What kind of other files?
What i meant was just to have an explicit recipe for each object file - like
module1.o: module1.c header1.h header2.h
$(CC) $(CFLAGS) -c lt; -o $@
(c file should be the first dependency in the list so that lt; becomes it)
+ 2
Also you can try using -MMD gcc option: https://codereview.stackexchange.com/questions/2547/makefile-dependency-generation/11109#11109 (never done it myself, but maybe that's what you need)