Compiling/Cleaning

From OpenFOAMWiki

Before rebuilding any section of code, remnants of any previous compilation process need to be removed.

wclean

Suppose you want make some changes in the src/OpenFOAM directory.

cd src/OpenFOAM/db/functionObjects/functionObjectList
mkdir noLink
cp functionObjectList.{C,H} noLink/

makes a backup of the existing files. Now jump back up to the nearest directory containing Make/ and issue the commands needed to clean up and recompile a shared object library

wclean libso && wmake libso 2>&1 | tee log.wmake

The first statement cleans out Make/ and (importantly) deletes lnInclude/. Issuing wclean alone will not do the latter and may cause strange compilation errors later. The "&&" tells the shell (in this case, bash) to only proceed if things went ok with the preceding task. Importantly, wmake will ignore any "noLink" directories as it assembles a new lnInclude directory. The remainder of the line is optional, forcing any errors to be sent to stdout and to a log file which can sometimes be useful for debugging.