Commit baac24e6 authored by Mans Rullgard's avatar Mans Rullgard

build: generalise rules and variable settings for av* programs

This simplifies adding extra flags for individual programs
and also allows more than one object file per program.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 859a579e
......@@ -59,7 +59,7 @@ PROGS-$(CONFIG_AVPROBE) += avprobe
PROGS-$(CONFIG_AVSERVER) += avserver
PROGS := $(PROGS-yes:%=%$(EXESUF))
OBJS = $(PROGS-yes:%=%.o) cmdutils.o
OBJS = cmdutils.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
TOOLS = qt-faststart trasher
......@@ -121,12 +121,19 @@ endef
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
avplay.o: CFLAGS += $(SDL_CFLAGS)
avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS)
define DOPROG
OBJS-$(1) += $(1).o
$(1)$(EXESUF): $(OBJS-$(1))
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
-include $$(OBJS-$(1):.o=.d)
endef
$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
$(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
$(LD) $(LDFLAGS) -o $@ $(OBJS-$*) cmdutils.o $(FF_EXTRALIBS)
OBJDIRS += tools
......
......@@ -3442,7 +3442,7 @@ CC_O=$CC_O
LD_O=$LD_O
DLLTOOL=$dlltool
LDFLAGS=$LDFLAGS
AVSERVERLDFLAGS=$AVSERVERLDFLAGS
LDFLAGS-avserver=$AVSERVERLDFLAGS
SHFLAGS=$SHFLAGS
YASMFLAGS=$YASMFLAGS
BUILDSUF=$build_suffix
......@@ -3474,8 +3474,8 @@ HOSTCC_C=$HOSTCC_C
HOSTCC_O=$HOSTCC_O
TARGET_EXEC=$target_exec
TARGET_PATH=$target_path
SDL_LIBS=$sdl_libs
SDL_CFLAGS=$sdl_cflags
LIBS-avplay=$sdl_libs
CFLAGS-avplay=$sdl_cflags
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
EXTRALIBS=$extralibs
INSTALL=install
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment