2006-07-06 23:20:14 +00:00
|
|
|
#
|
2012-10-18 14:17:40 +00:00
|
|
|
# Asterisk -- An open source telephony toolkit.
|
2017-12-22 14:23:22 +00:00
|
|
|
#
|
2006-07-06 23:20:14 +00:00
|
|
|
# Makefile rules
|
|
|
|
#
|
2010-04-02 18:57:58 +00:00
|
|
|
# Copyright (C) 2006-2010, Digium, Inc.
|
2006-07-06 23:20:14 +00:00
|
|
|
#
|
|
|
|
# Kevin P. Fleming <kpfleming@digium.com>
|
|
|
|
#
|
|
|
|
# This program is free software, distributed under the terms of
|
|
|
|
# the GNU General Public License
|
|
|
|
#
|
|
|
|
|
2006-07-16 22:24:39 +00:00
|
|
|
# Each command is preceded by a short comment on what to do.
|
|
|
|
# Prefixing one or the other with @\# or @ or nothing makes the desired
|
|
|
|
# behaviour. ECHO_PREFIX prefixes the comment, CMD_PREFIX prefixes the command.
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2006-09-09 03:27:21 +00:00
|
|
|
-include $(ASTTOPDIR)/makeopts
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2016-07-24 23:27:26 +00:00
|
|
|
# Helpful functions
|
|
|
|
# call with $(call function,...)
|
|
|
|
tolower = $(shell echo $(1) | tr '[:upper:]' '[:lower:]')
|
2018-08-01 04:54:11 +00:00
|
|
|
# Takes a list of MENUSELECT_CFLAG Id and returns CFLAGS to declare
|
|
|
|
# the ones which are enabled.
|
|
|
|
get_menuselect_cflags=$(patsubst %,-D%,$(filter $1,$(MENUSELECT_CFLAGS)))
|
2016-07-24 23:27:26 +00:00
|
|
|
|
2007-10-01 21:54:41 +00:00
|
|
|
.PHONY: dist-clean
|
|
|
|
|
2008-11-26 19:08:56 +00:00
|
|
|
# If 'make' decides to create intermediate files to satisfy a build requirement
|
|
|
|
# (like producing a .i from a .c), we want to keep them, so tell make to keep
|
|
|
|
# all intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2007-11-05 16:41:39 +00:00
|
|
|
# extra cflags to build dependencies. Recursively expanded.
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
MAKE_DEPS=-MD -MT $@ -MF .$(subst /,_,$@).d -MP
|
2007-11-05 16:41:39 +00:00
|
|
|
|
2015-10-10 20:20:55 +00:00
|
|
|
ifeq ($(findstring ADDRESS_SANITIZER,$(MENUSELECT_CFLAGS)),ADDRESS_SANITIZER)
|
|
|
|
_ASTLDFLAGS+=-fsanitize=address
|
|
|
|
_ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring THREAD_SANITIZER,$(MENUSELECT_CFLAGS)),THREAD_SANITIZER)
|
|
|
|
_ASTLDFLAGS+=-fsanitize=thread -pie -fPIE
|
|
|
|
_ASTCFLAGS+=-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring LEAK_SANITIZER,$(MENUSELECT_CFLAGS)),LEAK_SANITIZER)
|
|
|
|
_ASTLDFLAGS+=-fsanitize=leak
|
|
|
|
_ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=leak
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring UNDEFINED_SANITIZER,$(MENUSELECT_CFLAGS)),UNDEFINED_SANITIZER)
|
|
|
|
_ASTLDFLAGS+=-fsanitize=undefined
|
|
|
|
_ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=undefined
|
|
|
|
endif
|
|
|
|
|
2006-07-16 22:24:39 +00:00
|
|
|
ifeq ($(NOISY_BUILD),)
|
2007-11-05 16:41:39 +00:00
|
|
|
ECHO_PREFIX=@
|
|
|
|
CMD_PREFIX=@
|
2006-07-16 22:24:39 +00:00
|
|
|
else
|
2017-12-22 14:23:22 +00:00
|
|
|
ECHO_PREFIX=@\#
|
2007-11-05 16:41:39 +00:00
|
|
|
CMD_PREFIX=
|
2006-07-16 22:24:39 +00:00
|
|
|
endif
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2014-03-02 17:03:56 +00:00
|
|
|
OPTIMIZE?=-O3
|
2010-03-09 20:30:03 +00:00
|
|
|
ifneq ($(findstring darwin,$(OSARCH)),)
|
2011-09-19 20:31:09 +00:00
|
|
|
ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
|
|
|
|
# Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip)
|
2010-03-09 20:30:03 +00:00
|
|
|
OPTIMIZE+=-fno-inline-functions
|
|
|
|
endif
|
|
|
|
endif
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
|
2019-04-07 16:36:55 +00:00
|
|
|
# gcc version 8.2.1 and above must have partial-inlining disabled to avoid documented bug.
|
|
|
|
# We must handle cross-compiling and clang so make sure the compiler version string has "gcc"
|
|
|
|
# somewhere in it before testing the version.
|
|
|
|
CC_VERS_STRING=$(shell $(CC) --version | grep -i gcc)
|
|
|
|
ifneq ($(CC_VERS_STRING),)
|
|
|
|
GCC_VER_GTE821:=$(shell expr `echo '$(CC_VERS_STRING)' | cut -d ' ' -f 3 | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 80201)
|
2019-03-07 19:48:04 +00:00
|
|
|
ifeq ($(GCC_VER_GTE821),1)
|
|
|
|
OPTIMIZE+=-fno-partial-inlining
|
|
|
|
endif
|
2019-04-07 16:36:55 +00:00
|
|
|
endif
|
2019-03-07 19:48:04 +00:00
|
|
|
|
2010-07-27 21:16:39 +00:00
|
|
|
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_CODE_COVERAGE),no)
|
2009-07-21 13:28:04 +00:00
|
|
|
_ASTCFLAGS+=$(OPTIMIZE)
|
2009-09-28 19:11:20 +00:00
|
|
|
else
|
|
|
|
_ASTCFLAGS+=-O0
|
2006-08-21 02:11:39 +00:00
|
|
|
endif
|
|
|
|
|
2010-07-27 21:16:39 +00:00
|
|
|
ifeq ($(AST_CODE_COVERAGE),yes)
|
2014-11-12 13:47:30 +00:00
|
|
|
_ASTCFLAGS_COVERAGE=-ftest-coverage -fprofile-arcs
|
2010-07-27 21:16:39 +00:00
|
|
|
_ASTLDFLAGS+=-ftest-coverage -fprofile-arcs
|
2014-11-12 13:47:30 +00:00
|
|
|
else
|
|
|
|
_ASTCFLAGS_COVERAGE=
|
2010-07-27 21:16:39 +00:00
|
|
|
endif
|
|
|
|
|
2010-06-08 15:41:23 +00:00
|
|
|
ifeq ($(findstring $(CONFIG_CFLAGS),$(_ASTCFLAGS)),)
|
|
|
|
_ASTCFLAGS+=$(CONFIG_CFLAGS)
|
|
|
|
endif
|
|
|
|
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
# shortcuts for common combinations of flags; these must be recursively expanded so that
|
|
|
|
# per-target settings will be applied
|
2009-07-21 13:28:04 +00:00
|
|
|
CC_CFLAGS=$(PTHREAD_CFLAGS) $(_ASTCFLAGS) $(ASTCFLAGS)
|
|
|
|
CXX_CFLAGS=$(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_DECLARATION_AFTER_STATEMENT),$(_ASTCFLAGS) $(ASTCFLAGS))
|
2009-03-18 02:21:23 +00:00
|
|
|
|
Update configure.ac/Makefile for clang
Created autoconf/ast_check_raii.m4: contains AST_CHECK_RAII which
checks compiler requirements for RAII:
gcc: -fnested-functions support
clang: -fblocks (and if required -lBlocksRuntime)
The original check was implemented in configure.ac and now has it's
own file. This function also sets C_COMPILER_FAMILY to either gcc or
clang for use by makefile
Created autoconf/ast_check_strsep_array_bounds.m4 (contains
AST_CHECK_STRSEP_ARRAY_BOUNDS):
which checks if clang is able to handle the optimized strsep & strcmp
functions (linux). If not, the standard libc implementation should be
used instead. Clang + the optimized macro's work with:
strsep(char *, char []), but not with strsepo(char *, char *).
Instead of replacing all the occurences throughout the source code,
not using the optimized macro version seemed easier
See 'define __strcmp_gc(s1, s2, l2) in bits/string2.h':
llvm-comment: Normally, this array-bounds warning are suppressed for
macros, so that unused paths like the one that accesses __s1[3] are
not warned about. But if you preprocess manually, and feed the
result to another instance of clang, it will warn about all the
possible forks of this particular if statement. Instead of switching
of this optimization, another solution would be to run the preproces-
sing step with -frewrite-includes, which should preserve enough
information so that clang should still be able to suppress the diag-
nostic at the compile step later on.
See also "https://llvm.org/bugs/show_bug.cgi?id=20144"
See also "https://llvm.org/bugs/show_bug.cgi?id=11536"
Makefile.rules: If C_COMPILER_FAMILY=clang then add two warning
suppressions:
-Wno-unused-value
-Wno-parentheses-equality
In an earlier review (reviewboard: 4550 and 4554), they were deemed a
nuisace and less than benefitial.
configure.ac:
Added AST_CHECK_RAII() see earlier
Added AST_CHECK_STRSEP_ARRAY_BOUNDS() see earlier
Removed moved content
ASTERISK-24917
Change-Id: I12ea29d3bda2254ad3908e279b7effbbac6a97cb
2015-04-20 18:03:56 +00:00
|
|
|
# Clang -Werror warning suppressions
|
|
|
|
ifeq ($(C_COMPILER_FAMILY),clang)
|
|
|
|
CC_CFLAGS+=-Wno-unused-value -Wno-parentheses-equality
|
|
|
|
endif
|
|
|
|
|
2009-03-18 02:21:23 +00:00
|
|
|
ifeq ($(GNU_LD),1)
|
2010-04-08 16:35:10 +00:00
|
|
|
SO_SUPPRESS_SYMBOLS=-Wl,--version-script,$(subst .so,.exports,$@),--warn-common
|
2009-11-30 16:53:10 +00:00
|
|
|
ifneq ($(wildcard $(subst .so,.dynamics,$@)),)
|
|
|
|
SO_SUPPRESS_SYMBOLS+=-Wl,--dynamic-list,$(subst .so,.dynamics,$@)
|
|
|
|
endif
|
2009-03-18 02:21:23 +00:00
|
|
|
endif
|
|
|
|
|
2009-07-21 13:28:04 +00:00
|
|
|
CC_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $(SOLINK) $(SO_SUPPRESS_SYMBOLS) $(ASTLDFLAGS)
|
|
|
|
CXX_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $(SOLINK) $(SO_SUPPRESS_SYMBOLS) $(ASTLDFLAGS)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
CC_LIBS=$(PTHREAD_LIBS) $(LIBS)
|
|
|
|
CXX_LIBS=$(PTHREAD_LIBS) $(LIBS)
|
|
|
|
|
|
|
|
# determine whether to double-compile so that the optimizer can report code path problems
|
2016-03-12 22:02:20 +00:00
|
|
|
# In this case, we run the preprocessor to produce a .i or .ii file from the source
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
# code, then compile once with optimizer enabled (and the output to /dev/null),
|
|
|
|
# and if that doesn't fail then compile again with optimizer disabled
|
2016-03-12 22:02:20 +00:00
|
|
|
|
|
|
|
ifeq ($(findstring COMPILE_DOUBLE,$(MENUSELECT_CFLAGS)),COMPILE_DOUBLE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
COMPILE_DOUBLE=yes
|
2016-03-12 22:02:20 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_DEVMODE),)
|
2014-06-22 18:53:26 +00:00
|
|
|
_ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
|
|
|
|
2012-04-12 15:25:47 +00:00
|
|
|
ifeq ($(findstring BUILD_NATIVE,$(MENUSELECT_CFLAGS)),BUILD_NATIVE)
|
|
|
|
_ASTCFLAGS+=-march=native
|
|
|
|
endif
|
|
|
|
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
%.o: %.s
|
|
|
|
$(ECHO_PREFIX) echo " [AS] $< -> $@"
|
|
|
|
ifeq ($(COMPILE_DOUBLE),yes)
|
2012-02-28 14:47:23 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o /dev/null -c $< $(CC_CFLAGS) $(OPTIMIZE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
|
2007-02-22 02:36:00 +00:00
|
|
|
%.o: %.i
|
2007-11-05 16:41:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [CCi] $< -> $@"
|
2015-03-30 01:57:07 +00:00
|
|
|
ifneq ($(AST_CLANG_BLOCKS),)
|
|
|
|
ifeq ($(COMPILE_DOUBLE),yes)
|
|
|
|
$(CMD_PREFIX) $(CC) -o /dev/null -c $< $(CC_CFLAGS) $(OPTIMIZE) -Wno-unused-command-line-argument
|
|
|
|
endif
|
|
|
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE) -Wno-unused-command-line-argument
|
|
|
|
else
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
ifeq ($(COMPILE_DOUBLE),yes)
|
2012-02-28 14:47:23 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o /dev/null -c $< $(CC_CFLAGS) $(OPTIMIZE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
2015-03-30 01:57:07 +00:00
|
|
|
endif
|
2007-02-22 02:36:00 +00:00
|
|
|
|
2008-11-26 19:08:56 +00:00
|
|
|
ifneq ($(COMPILE_DOUBLE),yes)
|
2008-11-15 19:51:29 +00:00
|
|
|
%.o: %.c
|
|
|
|
$(ECHO_PREFIX) echo " [CC] $< -> $@"
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(MAKE_DEPS) $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
2008-11-15 19:51:29 +00:00
|
|
|
|
2007-02-22 02:36:00 +00:00
|
|
|
%.i: %.c
|
2007-11-05 16:41:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [CPP] $< -> $@"
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o $@ -E $< $(MAKE_DEPS) $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
2007-02-22 02:36:00 +00:00
|
|
|
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
%.oo: %.ii
|
|
|
|
$(ECHO_PREFIX) echo " [CXXi] $< -> $@"
|
|
|
|
ifeq ($(COMPILE_DOUBLE),yes)
|
2012-02-28 14:47:23 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o /dev/null -c $< $(CXX_CFLAGS) $(OPTIMIZE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
2007-01-03 03:28:12 +00:00
|
|
|
|
2008-11-26 19:08:56 +00:00
|
|
|
ifneq ($(COMPILE_DOUBLE),yes)
|
2006-09-29 22:48:43 +00:00
|
|
|
%.oo: %.cc
|
|
|
|
$(ECHO_PREFIX) echo " [CXX] $< -> $@"
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(MAKE_DEPS) $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
Merged revisions 157859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r157859 | kpfleming | 2008-11-19 15:34:47 -0600 (Wed, 19 Nov 2008) | 7 lines
the gcc optimizer frequently finds broken code (use of uninitalized variables, unreachable code, etc.), which is good. however, developers usually compile with the optimizer turned off, because if they need to debug the resulting code, optimized code makes that process very difficult. this means that we get code changes committed that weren't adequately checked over for these sorts of problems.
with this build system change, if (and only if) --enable-dev-mode was used and DONT_OPTIMIZE is turned on, when a source file is compiled it will actually be preprocessed (into a .i or .ii file), then compiled once with optimization (with the result sent to /dev/null) and again without optimization (but only if the first compile succeeded, of course).
while making these changes, i did some cleanup work in Makefile.rules to move commonly-used combinations of flag variables into their own variables, to make the file easier to read and maintain
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 00:08:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
%.ii: %.cc
|
|
|
|
$(ECHO_PREFIX) echo " [CPP] $< -> $@"
|
2014-11-12 13:47:30 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o $@ -E $< $(MAKE_DEPS) $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2006-09-29 22:48:43 +00:00
|
|
|
%.so: %.o
|
2010-04-02 18:57:58 +00:00
|
|
|
ifeq ($(GNU_LD),1)
|
2010-04-08 16:35:10 +00:00
|
|
|
$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
|
2010-04-02 18:57:58 +00:00
|
|
|
endif
|
2006-09-29 22:48:43 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
|
2018-07-17 10:24:02 +00:00
|
|
|
$(CMD_PREFIX) $(CC) -o $@ $(CC_LDFLAGS_SO) $^ $(CC_LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2007-01-03 03:28:12 +00:00
|
|
|
%.so: %.oo
|
2010-04-02 18:57:58 +00:00
|
|
|
ifeq ($(GNU_LD),1)
|
2010-04-08 16:35:10 +00:00
|
|
|
$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
|
2010-04-02 18:57:58 +00:00
|
|
|
endif
|
2006-09-29 22:48:43 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LDXX] $^ -> $@"
|
2018-07-17 10:24:02 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o $@ $(CXX_LDFLAGS_SO) $^ $(CXX_LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2006-09-29 22:48:43 +00:00
|
|
|
%: %.o
|
|
|
|
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
|
2018-07-17 10:24:02 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) -o $@ $(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $^ $(CXX_LIBS) $(ASTLDFLAGS)
|
2007-10-01 21:54:41 +00:00
|
|
|
|
2008-11-15 19:45:19 +00:00
|
|
|
dist-clean:: clean
|