diff --git a/configure.ac b/configure.ac index 9973fe8fe..90bce2208 100644 --- a/configure.ac +++ b/configure.ac @@ -322,6 +322,16 @@ _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-parentheses-equality) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_PARSER,-Wno-unused) AC_SUBST(CFG_CXXFLAGS_PARSER) +# Flags for compiling the debug version of Verilator (in addition to above CFG_CXXFLAGS_SRC) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-Og) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-ggdb) +_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_DEBUG,-gz) +AC_SUBST(CFG_CXXFLAGS_DEBUG) + +# Flags for linking the debug version of Verilator (in addition to above CFG_LDFLAGS_SRC) +_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_DEBUG,-gz) +AC_SUBST(CFG_LDFLAGS_DEBUG) + # Flags for Verilated makefile # For example, -Wno-div-by-zero isn't in 4.1.2 # Random code often does / 0. Unfortunately VL_DIV_I(0,0) will warn diff --git a/src/Makefile_obj.in b/src/Makefile_obj.in index fcd977e14..5fc473131 100644 --- a/src/Makefile_obj.in +++ b/src/Makefile_obj.in @@ -77,13 +77,11 @@ TGT = ../../verilator_bin$(EXEEXT) ################# ifeq ($(VL_DEBUG),) # Optimize -COPT = -O2 +CPPFLAGS += -O2 else # Debug -COPT = -ggdb -DVL_DEBUG -D_GLIBCXX_DEBUG -# Debug & Profile: -#LDFLAGS += -pg -g -#COPT = -ggdb -pg -g +CPPFLAGS += @CFG_CXXFLAGS_DEBUG@ -DVL_DEBUG -D_GLIBCXX_DEBUG +LDFLAGS += @CFG_LDFLAGS_DEBUG@ endif ################# @@ -96,7 +94,6 @@ LIBS = $(CFG_LIBS) -lm CPPFLAGS += -MMD CPPFLAGS += -I. -I$(bldsrc) -I$(srcdir) -I$(incdir) -I../../include #CPPFLAGS += -DVL_LEAK_CHECKS # If running valgrind or other hunting tool -CPPFLAGS += $(COPT) CPPFLAGS += -MP # Only works on recent GCC versions ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users CPPFLAGS += -W -Wall $(CFG_CXXFLAGS_WEXTRA) $(CFG_CXXFLAGS_SRC) -Werror