| name | build-fleks |
| description | Compile FLEKS standalone or as an SWMF component, build the converter, and regenerate compile_commands.json |
Build FLEKS
This skill compiles the FLEKS project and ensures IntelliSense stays up to date.
Prerequisites
mpicxx and the Fortran linker from the SWMF build environment must be
available in PATH.
- AMReX must be installed.
Config.pl and Makefile.def provide the AMReX
include/library paths.
Makefile.conf and Makefile.def are generated by ./Config.pl -install
when missing. In a pure FLEKS checkout, Config.pl can clone/use local
share, util, and AMReX dependencies.
Steps
1. Working Directory
All commands should be run from the FLEKS project root (i.e., the
directory containing this .agent/ folder).
2. Clean Build (Optional)
If a clean build is requested, run:
make clean
For a complete reset (removes all generated files):
make distclean
3. Build the Project
For standalone executable:
make EXE -j8
make FLEKS -j8 is an alias for make EXE -j8.
For the SWMF component library:
make LIB -j8
Use make EXE for standalone validation. make LIB is only valid in a built
SWMF tree where libSHARE.a and con_comp_param.mod already exist.
Both EXE/FLEKS and LIB invoke compile_commands and CONVERTER
automatically, so successful builds should refresh compile_commands.json and
bring bin/converter.exe up to date.
4. Check for Errors
- Review the build output for any compilation errors
- Common issues:
- Missing headers → Check include paths in
src/Makefile (SEARCH_C)
and generated values in Makefile.conf / Makefile.def
- Undefined symbols → Check if all required
.cpp files are listed in
the SRCS variable in src/Makefile
make LIB errors outside SWMF -> Use make EXE, or build/configure the
parent SWMF tree first
- AMReX errors -> Verify AMReX installation paths exposed through
Makefile.def, Makefile.conf, and AMREXSEARCH
5. Verify compile_commands.json
After successful build, verify that compile_commands.json was regenerated:
ls -la compile_commands.json
This file is used by VS Code's C/C++ IntelliSense.
Targets Reference
| Target | Description |
|---|
make / make EXE | Build standalone executable (bin/FLEKS.exe) |
make FLEKS | Alias for make EXE |
make LIB | Build library for SWMF integration (src/libFLEKS.a) |
make CONVERTER | Build converter tool (bin/converter.exe) |
make install | Create bin/ and include/Constants.h |
make clean | Remove object files |
make distclean | Remove all generated files |
make compile_commands | Regenerate compile_commands.json only |
Key Compilation Flags
The C++ compilation flags are set in Makefile.conf (via SWMF):
| Variable | Typical Value | Purpose |
|---|
DEBUGC | -g -Wall -Wextra -Wno-unused-parameter | Debug symbols and warnings |
OPT3 | -O0 (debug) or -O3 (release) | Optimization level |
FLAGC_EXTRA | -D_${COMPONENT}_COMPONENT_ | Component preprocessor flag |
To enable a debug build, ensure OPT3 is set to -O0 in the SWMF
Makefile.conf (it is -O0 by default during development).
Success Criteria
- Build completes without errors
bin/FLEKS.exe is updated for make EXE / make FLEKS
src/libFLEKS.a is updated for make LIB
bin/converter.exe is updated by EXE, FLEKS, LIB, or CONVERTER
compile_commands.json is present and current