[sr-dev] git:master: makefile: use separate CFLAGS & LDFLAGS for utils

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Oct 8 17:45:43 CEST 2009


Module: sip-router
Branch: master
Commit: 89d400689357f919ed0cd200e3b0576ffa79d1c3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=89d400689357f919ed0cd200e3b0576ffa79d1c3

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Oct  8 17:45:44 2009 +0200

makefile: use separate CFLAGS & LDFLAGS for utils

- added UTILS_CFLAGS and UTILS_LDFLAGS (Makefile.defs and saved in
  the config)
- use UTILS_CFLAGS and UTILS_LDFLAGS when compiling the utils
(fixes a bug when an util compiled by a module will be compiled
 with the module flags)

---

 Makefile.defs  |    9 ++++++---
 Makefile.utils |    6 +++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Makefile.defs b/Makefile.defs
index 88abb70..f883a0b 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -1528,7 +1528,7 @@ endif # CC_NAME=suncc
 endif # CC_NAME=icc
 endif # CC_NAME=gcc
 
-#*FLAGS used for compiling the modules
+#CFLAGS used for compiling the modules, libraries and utils
 ifeq	($(CC_NAME), gcc)
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
 LIB_CFLAGS=-fPIC -DPIC $(CFLAGS)
@@ -1542,6 +1542,9 @@ ifeq	($(CC_NAME), suncc)
 MOD_CFLAGS=-xcode=pic32  $(CFLAGS)
 LIB_CFLAGS=-xcode=pic32  $(CFLAGS)
 endif
+UTILS_CFLAGS=$(CFLAGS)
+# LDFLAGS uses for compiling the utils
+UTILS_LDFLAGS=$(LDFLAGS)
 
 ifeq ($(LEX),)
 	LEX=flex
@@ -1891,7 +1894,7 @@ export exported_vars
 saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
 		RELEASE OS ARCH \
 		C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
-		MOD_LDFLAGS LIB_LDFLAGS LIB_SONAME LD_RPATH \
+		MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
 		LIB_SUFFIX LIB_PREFIX \
 		LIBS \
 		LEX YACC YACC_FLAGS \
@@ -1903,7 +1906,7 @@ saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
 # variable changeable at compile time
 # extra: prefix DESTDIR BASEDIR basedirt
 saved_chg_vars:=\
-		CC_EXTRA_OPTS CPU CFLAGS_RM CFLAGS MOD_CFLAGS LIB_CFLAGS	\
+		CC_EXTRA_OPTS CPU CFLAGS_RM CFLAGS MOD_CFLAGS LIB_CFLAGS UTILS_CFLAGS \
 		BASEDIR basedir DESTDIR \
 		PREFIX prefix\
 		cfg_prefix cfg_dir bin_prefix bin_dir modules_prefix modules_dir \
diff --git a/Makefile.utils b/Makefile.utils
index 3f48660..570a9ef 100644
--- a/Makefile.utils
+++ b/Makefile.utils
@@ -40,7 +40,7 @@ override static_modules=
 override static_modules_path=
 
 # temporary def (visible only in the util makefile, not exported)
-DEFS +=
+DEFS += -DMOD_NAME="utils/$(UTIL_NAME)"
 
 ifneq ($(makefile_defs_included),1)
 $(error "the local makefile does not include Makefile.defs!")
@@ -63,6 +63,10 @@ include $(COREPATH)/Makefile.sources
 # the rest of makefile and try only to remake the config
 ifeq ($(makefile_defs),1)
 
+# set CFLAGS & LDFLAGS
+CFLAGS:=$(UTILS_CFLAGS)
+LDFLAGS:=$(UTILS_LDFLAGS)
+
 err_fail?=1
 
 include $(COREPATH)/Makefile.dirs




More information about the sr-dev mailing list