[libav-commits] build: allow targets to specify extra objects to link with executables

Mans Rullgard git at libav.org
Tue Oct 23 13:14:37 CEST 2012


Module: libav
Branch: master
Commit: 80521c1997a23e148edf89e11b939ab8646297ca

Author:    Mans Rullgard <mans at mansr.com>
Committer: Mans Rullgard <mans at mansr.com>
Date:      Mon Oct 15 04:05:03 2012 +0100

build: allow targets to specify extra objects to link with executables

This allows targets to include special objects when linking
executables without including them in (shared) libraries.

Signed-off-by: Mans Rullgard <mans at mansr.com>

---

 Makefile    |    8 ++++----
 configure   |    1 +
 library.mak |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 3202f5d..07df538 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ PROGS-$(CONFIG_AVPROBE)  += avprobe
 PROGS-$(CONFIG_AVSERVER) += avserver
 
 PROGS      := $(PROGS-yes:%=%$(EXESUF))
-OBJS        = cmdutils.o
+OBJS        = cmdutils.o $(EXEOBJS)
 OBJS-avconv = avconv_opt.o avconv_filter.o
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr base64
 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
@@ -90,8 +90,8 @@ FF_DEP_LIBS  := $(DEP_LIBS)
 
 all: $(PROGS)
 
-$(TOOLS): %$(EXESUF): %.o
-	$(LD) $(LDFLAGS) $(LD_O) $< $(ELIBS)
+$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
+	$(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
 
 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
 
@@ -124,7 +124,7 @@ endef
 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
 define DOPROG
-OBJS-$(1) += $(1).o cmdutils.o
+OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
 $(1)$(EXESUF): $$(OBJS-$(1))
 $$(OBJS-$(1)): CFLAGS  += $(CFLAGS-$(1))
 $(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
diff --git a/configure b/configure
index 35cf34f..f597caf 100755
--- a/configure
+++ b/configure
@@ -3737,6 +3737,7 @@ ZLIB=$($ldflags_filter -lz)
 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
 EXTRALIBS=$extralibs
 COMPAT_OBJS=$compat_objs
+EXEOBJS=$exeobjs
 INSTALL=install
 LIBTARGET=${LIBTARGET}
 SLIBNAME=${SLIBNAME}
diff --git a/library.mak b/library.mak
index b365935..cbfa0d4 100644
--- a/library.mak
+++ b/library.mak
@@ -36,7 +36,7 @@ define RULES
 $(EXAMPLES) $(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
 $(TESTPROGS):         THISLIB = $(SUBDIR)$(LIBNAME)
 
-$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
+$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
 	$$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
 
 $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)



More information about the libav-commits mailing list