move DEP_LIBS to common.mak
[ffmpeg.git] / Makefile
index b134746..47f811c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver
 
 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
@@ -33,9 +33,6 @@ include common.mak
 FF_LDFLAGS   := $(FFLDFLAGS)
 FF_EXTRALIBS := $(FFEXTRALIBS)
 
-S := $(BUILD_SHARED:yes=S)
-DEP_LIBS := $(foreach L,$(FFLIBS),lib$(L)/$($(S)LIBPREF)$(L)$($(S)LIBSUF))
-
 ALL_TARGETS-$(CONFIG_VHOOK) += videohook
 ALL_TARGETS-$(BUILD_DOC)    += documentation
 
@@ -52,8 +49,6 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
        cp -p $< $@
        $(STRIP) $@
 
-.depend: version.h $(PROGS_SRCS)
-
 SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
 
 define RESET
@@ -69,28 +64,6 @@ endef
 
 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
-VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
-
-BASEHOOKS = fish null watermark
-ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
-ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
-
-HOOKS-$(HAVE_FORK)      += ppm
-HOOKS-$(HAVE_IMLIB2)    += imlib2
-HOOKS-$(HAVE_FREETYPE2) += drawtext
-
-HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
-
-VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
-LIBS_imlib2$(SLIBSUF)       = `imlib2-config --libs`
-
-VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
-LIBS_drawtext$(SLIBSUF)        = `freetype-config --libs`
-
-VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
-
-vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
-
 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
 
@@ -111,9 +84,29 @@ output_example$(EXESUF): output_example.o $(DEP_LIBS)
 tools/%$(EXESUF): tools/%.c
        $(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
 
-ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
+ffplay.o: CFLAGS += $(SDL_CFLAGS)
 
-ffmpeg.o ffplay.o ffserver.o: version.h
+VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
+
+BASEHOOKS = fish null watermark
+ALLHOOKS = $(BASEHOOKS) drawtext imlib2 ppm
+ALLHOOKS_SRCS = $(addprefix vhook/, $(addsuffix .c, $(ALLHOOKS)))
+
+HOOKS-$(HAVE_FORK)      += ppm
+HOOKS-$(HAVE_IMLIB2)    += imlib2
+HOOKS-$(HAVE_FREETYPE2) += drawtext
+
+HOOKS = $(addprefix vhook/, $(addsuffix $(SLIBSUF), $(BASEHOOKS) $(HOOKS-yes)))
+
+VHOOKCFLAGS-$(HAVE_IMLIB2) += `imlib2-config --cflags`
+LIBS_imlib2$(SLIBSUF)       = `imlib2-config --libs`
+
+VHOOKCFLAGS-$(HAVE_FREETYPE2) += `freetype-config --cflags`
+LIBS_drawtext$(SLIBSUF)        = `freetype-config --libs`
+
+VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
+
+vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
 
 # vhooks compile fine without libav*, but need them nonetheless.
 videohook: $(DEP_LIBS) $(HOOKS)
@@ -121,6 +114,9 @@ videohook: $(DEP_LIBS) $(HOOKS)
 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))
@@ -161,11 +157,6 @@ uninstall-vhook:
        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)
@@ -176,7 +167,7 @@ clean::
        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
 
@@ -352,4 +343,4 @@ tests/seek_test$(EXESUF): tests/seek_test.c $(DEP_LIBS)
 .PHONY: codectest libavtest seektest test-server fulltest test
 .PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
 
--include .vhookdep
+-include $(VHOOK_DEPS)