Revision caec74dd

View differences:

Makefile
14 14

  
15 15
PROGS       = $(addsuffix   $(EXESUF), $(PROGS-yes))
16 16
PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
17
PROGS_SRCS  = $(addsuffix .c,          $(PROGS-yes)) cmdutils.c
17
OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
18 18
MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
19 19

  
20 20
BASENAMES   = ffmpeg ffplay ffserver
......
52 52
	cp -p $< $@
53 53
	$(STRIP) $@
54 54

  
55
.depend: version.h $(PROGS_SRCS)
56

  
57 55
SUBDIR_VARS := OBJS ASM_OBJS CPP_OBJS FFLIBS CLEANFILES
58 56

  
59 57
define RESET
......
89 87
tools/%$(EXESUF): tools/%.c
90 88
	$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
91 89

  
92
ffplay.o .depend: CFLAGS += $(SDL_CFLAGS)
93

  
94
ffmpeg.o ffplay.o ffserver.o: version.h
90
ffplay.o: CFLAGS += $(SDL_CFLAGS)
95 91

  
96 92
VHOOKCFLAGS += $(filter-out -mdynamic-no-pic,$(CFLAGS))
97 93

  
......
113 109

  
114 110
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
115 111

  
116
vhook/%.o: CFLAGS:=$(VHOOKCFLAGS)
112
vhook/%.o vhook/%.d: CFLAGS:=$(VHOOKCFLAGS)
117 113

  
118 114
# vhooks compile fine without libav*, but need them nonetheless.
119 115
videohook: $(DEP_LIBS) $(HOOKS)
......
121 117
vhook/%$(SLIBSUF): vhook/%.o
122 118
	$(CC) $(LDFLAGS) -o $@ $(VHOOKSHFLAGS) $< $(VHOOKLIBS) $(LIBS_$(@F))
123 119

  
124
.vhookdep: $(ALLHOOKS_SRCS) version.h
125
	$(VHOOK_DEPEND_CMD) > $@
126

  
127
depend dep: .vhookdep
120
VHOOK_DEPS = $(HOOKS:$(SLIBSUF)=.d)
121
depend dep: $(VHOOK_DEPS)
128 122

  
129 123
documentation: $(addprefix doc/, ffmpeg-doc.html faq.html ffserver-doc.html \
130 124
                                 ffplay-doc.html general.html hooks.html \
......
176 170
	rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
177 171

  
178 172
distclean::
179
	rm -f .vhookdep version.h config.* *.pc
173
	rm -f version.h config.* *.pc vhook/*.d
180 174

  
181 175
# regression tests
182 176

  
......
352 346
.PHONY: codectest libavtest seektest test-server fulltest test
353 347
.PHONY: $(CODEC_TESTS) $(LAVF_TESTS) regtest-ref swscale-error
354 348

  
355
-include .vhookdep
349
-include $(VHOOK_DEPS)
common.mak
24 24
%.ho: %.h
25 25
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
26 26

  
27
%.d: %.c
28
	$(DEPEND_CMD) > $@
29

  
30
%.d: %.S
31
	$(DEPEND_CMD) > $@
32

  
33
%.d: %.cpp
34
	$(DEPEND_CMD) > $@
35

  
27 36
install: install-libs install-headers
28 37

  
29 38
uninstall: uninstall-libs uninstall-headers
......
51 60
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
52 61
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
53 62

  
54
depend dep: $(SUBDIR).depend
63
DEPS := $(OBJS:.o=.d)
64
depend dep: $(DEPS)
55 65

  
56 66
CLEANFILES += *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
57 67
              *.def *.dll.a *.exp *.ho *.map
......
63 73
$(SUBDIR)%-test$(EXESUF): $(SUBDIR)%.c $(LIBNAME)
64 74
	$(CC) $(CFLAGS) $(FFLDFLAGS) -DTEST -o $$@ $$^ $(FFEXTRALIBS)
65 75

  
66
$(SUBDIR).depend: $(SRCS)
67
	$(DEPEND_CMD) > $$@
68

  
69 76
clean::
70 77
	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES))
71 78

  
72 79
distclean:: clean
73
	rm -f $(SUBDIR).depend
80
	rm -f $(DEPS)
74 81
endef
75 82

  
76 83
$(eval $(RULES))
77 84

  
78 85
tests: $(TESTS)
79 86

  
80
-include $(SUBDIR).depend
87
-include $(DEPS)
configure
940 940
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
941 941

  
942 942
# gcc stupidly only outputs the basename of targets with -MM
943
DEPEND_CMD='$(CC) -MM $(CFLAGS) $(filter-out %.h,$$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,;s,^.*:,\$$$$(SUBDIR)&,"'
944
VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
943
DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed "1s,^,$(@D)/,"'
945 944

  
946 945
# find source path
947 946
source_path="`dirname \"$0\"`"
......
1983 1982
echo "SLIBSUF=$SLIBSUF" >> config.mak
1984 1983
echo "EXESUF=$EXESUF" >> config.mak
1985 1984
echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
1986
echo "VHOOK_DEPEND_CMD=$VHOOK_DEPEND_CMD" >> config.mak
1987 1985

  
1988 1986
if enabled bigendian; then
1989 1987
    echo "WORDS_BIGENDIAN=yes" >> config.mak

Also available in: Unified diff