use LDFLAGS and LIBS properly, and allow dependencies to provide LDFLAGS if needed...
authorKevin P. Fleming <kpfleming@digium.com>
Sat, 15 Jul 2006 16:40:05 +0000 (16:40 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Sat, 15 Jul 2006 16:40:05 +0000 (16:40 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37653 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
Makefile.moddir_rules
Makefile.rules
agi/Makefile
channels/Makefile
utils/Makefile

index e21b79a..84cf329 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -496,7 +496,7 @@ asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJ
        @$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(LIBS)
 
 muted: muted.o
-muted: LDFLAGS+=$(AUDIO_LIBS)
+muted: LIBS+=$(AUDIO_LIBS)
 
 $(SUBDIRS_CLEAN_DEPEND):
        @$(MAKE) -C $(@:-clean-depend=) clean-depend
index e8a239f..15beec3 100644 (file)
@@ -25,12 +25,14 @@ endef
 
 define module_so_o_template
 $(1).so: $(1).o
-$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
+$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
+$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
 endef
 
 define module_so_oo_template
 $(1).so: $(1).oo
-$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
+$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
+$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
 endef
 
 $(foreach mod,$(filter-out $(CC_MODS),$(SELECTED_MODS)),$(eval $(call module_o_c_template,$(mod))))
index 5a0153e..4982b2d 100644 (file)
@@ -40,13 +40,13 @@ endef
 define ast_make_so_o
 $(1): $(2)
        @echo "   [LD] $$^ -> $$@"
-       @$$(CC) -o $$@ $$(SOLINK) $$^ $$(LDFLAGS)
+       @$$(CC) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
 endef
 
 define ast_make_so_oo
 $(1): $(2)
        @echo "   [LDXX] $$^ -> $$@"
-       @$$(CXX) -o $$@ $$(SOLINK) $$^ $$(LDFLAGS)
+       @$$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
 endef
 
 define ast_make_a_o
@@ -59,13 +59,13 @@ endef
 define ast_make_final
 $(1): $(2)
        @echo "   [LD] $$^ -> $$@"
-       @$$(CC) -o $$@ $$^ $$(LDFLAGS)
+       @$$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
 endef
 
 define ast_make_final_host
 $(1): $(2)
        @echo "   [LD] $$^ -> $$@"
-       @$$(HOST_CC) -o $$@ $$^ $$(CFLAGS) $$(LDFLAGS)
+       @$$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
 endef
 
 else
@@ -92,12 +92,12 @@ endef
 
 define ast_make_so_o
 $(1): $(2)
-       $$(CC) -o $$@ $$(SOLINK) $$^ $$(LDFLAGS)
+       $$(CC) -o $$@ $$(LDFAGS) $$(SOLINK) $$^ $$(LIBS)
 endef
 
 define ast_make_so_oo
 $(1): $(2)
-       $$(CXX) -o $$@ $$(SOLINK) $$^ $$(LDFLAGS)
+       $$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
 endef
 
 define ast_make_a_o
@@ -108,12 +108,12 @@ endef
 
 define ast_make_final
 $(1): $(2)
-       $$(CC) -o $$@ $$^ $$(LDFLAGS)
+       $$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
 endef
 
 define ast_make_final_host
 $(1): $(2)
-       $$(HOST_CC) -o $$@ $$^ $$(CFLAGS) $$(LDFLAGS)
+       $$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
 endef
 
 endif
index 907d5ef..e65357c 100644 (file)
@@ -16,7 +16,7 @@
 AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
 
 ifeq ($(OSARCH),SunOS)
-  LDFLAGS+=-lsocket -lnsl ../strcompat.o
+  LIBS+=-lsocket -lnsl ../strcompat.o
 endif
 
 include $(ASTTOPDIR)/Makefile.rules
index 37340f8..55fa4ae 100644 (file)
@@ -68,7 +68,7 @@ ifneq ($(wildcard $(PWD)/Makefile.ast),)
 endif
 
 $(eval $(call ast_make_final_host,gentone,gentone.c))
-gentone: LDFLAGS+=-lm
+gentone: LIBS+=-lm
 
 busy.h: gentone
        ./gentone busy 480 620
@@ -98,4 +98,4 @@ chan_misdn.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\"
 misdn_config.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\"
 
 chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
-chan_misdn.so: LDFLAGS+=-lisdnnet -lmISDN
+chan_misdn.so: LIBS+=-lisdnnet -lmISDN
index f6f2471..1d7a951 100644 (file)
@@ -16,7 +16,7 @@
 UTILS:=astman smsq stereorize streamplayer aelparse
 
 ifeq (${OSARCH},SunOS)
-  LDFLAGS+=../strcompat.o -lsocket -lnsl
+  LIBS+=../strcompat.o -lsocket -lnsl
 endif
 
 ifeq ($(POPT_LIB),)
@@ -51,11 +51,11 @@ clean-depend:
 clean: clean-depend
        rm -f *.o $(UTILS) check_expr
 
-astman: astman.o ../md5.o
-astman: LDFLAGS+=-lnewt
+$(eval $(call ast_make_final,astman,astman.o ../md5.o))
+astman: LIBS+=-lnewt
 
-stereorize: stereorize.o frame.o
-stereorize: LDFLAGS+=-lm
+$(eval $(call ast_make_final,stereorize,stereorize.o frame.o))
+stereorize: LIBS+=-lm
 
 ../ast_expr2.c:
        @echo "   [BISON] ../ast_expr2.y -> $@"
@@ -92,7 +92,7 @@ testexpr2s: ../ast_expr2f.c ../ast_expr2.c ../ast_expr2.h
        ./testexpr2s expr2.testinput
 
 smsq: smsq.o
-smsq: LDFLAGS+=-lpopt
+smsq: LIBS+=-lpopt
 
 streamplayer: streamplayer.o
 
@@ -104,4 +104,3 @@ depend: .depend
 
 .depend:
        ../build_tools/mkdep $(CFLAGS) `ls *.c`
-