From d4b3eeee7c5191da4447855a03c2e8862908b233 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sat, 23 Jul 2022 10:31:57 -0400 Subject: [PATCH] add CHECK_UNINITIALIZED make option --- Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4b94551..7e0d5ac 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,20 @@ LIBDIR := ext/tangerine LIB := $(LIBDIR)/build/libTangerine.a CXX := g++ -# NOTE: have to set -O or -O1 here to get warnings for uninitialized variables -CXXFLAGS := -std=c++11 -g -ggdb3 -O -Wall -Wuninitialized \ - -I$(LIBDIR)/include/ \ +# NOTE: due to a longstanding 'bug' in gcc, we can only check for unitialized +# variables if an optimization pass is run. However, compiling without +# optimization is useful for debugging, so we can add some local variables +# for easier inspection. +# see) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501 +CHECK_UNITIALIZED := false +ifeq ($(CHECK_UNITIALIZED), true) + CXXFLAGS := -std=c++11 -g -ggdb3 -O -Wall +else + CXXFLAGS := -std=c++11 -g -ggdb3 -Wall +endif +CXXFLAGS += -I$(LIBDIR)/include/ \ $(shell sdl2-config --cflags) + LDFLAGS := $(shell sdl2-config --libs) -lGLEW -lGL COMMON_SOURCES := $(SRCDIR)/orbits.cpp