This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 59dd21047e86badeb1b142dff03f18acbbd074fa
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Thu Jul 23 19:27:56 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Sep 14 02:25:40 2026 +0000

    Makefile: output MSVC dependency files as a byproduct of compilation
    
    Previously each object was effectively compiled twice: once with
    -showIncludes -Zs just for the dependencies, and once for real. Pass
    -showIncludes on the actual compilation instead and let the mscl helper
    convert the include records into the .d file.
    
    make -j32 with MSVC 2026:
    
    before:
        1:40.35 elapsed, 345 s user+sys
    
    after:
        0:59.86 elapsed, 124 s user+sys
    
    no .d generation:
        0:59.66 elapsed, 129 s user+sys
    
    making dependency generation nearly free.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 Makefile                | 13 +++++++++++++
 configure               | 10 +---------
 ffbuild/common.mak      | 19 ++++++++++---------
 libswscale/x86/Makefile |  2 +-
 tools/Makefile          | 16 ++++++++--------
 5 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 1fe6549ba8..b8ecf5be42 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,19 @@ SKIPHEADERS = compat/w32pthreads.h
 # first so "all" becomes default target
 all: all-yes
 
+# cl.exe cannot write make dependency files directly, the mscl helper
+# converts its -showIncludes output into .d files.
+MSCL := $(if $(filter -showIncludes,$(CC_DEPFLAGS) $(CXX_DEPFLAGS) 
$(OBJCC_DEPFLAGS) $(AS_DEPFLAGS) $(HOSTCC_DEPFLAGS)),ffbuild/mscl$(HOSTEXESUF))
+ifneq ($(MSCL),)
+MSCLCC := $(HOSTCC)
+$(foreach V,CC CXX OBJCC HOSTCC AS,\
+    $(if $(filter -showIncludes,$($(V)_DEPFLAGS)),$(eval $(V) := $(MSCL) 
$($(V)))))
+HOSTPROGS += ffbuild/mscl
+
+ffbuild/mscl.o: $(SRC_PATH)/compat/windows/mscl.c
+       $(MSCLCC) $(HOSTCCFLAGS) $(HOSTCC_C) $(HOSTCC_O) $<
+endif
+
 include $(SRC_PATH)/tools/Makefile
 include $(SRC_PATH)/ffbuild/common.mak
 
diff --git a/configure b/configure
index 0b428c15d0..e84ec098e6 100755
--- a/configure
+++ b/configure
@@ -5372,15 +5372,7 @@ probe_cc(){
         else
             _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')
         fi
-        if [ -x "$(command -v wslpath)" ]; then
-            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk 
'\''/including/ { sub(/^.*file: */, ""); if (!match($$0, / /)) { print $$0 } 
}'\'' | xargs -r -d\\n -n1 wslpath -u | awk '\''BEGIN { printf "%s:", "$@" }; { 
sub(/\r/,""); printf " %s", $$0 }; END { print "" }'\'' > $(@:.o=.d)'
-
-        else
-            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk 
'\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) 
print "$@:", $$0 }'\'' > $(@:.o=.d)'
-        fi
-        _DEPFLAGS='$(CPPFLAGS) -showIncludes -Zs'
-        _DEPCCFLAGS='$(CFLAGS)'
-        _DEPCXXFLAGS='$(CXXFLAGS)'
+        _depflags='-showIncludes'
         _cflags_speed="-O2"
         _cflags_size="-O1"
         if $_cc -nologo- 2>&1 | grep -q Linker; then
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 1f6c5a7522..d03764df7d 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -22,7 +22,7 @@ INSTALL_FILES = $(INSTALL) $(1) $(2) "$(3)"
 ifndef V
 Q      = @
 ECHO   = printf "$(1)\t%s\n" $(2)
-BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD LDXX STRIP CP WINDRES 
GLSLC NVCC BIN2C METALCC METALLIB
+BRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD LDXX STRIP CP WINDRES 
GLSLC NVCC BIN2C METALCC METALLIB MSCLCC
 SILENT = DEPCC DEPCXX DEPHOSTCC DEPAS DEPX86ASM RANLIB RM
 
 MSG    = $@
