Rules for compilation

By now it should be clear that C-programming involves sequential processing of several different software artifacts. .C files import .h files. .o files go into libraries (.a files). .S files need to become .o files. a.out programs depend on all those .xxx files. We can derive the following rules:

  1. If a header file changes, all C files including this header need to be recompiled to object files or executables.

  2. If a C file changes it depends on whether it is part of a library (in other words: it offers public functions to other modules) or not. If it is independent then all executables which use it should be removed and recompiled

  3. If the c file is part of a library the library needs to be updated with the new object code and ALL executables which use this library need to be generated.