Skip to content

Commit

Permalink
build: allow targets to specify extra objects to link with executables
Browse files Browse the repository at this point in the history
This allows targets to include special objects when linking
executables without including them in (shared) libraries.

Signed-off-by: Mans Rullgard <[email protected]>
  • Loading branch information
mansr committed Oct 23, 2012
1 parent a805cef commit 80521c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion library.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 80521c1

Please sign in to comment.