llvm.org GIT mirror llvm / dbefd0c
Add a --enable-profiling option to configure to build Debug+Profile and Opt+Profile tools. Now we can profile any kind of flavor we build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69351 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 10 years ago
3 changed file(s) with 47 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
214214 #ENABLE_OPTIMIZED = 1
215215 @ENABLE_OPTIMIZED@
216216
217 # When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
217 # When ENABLE_PROFILING is enabled, profile instrumentation is done
218 # and output is put into the "+Profile" directories, where
219 # is either Debug or Release depending on how other builkd
220 # flags are set.. Otherwise, output is put in the
221 # directories.
222 #ENABLE_PROFILING = 1
223 @ENABLE_PROFILING@
224
225 # When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
218226 # exclude assertion checks, otherwise they are included.
219227 #DISABLE_ASSERTIONS = 1
220228 @DISABLE_ASSERTIONS@
236236 OPTIMIZE_OPTION := -O3
237237 endif
238238
239 ifdef ENABLE_PROFILING
240 BuildMode := Profile
241 CXX.Flags += $(OPTIMIZE_OPTION) -pg -g
242 C.Flags += $(OPTIMIZE_OPTION) -pg -g
243 LD.Flags += $(OPTIMIZE_OPTION) -pg -g
239 ifeq ($(ENABLE_OPTIMIZED),1)
240 BuildMode := Release
241 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
242 ifneq ($(OS),FreeBSD)
243 ifneq ($(OS),Darwin)
244 OmitFramePointer := -fomit-frame-pointer
245 endif
246 endif
247
248 # Darwin requires -fstrict-aliasing to be explicitly enabled.
249 ifeq ($(OS),Darwin)
250 EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
251 endif
252 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
253 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
254 LD.Flags += $(OPTIMIZE_OPTION)
255 else
256 BuildMode := Debug
257 CXX.Flags += -g
258 C.Flags += -g
259 LD.Flags += -g
244260 KEEP_SYMBOLS := 1
245 else
246 ifeq ($(ENABLE_OPTIMIZED),1)
247 BuildMode := Release
248 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
249 ifneq ($(OS),FreeBSD)
250 ifneq ($(OS),Darwin)
251 OmitFramePointer := -fomit-frame-pointer
252 endif
253 endif
254
255 # Darwin requires -fstrict-aliasing to be explicitly enabled.
256 ifeq ($(OS),Darwin)
257 EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
258 endif
259
260 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
261 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
262 LD.Flags += $(OPTIMIZE_OPTION)
263 else
264 BuildMode := Debug
265 CXX.Flags += -g
266 C.Flags += -g
267 LD.Flags += -g
268 KEEP_SYMBOLS := 1
269 endif
261 endif
262
263 ifeq ($(ENABLE_PROFILING),1)
264 BuildMode := $(BuildMode)+Profile
265 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
266 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
267 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
268 KEEP_SYMBOLS := 1
270269 endif
271270
272271 #ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
282282 AC_SUBST(ENABLE_OPTIMIZED,[[]])
283283 else
284284 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
285 fi
286
287 dnl --enable-profiling : check whether they want to do a profile build:
288 AC_ARG_ENABLE(profiling, AS_HELP_STRING(
289 [--enable-profiling,Compile with profiling enabled (default is NO)]),,enableval="no")
290 if test ${enableval} = "no" ; then
291 AC_SUBST(ENABLE_PROFILING,[[]])
292 else
293 AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]])
285294 fi
286295
287296 dnl --enable-assertions : check whether they want to turn on assertions or not: