Buildsystems Conventions
This only contains the common bits accross buildsystems, not the ones specific to a particular buildsystem or particular project.
Environment variables
POSIX
- CC
- Command/path to target platform C Compiler
- CFLAGS
-
Flags passed to target platform C Compiler.
Should not be expected to contain values such as-std=c99. - LDFLAGS
- Linking flags passed to target platform Compiler
- YACC
- Command/path to
yacc(1) - YFLAGS
- Flags passed to
yacc(1) - LEX
- Command/path to
lex(1) - LFLAGS
- Flags passed to
lex(1) - AR
- Command/path to
ar(1) - ARFLAGS
-
Flags passed to
ar(1).
Default formake(1)specified as-rvby POSIX.1-2008. - FC
- Command/path to target platform Fortran Compiler
- FFLAGS
- Flags passed to target platform Fortran Compiler
Common across autotools, CMake, meson
- PREFIX
- Common prefix for installation directories, typically defaulting to
/usr/local - BINDIR
- Installation directory for executables, typically defaulting to
${PREFIX}/bin - MANDIR
- Installation directory for manpages, typically defaulting to
${PREFIX}/share/man - DESTDIR
-
Sets the destination directory for installation into a different root,
for example a temporary installation directory later copied into
a distro package or the
/ - PKG_CONFIG
-
Command/path to target platform
pkg-config(1)implementation.
Present in freedesktop.org pkg-config and pkgconfpkg.m4, as well as supported by CMake and meson.
Widespread but nor formally specified
- AS
- Command/path to target platform assembler
- CPP
- Command/path to target platform C preprocessor (ie.
${CC} -E) - LD
- Command/path to target platform linker
- STRIP
- Command/path to target platform executable sections stripper (such as debug symbols)
- STRINGS
-
Command/path to target platform strings extractor.
Note: Rather questionable whether it should treat sections differently, and doing such filtering has been source of parser vulnerabilities. - NM
- Command/path to target platform executable symbols extractor
- READELF
- Command/path to target platform ELF reader
- OBJCOPY
- Command/path to target platform object copier
- OBJDUMP
- Command/path to target platform object dumper
- RANLIB
-
Command/path to
ranlib(1).
Usually not needed anymore due to modernar(1)implementations maintaining their index. - CROSS_COMPILE
-
Command prefix before default values of target platform-specific commands like CC, AR, FC, RANLIB, …
For example it can be set toCROSS_COMPILE=x86_64-pc-linux-musl- - HOSTCC
- Command/path to build host C Compiler
- HOSTCCFLAGS
- Flags passed to build host C Compiler
- CXX
- Command/path to target platform C++ Compiler
- HOSTCXX
- Command/path to build host C++ Compiler
- HOSTCXXFLAGS
- Flags passed to build host C++ Compiler
- LDSTATIC
-
Flag(s) to enable static linking passed to target platform compiler when building executables.
For exampleLDSTATIC=-static