@@ -82,22 +82,22 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
 %_lasx.o: %_lasx.c
        $(COMPILE_LASX)
 
-%.o: %.c
+%.o: %.c | $(MSCL)
        $(COMPILE_C)
 
-%.o: %.cpp
+%.o: %.cpp | $(MSCL)
        $(COMPILE_CXX)
 
-%.o: %.m
+%.o: %.m | $(MSCL)
        $(COMPILE_M)
 
-%.s: %.c
+%.s: %.c | $(MSCL)
        $(CC) $(CCFLAGS) -S -o $@ $<
 
-%.o: %.S
+%.o: %.S | $(MSCL)
        $(COMPILE_S)
 
-%_host.o: %.c
+%_host.o: %.c | $(MSCL)
        $(COMPILE_HOSTC)
 
 %.o: %.asm
@@ -107,7 +107,7 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
 %.o: %.rc
        $(WINDRES) $(IFLAGS) $(foreach ARG,$(CC_DEPFLAGS),--preprocessor-arg 
"$(ARG)") -o $@ $<
 
-%.i: %.c
+%.i: %.c | $(MSCL)
        $(CC) $(CCFLAGS) $(CC_E) $<
 
 %.h.c:
@@ -243,7 +243,8 @@ checkheaders: $(HOBJS)
 .SECONDARY:   $(HOBJS:.o=.c) $(SPVOBJS:.o=.c) $(SPVOBJS:.o=.gz) $(SPVOBJS:.o=) 
$(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=)
 alltools: $(TOOLS)
 
-$(HOSTOBJS): %.o: %.c
+# ffbuild/mscl.o is excluded as it has its own bootstrap rule in Makefile
+$(filter-out ffbuild/mscl.o,$(HOSTOBJS)): %.o: %.c | $(MSCL)
        $(COMPILE_HOSTC)
 
 $(HOSTPROGS): %$(HOSTEXESUF): %.o
diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
index 4467fd877d..5fae34a832 100644
--- a/libswscale/x86/Makefile
+++ b/libswscale/x86/Makefile
@@ -31,6 +31,6 @@ $(SUBDIR)x86/ops_common.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/ops_int.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/ops_float.o: $(SUBDIR)x86/uops_macros.gen.asm
 $(SUBDIR)x86/uops_macros.gen.asm: $(SRC_PATH)/libswscale/x86/uops_macros.asm.h 
\
-                                  $(SRC_PATH)/libswscale/uops_macros.h
+                                  $(SRC_PATH)/libswscale/uops_macros.h | 
$(MSCL)
        $(HOSTCC) $(HOSTCC_E) $(HOSTCPPFLAGS) $<
 endif
diff --git a/tools/Makefile b/tools/Makefile
index 7ae6e3cb75..9ed3251ff9 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -2,28 +2,28 @@ TOOLS = enc_recon_frame_test enum_options qt-faststart 
scale_slice_test trasher
 TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
-tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c
+tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DFFMPEG_DECODER=$*
 
-tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c
+tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DFFMPEG_ENCODER=$*
 
-tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c
+tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DFFMPEG_BSF=$*
 
-tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c
+tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DFFMPEG_DEMUXER=$* -DIO_FLAT=0
 
-tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c
+tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DIO_FLAT=1
 
-tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c
+tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c | $(MSCL)
        $(COMPILE_C) -DIO_FLAT=0
 
-tools/target_sws_fuzzer.o: tools/target_sws_fuzzer.c
+tools/target_sws_fuzzer.o: tools/target_sws_fuzzer.c | $(MSCL)
        $(COMPILE_C)
 
-tools/target_swr_fuzzer.o: tools/target_swr_fuzzer.c
+tools/target_swr_fuzzer.o: tools/target_swr_fuzzer.c | $(MSCL)
        $(COMPILE_C)
 
 tools/enc_recon_frame_test$(EXESUF): tools/decode_simple.o

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to