GNU Make provides a reference for the implicitly used flags in the Makefile system. I include snippets of some of the relevant ones here.
For reference, the full documentation can be found here. Additionally, for how the implicit rules are utilized, refer to the Makefile documentation here.
Program for compiling C programs; default cc
. I use clang
instead.
Program for compiling C++ programs; default g++
. I use clang++
instead.
(normally CC/CXX use it implicitly)
Program for running the C preprocessor, with results to standard output; default $(CC) -E
.
Extra flags to give to the C compiler. E.g., -g
, -O2
, -Wall
.
Extra flags to give to the C++ compiler. E.g., -g
, -O2
, -Wall
.
Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers). E.g., -I.
, -I$(srcdir)
, -DHAVE_CONFIG_H
.
Extra flags to give to compilers when they are supposed to invoke the linker, ld
, such as -L
. Libraries (-lfoo
) should be added to the LDLIBS variable instead. E.g., -L/usr/local/lib
.
Library flags or names given to compilers when they are supposed to invoke the linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS variable. E.g., -lmylib
.
Ultimately, the order they are included in the compilation command within the Makefile corresponds to the compiler and linker being used. The reference to the clang compiler can be found here.