aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2008-12-06 04:41:45 +0200
committerGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2008-12-06 05:33:33 +0200
commit2a6178e5aba3b53783ee3d36c32d3280d8ce67ac (patch)
tree9607147de2a4a09febf5e7afef3e573f0306b7e4
parentb37a869f130a5246d4c98f532d07b73146672c95 (diff)
Makefile, common.mak: Create .d files when creating corresponding .o
The separate .d file creation logic has caused various problems, most notably cases where 'make' exits without doing anybut but without giving any error either. Change the Makefile so that .d files are always created or updated when the corresponding .o file is. This avoids the problems of current .d file generation and still gives correct dependencies. The common.mak change does the same for the libswscale build. However it does not affect the directories under ffmpeg/ because those use ffmpeg/common.mak. The MPlayer common.mak can be copied over the ffmpeg/common.mak file to make the fix apply to the FFmpeg directories too. This is not done automatically because the FFmpeg file is under version control and changing it could cause problems.
-rw-r--r--Makefile19
-rw-r--r--common.mak19
2 files changed, 11 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 9e6e1c6dd8..a18334ba46 100644
--- a/Makefile
+++ b/Makefile
@@ -776,21 +776,18 @@ FFMPEGFILES = $(foreach part, $(PARTS), $(part)/*.[chS] ffmpeg/libavcodec/*/*.[c
all: $(ALL_PRG-yes)
-%.d: %.c
- $(MPDEPEND_CMD) > $@
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $<
-%.d: %.cpp
- $(MPDEPEND_CMD_CXX) > $@
+%.o: %.cpp
+ $(CXX) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $<
-%.d: %.m
- $(MPDEPEND_CMD) > $@
+%.o: %.m
+ $(CC) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $<
%.ho: %.h
$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
-%.o: %.m
- $(CC) $(CFLAGS) -c -o $@ $<
-
%-rc.o: %.rc
$(WINDRES) -I. $< $@
@@ -837,8 +834,8 @@ version.h:
###### dependency declarations / specific CFLAGS ######
-codec-cfg.d: codecs.conf.h
-mencoder.d mplayer.d vobsub.d gui/win32/gui.d libmpdemux/muxer_avi.d osdep/mplayer-rc.o stream/network.d stream/stream_cddb.d: version.h
+codec-cfg.o: codecs.conf.h
+mencoder.o mplayer.o vobsub.o gui/win32/gui.o libmpdemux/muxer_avi.o osdep/mplayer-rc.o stream/network.o stream/stream_cddb.o: version.h
$(DEPS): help_mp.h
libdvdcss/%.o libdvdcss/%.d: CFLAGS += -D__USE_UNIX98 -D_GNU_SOURCE -DVERSION=\"1.2.9\" $(CFLAGS_LIBDVDCSS)
diff --git a/common.mak b/common.mak
index 4d92999542..4a606fb5cf 100644
--- a/common.mak
+++ b/common.mak
@@ -22,25 +22,14 @@ CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-I$(BUILD_ROOT_REL) -I$(SRC_PATH) -I$(SRC_PATH)/ffmpeg $(OPTFLAGS)
%.o: %.c
- $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ -MD -MP -MF $*.d $<
%.o: %.S
- $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ -MD -MP -MF $*.d $<
%.ho: %.h
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
-%.d: %.c
- $(DEPEND_CMD) > $@
-
-%.d: %.S
- $(DEPEND_CMD) > $@
-
-%.d: %.cpp
- $(DEPEND_CMD) > $@
-
-%.o: %.d
-
%$(EXESUF): %.c
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
@@ -93,9 +82,7 @@ $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(SUBDIR)i386/%.o: $(SUBDIR)i386/%.asm
$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
-
-$(SUBDIR)i386/%.d: $(SUBDIR)i386/%.asm
- $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
+ $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:%.o=%.d)
clean::
rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \