Message ID | 8120ddaf0bdfd50e0fc4cf9a04f833102630b639.1718001244.git.ps@pks.im (mailing list archive) |
---|---|
State | Accepted |
Commit | 1d969afb785a86ad9851c6e1c3253cc11f8507dd |
Headers | show |
Series | ci: detect more warnings via `-Og` | expand |
diff --git a/Makefile b/Makefile index 2f5f16847a..9cd3b252ff 100644 --- a/Makefile +++ b/Makefile @@ -1446,8 +1446,8 @@ ALL_COMMANDS_TO_INSTALL += git-upload-archive$(X) ALL_COMMANDS_TO_INSTALL += git-upload-pack$(X) endif -ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -ALL_LDFLAGS = $(LDFLAGS) +ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_APPEND) +ALL_LDFLAGS = $(LDFLAGS) $(LDFLAGS_APPEND) ifdef SANITIZE SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
There are some usecases where we may want to append CFLAGS to the default CFLAGS set by Git. This could for example be to enable or disable specific compiler warnings or to change the optimization level that code is compiled with. This cannot be done without overriding the complete CFLAGS value though and thus requires the user to redeclare the complete defaults used by Git. Introduce a new variable `CFLAGS_APPEND` that gets appended to the default value of `CFLAGS`. As compiler options are last-one-wins, this fulfills both of the usecases mentioned above. It's also common practice across many other projects to have such a variable. While at it, also introduce a matching `LDFLAGS_APPEND` variable. While there isn't really any need for this variable as there are no default `LDFLAGS`, users may expect this variable to exist, as well. Signed-off-by: Patrick Steinhardt <ps@pks.im> --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)