aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-08-04 19:04:08 +0100
committerMans Rullgard <mans@mansr.com>2012-08-06 17:43:29 +0100
commitbaac24e6807aee799e39a1a4bce6dfe59c858137 (patch)
tree8d30e4aa7cbe18d411dc5c643ce1e1f157f2db67
parent859a579e9bbf47fae2e09494c43bcf813dcb2fad (diff)
downloadffmpeg-baac24e6807aee799e39a1a4bce6dfe59c858137.tar.gz
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: Mans Rullgard <mans@mansr.com>
-rw-r--r--Makefile17
-rwxr-xr-xconfigure6
2 files changed, 15 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index e9580d2164..644aff42c8 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/configure b/configure
index b139008d2b..805f33e4f5 100755
--- a/configure
+++ b/configure
@@ -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