PROGS = $(addsuffix $(EXESUF), $(PROGS-yes))
PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
-PROGS_SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
+OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
BASENAMES = ffmpeg ffplay ffserver
FF_LDFLAGS := $(FFLDFLAGS)
FF_EXTRALIBS := $(FFEXTRALIBS)
-
-S := $(BUILD_SHARED:yes=S)
-DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF))
+FF_DEP_LIBS := $(DEP_LIBS)
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
ALL_TARGETS-$(BUILD_DOC) += documentation
endif
INSTALL_PROGS_TARGETS-$(BUILD_SHARED) = install-libs
-all: $(DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
+all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
$(PROGS): %$(EXESUF): %_g$(EXESUF)
cp -p $< $@
$(STRIP) $@
-.depend: version.h $(PROGS_SRCS)
-
SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
define RESET
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
+ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
+ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
+
+%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
+ $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
+
+SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
+ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
+version.h: $(SVN_ENTRIES)
+endif
+
+version.h:
+ $(SRC_PATH)/version.sh $(SRC_PATH)
+
+output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
+ $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
+
+tools/%$(EXESUF): tools/%.c
+ $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
+
+ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
+
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
BASEHOOKS = fish null watermark
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
-vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
-
-ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
-ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
-
-%_g$(EXESUF): %.o cmdutils.o $(DEP_LIBS)
- $(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
-
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
-ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
-version.h: $(SVN_ENTRIES)
-endif
-
-version.h:
- $(SRC_PATH)/version.sh $(SRC_PATH)
-
-output_example$(EXESUF): output_example.o $(DEP_LIBS)
- $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
-
-tools/%$(EXESUF): tools/%.c
- $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
-
-ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
-
-ffmpeg.o ffplay.o ffserver.o: version.h
+vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
# vhooks compile fine without libav*, but need them nonetheless.
-videohook: $(DEP_LIBS) $(HOOKS)
+videohook: $(FF_DEP_LIBS) $(HOOKS)
+$(eval VHOOKSHFLAGS=$(VHOOKSHFLAGS))
vhook/%$(SLIBSUF): vhook/%.o
$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
+VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
+depend dep: $(VHOOK_DEPS)
+
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
ffplay-doc.html general.html hooks.html \
$(ALLMANPAGES))
install -d "$(BINDIR)"
install -c -m 755 $(PROGS) "$(BINDIR)"
-install-man:
+install-man: $(MANPAGES)
install -d "$(MANDIR)/man1"
install -m 644 $(MANPAGES) "$(MANDIR)/man1"
rm -f $(addprefix "$(SHLIBDIR)/",$(ALLHOOKS_SRCS:.c=$(SLIBSUF)))
-rmdir "$(SHLIBDIR)/vhook/"
-depend dep: .vhookdep
-
-.vhookdep: $(ALLHOOKS_SRCS) version.h
- $(VHOOK_DEPEND_CMD) > $@
-
clean::
rm -f gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
output_example$(EXESUF)
rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
distclean::
- rm -f .vhookdep version.h config.* *.pc
+ rm -f version.h config.* *.pc vhook/*.d
# regression tests
%$(EXESUF): %.c
$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $<
-tests/seek_test$(EXESUF): tests/seek_test.c $(DEP_LIBS)
+tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
.PHONY: codectest libavtest seektest test-server fulltest test
.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
--include .vhookdep
+-include $(VHOOK_DEPS)