aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
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 /Makefile
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 12 insertions, 5 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