Skip to content

build command

Build all programs found in the source tree, or a specific target.

bash
FoBiS.py build [options]

Compiler options

OptionDescription
-compiler {gnu,intel,intel_nextgen,g95,opencoarrays-gnu,pgi,ibm,nag,nvfortran,amd,custom}Compiler (case-insensitive, default: gnu)
-fc FCCompiler executable — required for -compiler custom
-cflags CFLAGSCompilation flags
-lflags LFLAGSLinking flags
-modsw MODSWModule path switch — required for -compiler custom
-mpiMPI compiler variant
-openmpOpenMP
-openmp_offloadOpenMP offload
-coarrayCoarrays
-coverageCoverage instrumentation
-profileProfiling instrumentation
-mklib {static,shared}Build a library instead of a program (use with -t)
-ar ARArchiver executable for static libraries (default: ar)
-arflags ARFLAGSArchiver flags (default: -rcs)
-ranlib RANLIBRanlib executable for indexing static libraries (default: ranlib); set to empty string to skip
-ch, --cflags_heritageTrack flag changes; force full rebuild when they differ
-tb, --track_buildSave build info for use by install

Directory options

OptionDefaultDescription
-s, --src./Root source directory (repeatable)
-dbld, --build_dir./Build output directory
-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 to exclude from the build
-drs, --disable_recursive_searchFalseDo not recurse into subdirectories

File options

OptionDefaultDescription
-t, --targetAll programs foundSpecific target source file
-o, --outputBasename of targetOutput executable name
-e, --excludeSource files to exclude
-libsExternal libraries (full paths)
-vlibsVolatile external libraries (full paths) — triggers rebuild on change
-ext_libsExternal libraries (by name, in linker path)
-ext_vlibsVolatile external libraries (by name)
-dependonInterdependent fobos files (path/fobos[:mode])
-inc.inc .INC .h .HInclude file extensions
-extensions(all Fortran extensions)Parsed file extensions
-build_allFalseBuild all parsed sources, not just program files

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
-lmodesList available modes and exit
--print_fobos_templatePrint a fobos template with all current option values

Preprocessor options

OptionDescription
-preprocessor [CMD]Enable source preprocessing (default: PreForM.py)
-p, --preprocPreprocessor flags for the main compiler
-app, --preprocessor_argsFlags passed to the preprocessor
-npp, --preprocessor_no_oOmit -o from the preprocessor command line
-dpp, --preprocessor_dirDirectory for preprocessed sources (kept if set)
-epp, --preprocessor_extFile extensions to preprocess

Fancy options

OptionDescription
-force_compileForce recompilation of all sources
-colorsColoured terminal output
-l, --logWrite a build log file
-graphGenerate a graphviz dependency graph
-q, --quietLess verbose output
-verboseMaximum verbosity (for debugging FoBiS.py itself)
-j, --jobsNumber of parallel compile jobs (default: 1)
-m, --makefileExport a GNU Makefile instead of building

Examples

bash
# Build all programs with defaults
FoBiS.py build

# Build with GNU gfortran, parallel, debug flags
FoBiS.py build -compiler gnu -cflags " -c -O0 -g" -j 4

# Build a specific target
FoBiS.py build -t src/solver.f90 -o solver

# Build a static library
FoBiS.py build -t src/mylib.f90 -mklib static -o libmylib.a

# Build a static library with LLVM tools
FoBiS.py build -t src/mylib.f90 -mklib static -ar llvm-ar -ranlib llvm-ranlib

# Build a static library skipping ranlib (llvm-ar updates the symbol table itself)
FoBiS.py build -t src/mylib.f90 -mklib static -ar llvm-ar -ranlib ""

# Use a fobos file and a specific mode
FoBiS.py build -f project.fobos -mode release

# Force full recompile
FoBiS.py build -force_compile