diff --git a/en_US.ISO8859-1/books/developers-handbook/tools/chapter.sgml b/en_US.ISO8859-1/books/developers-handbook/tools/chapter.sgml index c820275563..e1682411a7 100644 --- a/en_US.ISO8859-1/books/developers-handbook/tools/chapter.sgml +++ b/en_US.ISO8859-1/books/developers-handbook/tools/chapter.sgml @@ -1,7 +1,7 @@ @@ -1156,6 +1156,55 @@ install: it. + + Make and include-files + + C code often starts with a list of files to include, for + example stdio.h. Some of these files are system-include + files, some of them are from the project you're now working + on: + + + #include <stdio.h> +#include "foo.h" + +int main(.... + + To make sure that this file is recompiled the moment + foo.h is changed, you have to add it in + your Makefile: + + foo: foo.c foo.h + + The moment your project is getting bigger and you have + more and more own include-files to maintain, it will be a + pain to keep track of all include files and the files which + are depending on it. If you change an include-file but + forget to recompile all the files which are depending on + it, the results will be devastating. gcc + has an option to analyze your files and to produce a list + of include-files and their dependencies: . + + + If you add this to your Makefile: + + depend: + gcc -E -MM *.c > .depend + + and run make depend, the file + .depend will appear with a list of + object-files, C-files and the include-files: + + foo.o: foo.c foo.h + + If you change foo.h, next time + you run make all files depending on + foo.h will be recompiled. + + Don't forget to run make depend each + time you add an include-file to one of your files. + + FreeBSD Makefiles diff --git a/en_US.ISO_8859-1/books/developers-handbook/tools/chapter.sgml b/en_US.ISO_8859-1/books/developers-handbook/tools/chapter.sgml index c820275563..e1682411a7 100644 --- a/en_US.ISO_8859-1/books/developers-handbook/tools/chapter.sgml +++ b/en_US.ISO_8859-1/books/developers-handbook/tools/chapter.sgml @@ -1,7 +1,7 @@ @@ -1156,6 +1156,55 @@ install: it. + + Make and include-files + + C code often starts with a list of files to include, for + example stdio.h. Some of these files are system-include + files, some of them are from the project you're now working + on: + + + #include <stdio.h> +#include "foo.h" + +int main(.... + + To make sure that this file is recompiled the moment + foo.h is changed, you have to add it in + your Makefile: + + foo: foo.c foo.h + + The moment your project is getting bigger and you have + more and more own include-files to maintain, it will be a + pain to keep track of all include files and the files which + are depending on it. If you change an include-file but + forget to recompile all the files which are depending on + it, the results will be devastating. gcc + has an option to analyze your files and to produce a list + of include-files and their dependencies: . + + + If you add this to your Makefile: + + depend: + gcc -E -MM *.c > .depend + + and run make depend, the file + .depend will appear with a list of + object-files, C-files and the include-files: + + foo.o: foo.c foo.h + + If you change foo.h, next time + you run make all files depending on + foo.h will be recompiled. + + Don't forget to run make depend each + time you add an include-file to one of your files. + + FreeBSD Makefiles