Commit caec74dd authored by Måns Rullgård's avatar Måns Rullgård

generate separate dependency files per object file

Originally committed as revision 12775 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 95c76e11
......@@ -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
......@@ -52,8 +52,6 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
cp -p $< $@
$(STRIP) $@
.depend: version.h $(PROGS_SRCS)
SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
define RESET
......@@ -89,9 +87,7 @@ 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)
ffmpeg.o ffplay.o ffserver.o: version.h
ffplay.o: CFLAGS += $(SDL_CFLAGS)
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
......@@ -113,7 +109,7 @@ LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
# vhooks compile fine without libav*, but need them nonetheless.
videohook: $(DEP_LIBS) $(HOOKS)
......@@ -121,10 +117,8 @@ videohook: $(DEP_LIBS) $(HOOKS)
vhook/%$(SLIBSUF): vhook/%.o
$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
.vhookdep: $(ALLHOOKS_SRCS) version.h
$(VHOOK_DEPEND_CMD) > $@
depend dep: .vhookdep
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 \
......@@ -176,7 +170,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 +346,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)
......@@ -24,6 +24,15 @@ CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
%.ho: %.h
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
%.d: %.c
$(DEPEND_CMD) > $@
%.d: %.S
$(DEPEND_CMD) > $@
%.d: %.cpp
$(DEPEND_CMD) > $@
install: install-libs install-headers
uninstall: uninstall-libs uninstall-headers
......@@ -51,7 +60,8 @@ TESTS := $(addprefix $(SUBDIR),$(TESTS))
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
depend dep: $(SUBDIR).depend
DEPS := $(OBJS:.o=.d)
depend dep: $(DEPS)
CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
*.def *.dll.a *.exp *.ho *.map
......@@ -63,18 +73,15 @@ $(SUBDIR)%: $(SUBDIR)%.o $(LIBNAME)
$(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
$(SUBDIR).depend: $(SRCS)
$(DEPEND_CMD) > $$@
clean::
rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
distclean:: clean
rm -f $(SUBDIR).depend
rm -f $(DEPS)
endef
$(eval $(RULES))
tests: $(TESTS)
-include $(SUBDIR).depend
-include $(DEPS)
......@@ -940,8 +940,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
# gcc stupidly only outputs the basename of targets with -MM
DEPEND_CMD='$(CC) -MM $(CFLAGS) $(filter-out %.h,$$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,;s,^.*:,\$$$$(SUBDIR)&,"'
VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed "1s,^,$(@D)/,"'
# find source path
source_path="`dirname \"$0\"`"
......@@ -1983,7 +1982,6 @@ echo "SLIBPREF=$SLIBPREF" >> config.mak
echo "SLIBSUF=$SLIBSUF" >> config.mak
echo "EXESUF=$EXESUF" >> config.mak
echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
echo "VHOOK_DEPEND_CMD=$VHOOK_DEPEND_CMD" >> config.mak
if enabled bigendian; then
echo "WORDS_BIGENDIAN=yes" >> config.mak
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment