From 39688d28eaecc33cfd0736c74ca2edf6161f58e3 Mon Sep 17 00:00:00 2001 From: sleeptightAnsiC <91839286+sleeptightAnsiC@users.noreply.github.com> Date: Tue, 21 Apr 2026 21:18:42 +0200 Subject: [PATCH] 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 --- demo/rawfb/wayland/Makefile | 3 ++- demo/sdl3_renderer/Makefile | 6 +++--- demo/sdl_opengles2/Makefile | 3 ++- demo/sdl_renderer/Makefile | 3 ++- demo/sdl_vulkan/Makefile | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/demo/rawfb/wayland/Makefile b/demo/rawfb/wayland/Makefile index 809bd6df..d633f9ea 100644 --- a/demo/rawfb/wayland/Makefile +++ b/demo/rawfb/wayland/Makefile @@ -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 diff --git a/demo/sdl3_renderer/Makefile b/demo/sdl3_renderer/Makefile index 48ee50e1..6022302a 100644 --- a/demo/sdl3_renderer/Makefile +++ b/demo/sdl3_renderer/Makefile @@ -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} diff --git a/demo/sdl_opengles2/Makefile b/demo/sdl_opengles2/Makefile index b97ada72..b445c779 100644 --- a/demo/sdl_opengles2/Makefile +++ b/demo/sdl_opengles2/Makefile @@ -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` diff --git a/demo/sdl_renderer/Makefile b/demo/sdl_renderer/Makefile index b3efdb8c..b02f71b7 100644 --- a/demo/sdl_renderer/Makefile +++ b/demo/sdl_renderer/Makefile @@ -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 diff --git a/demo/sdl_vulkan/Makefile b/demo/sdl_vulkan/Makefile index 2d8444b6..33e2a701 100644 --- a/demo/sdl_vulkan/Makefile +++ b/demo/sdl_vulkan/Makefile @@ -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