Some Makefile tweaks.

Change default optimization flag to -O2.

Use XCFLAGS and XCPPFLAGS to add to the definitions:

  make XCPPFLAGS=-I/foo/bar XCFLAGS=-mfoo-bar

Set CFLAGS on the make command line if you want to override completely:

  make CFLAGS="-O3 -m32"

If you want to override them with the system environment variables:

  make CFLAGS="$CFLAGS"
This commit is contained in:
Tor Andersson
2021-03-22 13:51:33 +01:00
parent 625542e463
commit 1616c18484

View File

@@ -15,7 +15,7 @@ endif
# Compiler flags for various configurations:
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
ifeq "$(CC)" "clang"
CFLAGS += -Wunreachable-code
@@ -31,7 +31,7 @@ else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
else ifeq "$(build)" "release"
CFLAGS += -Os
CFLAGS += -O2
LDFLAGS += -Wl,-s
endif
@@ -41,6 +41,7 @@ ifeq "$(HAVE_READLINE)" "yes"
endif
CFLAGS += $(XCFLAGS)
CPPFLAGS += $(XCPPFLAGS)
# You shouldn't need to edit anything below here.