build system has trouble handling files that are removed from Makefile

Issue #2237 new
Roland Haas created an issue

Currently if a source file (C and C++ mostly) that used to be listed in SRCS but is now no longer listed because it is #included in another source file, then Cactus does not remove the preprocessed copy of the file in configs/sim/build/THORNNAME which leads the compiler to #include that file rather than the one in the thorn's src directory. Since the file is no longer listed in SRCS it is also never preprocessed again, leaving the stale file around in configs/sim/build/THORNNAME forever.

A make sim-clean fixes this at the cost of a full recompile, however such a clean does not happen (automatically) on the Jenkins build system when it does an incremental build and even on a workstation one has to be aware that (and how) Cactus preprocesses source files.

A similar issue (I assume) exists if one removes a source file completely from the makefile.

A possible fix would be to look at the object list for the thorn, then remove any objects not in the objectlist and their corresponding preprocessed source file (which has the same name but with .o removed, ie is called foo.c.o and not foo.o).

This is still not perfect since it will not handle the case of Fortran and removing F90 file that provided a module file since the foo.mod file is in configs/scratch and its name is not derivable from an object file name (at least not consistently, even though Cactus does encourage files that provide module foo to be named foo.F90 so that it can set up dependency tracking for the client files of the module, ie those that use it).

Comments (1)

  1. Log in to comment