Skip to content

clean command

Remove compiled objects, module files, and built targets from a previous build.

bash
fobis clean [options]

Scope options

OptionDescription
--only-objClean only compiled objects (.o / .mod), leave built targets
--only-targetClean only built targets (executables / libraries), leave objects

Mutually exclusive

--only-obj and --only-target cannot be used together — FoBiS.py will exit with an error if both are supplied.

Compiler options

OptionDescription
--compiler {gnu,intel,…,custom}Compiler (used to locate object paths, default: gnu)
--fc FCCompiler executable (for --compiler custom)
--cflags CFLAGSCompilation flags (used to locate output paths)
--lflags LFLAGSLinking flags
--modsw MODSWModule path switch (for --compiler custom)
--mpiMPI variant
--openmpOpenMP
--openmp-offloadOpenMP offload
--coarrayCoarrays
--coverageCoverage instrumentation
--profileProfiling instrumentation
--mklib {static,shared}Target was a library
--ch, --cflags-heritageAlso remove the cflags heritage file
--tb, --track-buildAlso remove the track-build info file

Directory options

OptionDefaultDescription
-s, --src./Root source directory
--dbld, --build-dir./Build output directory to clean
--dobj, --obj-dir./obj/Compiled objects directory
--dmod, --mod-dir./mod/Module interface files directory
--dlib, --lib-dirLibrary search directories
-i, --includeInclude file search directories
--ed, --exclude-dirsDirectories that were excluded from the build
--drs, --disable-recursive-searchFalseDo not recurse into subdirectories

File options

OptionDefaultDescription
-t, --targetAll programs foundSpecific target to clean
-o, --outputBasename of targetOutput executable name
-e, --excludeSource files that were excluded
--libsExternal libraries (full paths)
--vlibsVolatile external libraries (full paths)
--ext-libsExternal libraries (by name)
--ext-vlibsVolatile external libraries (by name)
--dependonInterdependent fobos files
--inc.inc .INC .h .HInclude file extensions
--extensions(all Fortran extensions)Parsed file extensions
--build-allFalseAll parsed sources were built

fobos options

OptionDescription
-f, --fobosSpecify a fobos file with a different name or path
--fci, --fobos-case-insensitiveCase-insensitive fobos option parsing
--modeSelect a fobos mode — tab-completable from the active fobos file
--lmodesList available modes and exit
--print-fobos-templatePrint a fobos template with all current option values

Fancy options

OptionDescription
--colorsColoured terminal output
-l, --logWrite a log file
-q, --quietLess verbose output
--verboseMaximum verbosity
--jsonEmit structured JSON to stdout (see JSON output)

Examples

bash
# Clean everything (objects + targets)
fobis clean

# Clean only compiled objects, keep the executable
fobis clean --only-obj

# Clean only the built executable, keep objects
fobis clean --only-target

# Clean using settings from a fobos mode
fobis clean -f project.fobos --mode release

# Clean a specific build directory
fobis clean --build-dir ./build/ --obj-dir ./build/obj/ --mod-dir ./build/mod/

fobos integration

When using a fobos file, clean reads the same directory and target settings as build, so the correct artefacts are removed without repeating paths on the command line.