aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile47
-rw-r--r--Makefile.moddir_rules12
-rw-r--r--Makefile.rules12
-rw-r--r--channels/Makefile6
-rw-r--r--codecs/Makefile6
-rw-r--r--codecs/gsm/Makefile7
-rw-r--r--main/Makefile8
-rw-r--r--main/db1-ast/Makefile6
-rw-r--r--pbx/Makefile6
-rw-r--r--utils/Makefile10
10 files changed, 71 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 064475280..b38133a72 100644
--- a/Makefile
+++ b/Makefile
@@ -13,14 +13,43 @@
# All Makefiles use the following variables:
#
-# LDFLAGS - linker flags (not libraries), used for all links
+# ASTCFLAGS - compiler options
+# ASTLDFLAGS - linker flags (not libraries)
# LIBS - additional libraries, at top-level for all links,
# on a single object just for that object
# SOLINK - linker flags used only for creating shared objects (.so files),
# used for all .so links
#
-
-.EXPORT_ALL_VARIABLES:
+# Default values fo ASTCFLAGS and ASTLDFLAGS can be specified in the
+# environment when running make, as follows:
+#
+# $ ASTCFLAGS="-Werror" make
+
+export ASTTOPDIR
+export ASTERISKVERSION
+export ASTERISKVERSIONNUM
+export INSTALL_PATH
+export ASTETCDIR
+export ASTVARRUNDIR
+export MODULES_DIR
+export ASTSPOOLDIR
+export ASTVARLIBDIR
+export ASTDATADIR
+export ASTLOGDIR
+export AGI_DIR
+export ASTCONFPATH
+export NOISY_BUILD
+export MENUSELECT_CFLAGS
+export CC
+export CXX
+export AR
+export RANLIB
+export HOST_CC
+export STATIC_BUILD
+export INSTALL
+export DESTDIR
+export PROC
+export SOLINK
# even though we could use '-include makeopts' here, use a wildcard
# lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -92,8 +121,6 @@ HTTP_DOCSDIR=/var/www/html
# Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
HTTP_CGIDIR=/var/www/cgi-bin
-ASTCFLAGS=
-
# Uncomment this to use the older DSP routines
#ASTCFLAGS+=-DOLD_DSP_ROUTINES
@@ -275,10 +302,10 @@ $(SUBDIRS): depend makeopts.embed_rules
main: $(filter-out main,$(MOD_SUBDIRS))
$(MOD_SUBDIRS):
- @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
+ @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
$(OTHER_SUBDIRS):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
+ @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
defaults.h: makeopts
@build_tools/make_defaults_h > $@.tmp
@@ -588,10 +615,10 @@ config:
fi
$(MOD_SUBDIRS_DEPEND):
- @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
+ @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
$(OTHER_SUBDIRS_DEPEND):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
+ @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
@@ -646,7 +673,7 @@ menuselect: menuselect/menuselect menuselect-tree
-@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
- @unset CC LD AR RANLIB CFLAGS LDFLAGS && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
+ @unset CC LD AR RANLIB && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
@echo "Generating input for menuselect ..."
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 5f60470c8..2144e50a2 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -12,11 +12,11 @@
#
ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
- CFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
+ ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
endif
ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
- CFLAGS+=${GC_CFLAGS}
+ ASTCFLAGS+=${GC_CFLAGS}
endif
ifneq ($(findstring STATIC_BUILD,$(MENUSELECT_CFLAGS)),)
@@ -29,14 +29,14 @@ comma:=,
define module_o_template
$(2): $(3)
-$(2): CFLAGS+=-DAST_MODULE=\"$(1)\" $$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
+$(2): ASTCFLAGS+=-DAST_MODULE=\"$(1)\" $$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
endef
define module_so_template
$(1)=$(1).so
-$(1).so: CFLAGS+=-fPIC
+$(1).so: ASTCFLAGS+=-fPIC
$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
-$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
+$(1).so: ASTLDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
$(1).so: $(2)
endef
@@ -102,4 +102,4 @@ endif
depend: .depend
.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c *.cc 2> /dev/null`
+ ../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`
diff --git a/Makefile.rules b/Makefile.rules
index d4df7053c..cdad748df 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -33,19 +33,19 @@ ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
#K6OPT=-DK6OPT
OPTIMIZE?=-O6
-CFLAGS+=$(OPTIMIZE)
+ASTCFLAGS+=$(OPTIMIZE)
endif
define ast_make_o_c
$(1): $(2)
$(ECHO_PREFIX) echo " [CC] $$< -> $$@"
- $(CMD_PREFIX) $$(CC) -o $$@ -c $$< $$(CFLAGS)
+ $(CMD_PREFIX) $$(CC) -o $$@ -c $$< $$(ASTCFLAGS)
endef
define ast_make_oo_cc
$(1): $(2)
$(ECHO_PREFIX) echo " [CXX] $$< -> $$@"
- $(CMD_PREFIX) $$(CXX) -o $$@ -c $$< $$(CFLAGS)
+ $(CMD_PREFIX) $$(CXX) -o $$@ -c $$< $$(ASTCFLAGS)
endef
define ast_make_c_y
@@ -63,13 +63,13 @@ endef
define ast_make_so_o
$(1): $(2)
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
- $(CMD_PREFIX) $$(CC) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CC) $$(STATIC_BUILD) -o $$@ $$(ASTLDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef
define ast_make_so_oo
$(1): $(2)
$(ECHO_PREFIX) echo " [LDXX] $$^ -> $$@"
- $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(ASTLDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef
define ast_make_a_o
@@ -82,7 +82,7 @@ endef
define ast_make_final
$(1): $(2)
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
- $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(ASTLDFLAGS) $$^ $$(LIBS)
endef
define ast_make_final_host
diff --git a/channels/Makefile b/channels/Makefile
index b5f55a368..6c10010a9 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -65,7 +65,7 @@ clean::
ifneq ($(wildcard h323/Makefile.ast),)
include h323/Makefile.ast
-H323LDFLAGS += -Wl,--version-script=h323/noexport.map
+H323LDFLAGS+=-Wl,--version-script=h323/noexport.map
clean::
$(MAKE) -C h323 clean
else
@@ -105,8 +105,8 @@ chan_h323.so: chan_h323.o h323/libchanh323.a
$(CMD_PREFIX) $(CXX) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
endif
-chan_misdn.o: CFLAGS+=-Imisdn
+chan_misdn.o: ASTCFLAGS+=-Imisdn
-misdn_config.o: CFLAGS+=-Imisdn
+misdn_config.o: ASTCFLAGS+=-Imisdn
$(chan_misdn): chan_misdn.o misdn_config.o misdn/isdn_lib.o misdn/isdn_msg_parser.o
diff --git a/codecs/Makefile b/codecs/Makefile
index cdc581d3d..8996ad452 100644
--- a/codecs/Makefile
+++ b/codecs/Makefile
@@ -42,14 +42,14 @@ clean::
gsm/lib/libgsm.a:
@mkdir -p gsm/lib
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS) -I." $(MAKE) -C gsm lib/libgsm.a
+ @$(MAKE) -C gsm lib/libgsm.a
$(LIBLPC10):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C lpc10 all
+ @$(MAKE) -C lpc10 all
$(codec_lpc10): $(LIBLPC10)
$(LIBILBC):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)" $(MAKE) -C ilbc all
+ @$(MAKE) -C ilbc all
$(codec_ilbc): $(LIBILBC)
diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
index 036bb530a..ba3a20062 100644
--- a/codecs/gsm/Makefile
+++ b/codecs/gsm/Makefile
@@ -72,7 +72,6 @@ PG =
# CCFLAGS = -c -O
CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops $(OPTIMIZE)
-CCFLAGS += -fPIC
# LD = gcc
# LDFLAGS =
@@ -155,7 +154,7 @@ INC = $(ROOT)/inc
DEBUG = -DNDEBUG
######### Remove -DNDEBUG to enable assertions.
-CFLAGS += $(PG) $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) \
+ASTCFLAGS += $(PG) $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) \
$(LTP_CUT) $(WAV49) $(K6OPT) $(CCINC) -I$(INC)
######### It's $(CC) $(CFLAGS)
@@ -319,10 +318,6 @@ TOAST_INSTALL_TARGETS = \
# Default rules
-.c.o:
- $(CC) $(CFLAGS:-Werror=) $?
- @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
-
include $(ASTTOPDIR)/Makefile.rules
# Target rules
diff --git a/main/Makefile b/main/Makefile
index b615c3b65..f7537b5c9 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -90,11 +90,11 @@ ifeq ($(OSARCH),SunOS)
endif
editline/libedit.a:
- cd editline && unset CFLAGS AST_LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)
+ cd editline && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)
$(MAKE) -C editline libedit.a
db1-ast/libdb1.a:
- CFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
+ CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
ast_expr2.c ast_expr2.h:
bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
@@ -108,7 +108,7 @@ testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
rm ast_expr2.o ast_expr2f.o
-channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
+channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
@@ -130,7 +130,7 @@ asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
@rm -f $(ASTTOPDIR)/include/asterisk/build.h.tmp
@$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
- $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(LDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
+ $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
@$(ASTTOPDIR)/build_tools/strip_nonapi $@
clean::
diff --git a/main/db1-ast/Makefile b/main/db1-ast/Makefile
index 3e5a6fb2d..4fb92fc3c 100644
--- a/main/db1-ast/Makefile
+++ b/main/db1-ast/Makefile
@@ -10,7 +10,7 @@ endif
#Added support for UltraSparc - Belgarath
ifeq ($(ARCH),sparc64)
PROC=ultrasparc
-CFLAGS += -mtune=$(PROC) -pipe -fomit-frame-pointer -mcpu=v8
+ASTCFLAGS += -mtune=$(PROC) -pipe -fomit-frame-pointer -mcpu=v8
endif
ifeq ($(OSARCH),Darwin)
@@ -50,11 +50,11 @@ clean-depend:
clean:
rm -f $(LIBDB) $(LIBDBSO) $(OBJS) $(SHOBJS)
-CFLAGS+=-Wall -D__DBINTERFACE_PRIVATE -I. -I.. -Iinclude -Ihash -Ibtree -Irecno
+ASTCFLAGS+=-Wall -D__DBINTERFACE_PRIVATE -I. -I.. -Iinclude -Ihash -Ibtree -Irecno
OSTYPE=$(shell uname -s)
ifeq ($(OSTYPE),SunOS)
-CFLAGS+=-I../../include -I../../include/solaris-compat -DSOLARIS
+ASTCFLAGS+=-I../../include -I../../include/solaris-compat -DSOLARIS
endif
db_dump185.o: db_dump185.c
diff --git a/pbx/Makefile b/pbx/Makefile
index 056e2040b..43812f1dc 100644
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -29,10 +29,10 @@ clean::
rm -f ael/*.o
$(eval $(call ast_make_o_c,ael/aelflex.o,ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h))
-ael/aelflex.o: CFLAGS+=-I.
+ael/aelflex.o: ASTCFLAGS+=-I.
$(eval $(call ast_make_o_c,ael/aelbison.o,ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h))
-ael/aelbison.o: CFLAGS+=-I.
+ael/aelbison.o: ASTCFLAGS+=-I.
$(pbx_ael): ael/aelbison.o ael/aelflex.o
@@ -43,6 +43,6 @@ ael/ael.tab.c ael/ael.tab.h:
(cd ael; bison -v -d ael.y)
dundi-parser.o: dundi-parser.h
-dundi-parser.o: CFLAGS+=-I.
+dundi-parser.o: ASTCFLAGS+=-I.
$(pbx_dundi): dundi-parser.o
diff --git a/utils/Makefile b/utils/Makefile
index 084a01ab1..5e5bdca88 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -71,18 +71,18 @@ $(eval $(call ast_make_o_c,strcompat.o,../main/strcompat.c))
$(eval $(call ast_make_o_c,ast_expr2.o,../main/ast_expr2.c))
$(eval $(call ast_make_o_c,ast_expr2f.o,../main/ast_expr2f.c))
-ast_expr2f.o: CFLAGS+=-DSTANDALONE_AEL
+ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL
$(eval $(call ast_make_final,check_expr,check_expr.c ast_expr2.o ast_expr2f.o))
$(eval $(call ast_make_o_c,aelflex.o,../pbx/ael/ael_lex.c ../include/asterisk/ael_structs.h ../pbx/ael/ael.tab.h))
-aelflex.o: CFLAGS+=-I../pbx -DSTANDALONE_AEL
+aelflex.o: ASTCFLAGS+=-I../pbx -DSTANDALONE_AEL
$(eval $(call ast_make_o_c,aelbison.o,../pbx/ael/ael.tab.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h))
-aelbison.o: CFLAGS+=-I../pbx
+aelbison.o: ASTCFLAGS+=-I../pbx
$(eval $(call ast_make_o_c,pbx_ael.o,../pbx/pbx_ael.c))
-pbx_ael.o: CFLAGS+=-DSTANDALONE_AEL
+pbx_ael.o: ASTCFLAGS+=-DSTANDALONE_AEL
$(eval $(call ast_make_final,aelparse,aelflex.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o))
@@ -110,4 +110,4 @@ endif
depend: .depend
.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
+ ../build_tools/mkdep $(ASTCFLAGS) `ls *.c`