mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
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 <kasper93@gmail.com>
This commit is contained in:
13
Makefile
13
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
|
||||
|
||||
|
||||
10
configure
vendored
10
configure
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user