Added comments about most flags.

Added a bunch of comments to make it more understandable later on.
This commit is contained in:
Jake Goodwin 2025-01-23 17:08:38 -08:00
parent d78d7e2e95
commit 506f11693a
1 changed files with 15 additions and 1 deletions

View File

@ -57,6 +57,12 @@ set(LINKER_SCRIPT linker.ld)
#------------------- #-------------------
# General Flags # General Flags
#------------------- #-------------------
# "-fno-builtin"::
# "-Wall":: Enables all warnings man page line:4385
# "-ffunction-sections":: Puts each function into it's own section
# "-fdata-sections":: Puts each data chunk into it's own section.
# "-fomit-frame-pointer"::
set(OBJECT_GEN_FLAGS " \ set(OBJECT_GEN_FLAGS " \
-fno-builtin \ -fno-builtin \
-Wall \ -Wall \
@ -80,6 +86,10 @@ set(CMAKE_ASM_FLAGS " \
#------------------- #-------------------
# LFLAGS for cross # LFLAGS for cross
#------------------- #-------------------
# "-Wl":: Pass option as option to the linker.
# "-Map":: Map file passed to linker(an output?)
# "--gc-sections":: linkage garbage collector, part of shrinking size.
set(CMAKE_EXE_LINKER_FLAGS " \ set(CMAKE_EXE_LINKER_FLAGS " \
-Wl,-Map=${PROJECT_NAME}.map \ -Wl,-Map=${PROJECT_NAME}.map \
-Wl,--print-memory-usage \ -Wl,--print-memory-usage \
@ -92,7 +102,8 @@ set(CMAKE_EXE_LINKER_FLAGS " \
# "-Og":: Optimizes for debugging expirence. # "-Og":: Optimizes for debugging expirence.
# "-g":: Debugging options # "-g":: Debugging options
# "-gdwarf-3":: # "-gdwarf-3":: Selection of the format version 3
# "-gstrict-dwarf":: Disallow using extensions of later dwarf standards.
set(CMAKE_C_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C Compiler options for debug build type") set(CMAKE_C_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C Compiler options for debug build type")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C++ Compiler options for debug build type") set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C++ Compiler options for debug build type")
set(CMAKE_ASM_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "ASM Compiler options for debug build type") set(CMAKE_ASM_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "ASM Compiler options for debug build type")
@ -101,6 +112,9 @@ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Linker options for debug bui
#------------------ #------------------
# Release Flags # Release Flags
#----------------- #-----------------
# "-Os":: Optimizes for space.
# "-flto":: Link Time Optimization
set(CMAKE_C_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C Compiler options for release build type") set(CMAKE_C_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C Compiler options for release build type")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C++ Compiler options for release build type") set(CMAKE_CXX_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C++ Compiler options for release build type")
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type") set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")