disable optimizations and other costly CFLAGS from demos

Demos must compile as fast as possible, in order to be quick to
reiterate and retest. Given that each needs to link and recompile
amalgamation every time, the difference between -O2 and -O0 is
noticeable. This also slightly affects CI times. This topic was
discussed under several occasions, for example:
https://github.com/Immediate-Mode-UI/Nuklear/pull/894#issuecomment-3880985649
https://github.com/Immediate-Mode-UI/Nuklear/issues/895#issuecomment-3884228468
This commit is contained in:
sleeptightAnsiC
2026-04-21 21:18:42 +02:00
parent a9fef84be2
commit 39688d28ea
5 changed files with 11 additions and 7 deletions
+2 -1
View File
@@ -2,7 +2,8 @@ WAYLAND=`pkg-config wayland-client --cflags --libs`
WAYLAND_SCANNER=wayland-scanner
WAYLAND_PROTOCOLS_DIR=/usr/share/wayland-protocols
CFLAGS+=-std=c99 -Wall -Wextra -pedantic -Wno-unused-function -O3 -fvisibility=hidden
CFLAGS += -std=c99 -Wall -Wextra -pedantic -Wno-unused-function -fvisibility=hidden
#CFLAGS += -O3
.PHONY: clean
+3 -3
View File
@@ -23,9 +23,9 @@ BINEXT := ${binext_${OSNAME}}
TEMPDIR := ./bin
BIN := ${TEMPDIR}/demo${BINEXT}
cflags += -std=c89 -Wall -Wextra -Wpedantic
cflags += -O2
#cflags += -O0 -g
cflags += -std=c89 -Wall -Wextra -pedantic
#cflags += -O2
cflags += -O0 -g
#cflags += -fsanitize=address
#cflags += -fsanitize=undefined
cflags += ${CFLAGS}
+2 -1
View File
@@ -3,6 +3,7 @@ BIN = demo
# Flags
CFLAGS += -std=c89 -Wall -Wextra -pedantic -DSDL_DISABLE_IMMINTRIN_H
#CFLAGS += -Os
SRC = main.c
OBJ = $(SRC:.c=.o)
@@ -18,7 +19,7 @@ $(BIN): prepare
$(CC) $(SRC) $(CFLAGS) -o bin/$(BIN) $(LIBS)
web: prepare
emcc $(SRC) -Os -s USE_SDL=2 -o bin/index.html
emcc $(SRC) $(CFLAGS) -s USE_SDL=2 -o bin/index.html
rpi: prepare
$(CC) $(SRC) $(CFLAGS) -o bin/$(BIN) `PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig/ pkg-config --cflags --libs bcm_host brcmglesv2` `/usr/local/bin/sdl2-config --libs --cflags`
+2 -1
View File
@@ -2,7 +2,8 @@
BIN = demo
# Flags
CFLAGS += -std=c89 -Wall -Wextra -pedantic -O2 -DSDL_DISABLE_IMMINTRIN_H
CFLAGS += -std=c89 -Wall -Wextra -pedantic -DSDL_DISABLE_IMMINTRIN_H
#CFLAGS += -O2
CFLAGS += `sdl2-config --cflags`
SRC = main.c
+2 -1
View File
@@ -2,7 +2,8 @@
BIN = demo
# Flags
CFLAGS += -std=c89 -Wall -Wextra -pedantic -fsanitize=address -O2
CFLAGS += -std=c89 -Wall -Wextra -pedantic
#CFLAGS += -fsanitize=address -O2
CFLAGS += -DSDL_DISABLE_IMMINTRIN_H
SRC = main.c