CROSS_COMPILE: Optional variable for cross-compilation. If set, it prefixes the compiler and archiver commands.CC: The C compiler to use. Defaults togcc, or$(CROSS_COMPILE)gccifCROSS_COMPILEis set.AR: The archiver to use. Defaults toar, or$(CROSS_COMPILE)arifCROSS_COMPILEis set.- The
CROSS_COMPILEoption format should be similar to this example, if wanting to use gcc: CROSS_COMPILE=aarch64-linux-gnu-
These flags are included in all build modes:
-I$(INCLUDE_DIR): Include directory for project headers.-I$(MBEDTLS_DIR)/include: Include directory for mbedTLS headers.- Warning and standard enforcement flags:
-Wall: Enable most warnings.-Wextra: Enable extra warnings.-Werror: Treat warnings as errors.
-std=c11: Enforce the C11 standard.
Used for debugging builds:
-g: Generate debug information for use with debuggers like GDB.-O0: Disable optimizations for easier debugging.-DDEBUG: Define theDEBUGmacro.
Used for optimized builds:
- Optimization:
-O3,-Ofast: Aggressive optimizations.-funroll-loops,-finline-functions: Loop unrolling and function inlining.-flto: Link-time optimization for improved performance.
- Loop optimizations:
-fgraphite-identity,-floop-nest-optimize: Use Graphite framework for loop optimizations.
- Miscellaneous:
-fomit-frame-pointer: Exclude the frame pointer to reduce overhead.-ffunction-sections,-fdata-sections: Place each function and data item in its own section for better dead-code
The CFLAGS variable is determined by the MODE setting:
MODE=debug: IncludesCFLAGS_COMMONandDEBUG_FLAGS.MODE=optimize: IncludesCFLAGS_COMMONandOPTIMIZE_FLAGS.
SRC_DIR: Directory containing source files (src).INCLUDE_DIR: Directory containing header files (include).BUILD_DIR: Directory for compiled output files (build).TEST_DIR: Directory for test files (test).
To build the project with debugging options:
make MODE=debugTo build and run the test binaries:
make MODE=debug BUILD_TEST=1
./debug.sh To check the logs go to the valgrind_logs directory
cd test/gramine/
sudo ./debug_gramine.shTo check the logs go to gramine_logs