[FFmpeg-cvslog] build: generalise rules and variable settings for av* programs

Mans Rullgard git at videolan.org
Mon Aug 6 22:29:40 CEST 2012


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Aug  4 19:04:08 2012 +0100| [baac24e6807aee799e39a1a4bce6dfe59c858137] | committer: 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: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=baac24e6807aee799e39a1a4bce6dfe59c858137
---

 Makefile  |   17 ++++++++++++-----
 configure |    6 +++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index e9580d2..644aff4 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 b139008..805f33e 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



More information about the ffmpeg-cvslog mailing list