Krolyxon
Commit 657080a

Branches

Refs →

nsxiv657080a

config.mk: default to `-O2` and `-DNDEBUG` (#435)

assertions are for debugging purposes, and so shouldn't be enabled for
"release" builds. disable it by default by using `-DNDEBUG`.

`-O2` on gcc/clang will result it slightly better binary. on tcc it'll
be ignored. and since -O is specified by POSIX there shouldn't be any
portability concern.

additionally add a (commented out) recommended debug build for gcc/clang
with address and undefined sanitizers turned on.
Author
NRK
Date
2023-05-09 00:34 +0000
Parent
733916a
Commit
657080a7e55843e351fa6ce41e4ce315eab62b67

+5 −2

1 file changed

  1. M config.mk +5 −2
M config.mk View
@@ -23,8 +23,11 @@ HAVE_LIBWEBP = $(OPT_DEP_DEFAULT)
2323
2424 # Compiler and linker
2525 CC = c99
26−# CFLAGS, any optimization flags goes here
27−CFLAGS = -Wall -pedantic
26+# CFLAGS, any additional compiler flags goes here
27+CFLAGS = -Wall -pedantic -O2 -DNDEBUG
28+# Uncomment for a debug build using gcc/clang
29+# CFLAGS = -Wall -pedantic -g3 -fsanitize=address,undefined
30+# LDFLAGS = $(CFLAGS)
2831
2932 # icons that will be installed via `make icon`
3033 ICONS = 16x16.png 32x32.png 48x48.png 64x64.png 128x128.png