-
Notifications
You must be signed in to change notification settings - Fork 35
Autorebuild when compiling flags change
A helpful (thanks Jacob) feature is to automatically (re-)compile your project when you change the compiling flags. By default, FoBiS.py decides if the (re-)compiling is necessary only on the basis of the time-stamp correlation between sources and compiled object, but if the compiled objects are compiled with flags differing from the present ones the time-stamp check is not useful. To enable the automatically (re-)compile in such a situation you must tell to FoBiS.py that the cflags heritage
must be considered!
Let us assume that your project have the following tree
└── src
├── cumbersome.f90
└── nested-1
├── first_dep.f90
└── nested-2
└── second_dep.inc
We want to build cumbersome
program (contained into cumbersome.f90
file) tracking the compiling flags used in the building, thus if we will change those flags FoBiS.py will automatically rebuild the project, no matter if the sources have not been changed. To this aim we must enable the cflags heritage
FoBiS.py build --cflags_heritage -cflags " -c -O1" …
or
FoBiS.py build -ch -cflags " -c -O1" …
or putting this into your fobos file
...
cflags_heritage = True
...
Now FoBiS.py tracks the heritage of compiling flags. The tracking is accomplished by saving the compiling flags into a hidden file the name of which is built as following:
-
build_dir
+target
+.cflags.heritage
if a target is set; -
build_dir
+.cflags.heritage
in case the target is not set.
Anytime the compiling flags your are using differ from the ones contained into this file, FoBiS.py will force recompiling all. Obviously, the compiling flags heritage file is update for any buildings (when the heritage is enabled).
After the first building our tree look like
.cflags.heritage
└── mod
├── …
└── obj
├── …
cumbersome
└── src
├── cumbersome.f90
└── nested-1
├── first_dep.f90
└── nested-2
└── second_dep.inc
and the heritage file will contain -c -O1
(leading and trailing white spaces are not considered). If now we try to build with different flags with the heritage enabled
FoBiS.py build -ch -cflags " -c -O2" …
FoBiS.py will recompile all, no matter the objs are update, because the present cflags differ from the heritage. Now the heritage file contains -c -O2
. If now rebuild old with different flags, but without enabling the heritage
FoBiS.py build -cflags " -c -O1" …
FoBiS.py will not compile anything because only the time-stamp check is made (and all objs are updated with the sources). Note that in this last case the heritage file is not modified.
-
Getting-Started
- A Taste of FoBiS.py
- fobos: the FoBiS.py makefile
- FoBiS.py in action
- FAQ