[LLVMdev] BuildMode

David A. Greene greened at obbligato.org
Mon Jun 25 15:43:38 PDT 2007


I'm continuing my quest to integrate _GLIBCXX_DEBUG into the config system.
I now have things at a point where I can configure llvm to build with 
-D_GLIBCXX_DEBUG and the llvm-gcc will pick up the correct CPPFLAGS
automatically.

One thing I noticed in the llvm Makefile.rules is this:

# If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
# then disable assertions by defining the appropriate preprocessor symbols.
ifdef DISABLE_ASSERTIONS
  BuildMode := $(BuildMode)-Asserts
[...]
else
[...]
endif

This seems backward to make.  If I configure with --disable-assertions I would
expect the build to be in a directory called Debug.  If I --enable-asserts
(the default), I would expect it in Debug-Asserts.  But this logic does just
the opposite.  So I changed it in my copy to do what I expected (and changed
the llvm-gcc configuration correspondingly).

Is this what was intended and the above code is a bug or did I misinterpret
something?

Now in the llvm Makefile:

# NOTE: This needs to remain as the last target definition in this file so
# that it gets executed last.
all:: 
	$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
ifeq ($(BuildMode),Debug)
	$(Echo) '*****' Note: Debug build can be 10 times slower than an
	$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
	$(Echo) '*****' make an optimized build.
endif

This is the only place I can find AssertMode mentioned.  I would much rather
keep things specified in BuildMode.  I add "-ExpensiveChecks" to BuildMode
when --enable-expensive-checks is passed to configure (it is off by default).
This is what turns on -D_GLIBCXX_DEBUG.  That way I can keep around Debug
builds with and without expensive run-time checks.

In summary, it looks like the build system is a little confused and perhaps
some changes were started in the past but never completed (AssertMode,
etc.).  I tried to clean things up to be consistent and straightforward.  Does
it look ok to everyone?

                                            -Dave



More information about the llvm-dev mailing list