2011-06-29 22:01:14 +00:00
|
|
|
MAIN_MAKEFILE=1
|
2017-05-03 10:51:48 +00:00
|
|
|
include ffbuild/config.mak
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.c $(SRC_PATH)
|
2011-08-30 22:41:25 +00:00
|
|
|
vpath %.cpp $(SRC_PATH)
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.h $(SRC_PATH)
|
2015-12-28 21:00:39 +00:00
|
|
|
vpath %.inc $(SRC_PATH)
|
2014-04-01 03:12:20 +00:00
|
|
|
vpath %.m $(SRC_PATH)
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.S $(SRC_PATH)
|
|
|
|
vpath %.asm $(SRC_PATH)
|
2013-12-05 20:50:14 +00:00
|
|
|
vpath %.rc $(SRC_PATH)
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.v $(SRC_PATH)
|
|
|
|
vpath %.texi $(SRC_PATH)
|
2017-05-11 20:53:41 +00:00
|
|
|
vpath %.cu $(SRC_PATH)
|
|
|
|
vpath %.ptx $(SRC_PATH)
|
2021-12-20 09:09:08 +00:00
|
|
|
vpath %.metal $(SRC_PATH)
|
2011-12-24 00:28:30 +00:00
|
|
|
vpath %/fate_config.sh.template $(SRC_PATH)
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2016-03-21 03:18:48 +00:00
|
|
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
2012-03-14 19:08:50 +00:00
|
|
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2022-05-06 09:43:18 +00:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
|
|
|
|
|
2014-05-15 12:53:30 +00:00
|
|
|
# $(FFLIBS-yes) needs to be in linking order
|
|
|
|
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
|
|
|
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
|
|
|
FFLIBS-$(CONFIG_AVFORMAT) += avformat
|
|
|
|
FFLIBS-$(CONFIG_AVCODEC) += avcodec
|
2014-05-15 19:01:07 +00:00
|
|
|
FFLIBS-$(CONFIG_POSTPROC) += postproc
|
|
|
|
FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
|
2014-05-15 12:53:30 +00:00
|
|
|
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2010-01-26 23:13:01 +00:00
|
|
|
FFLIBS := avutil
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2011-12-27 21:29:40 +00:00
|
|
|
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
|
2009-01-25 22:44:57 +00:00
|
|
|
|
2011-05-17 15:06:57 +00:00
|
|
|
SKIPHEADERS = compat/w32pthreads.h
|
2010-03-08 18:43:38 +00:00
|
|
|
|
2016-12-07 14:27:37 +00:00
|
|
|
# first so "all" becomes default target
|
|
|
|
all: all-yes
|
|
|
|
|
2016-12-05 17:38:53 +00:00
|
|
|
include $(SRC_PATH)/tools/Makefile
|
2017-05-03 10:51:48 +00:00
|
|
|
include $(SRC_PATH)/ffbuild/common.mak
|
2008-08-24 23:17:26 +00:00
|
|
|
|
|
|
|
FF_EXTRALIBS := $(FFEXTRALIBS)
|
|
|
|
FF_DEP_LIBS := $(DEP_LIBS)
|
2015-07-21 21:22:42 +00:00
|
|
|
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2016-11-29 14:09:35 +00:00
|
|
|
$(TOOLS): %$(EXESUF): %.o
|
tools: Don't include the direct library names when linking
When linking the main tools, the object files to link are set up
via the variable OBJS-<name>, but for the tools, we've only
used the target's list of dependencies.
In most cases, this has been fine, but it has caused specifying
the libraries to link in a duplicate fashion; the linking command
has looked like this:
$CC -Llibavutil ... tools/tool.o libavutil/libavutil.a -lavutil
Normally, the libraries to link are handled with "-Llibavutil -lavutil";
when linking the main fftools, this is how they are linked.
In the case of the binaries under the "tools" directory (within the
make variable TOOLS), we've passed the full set of dependencies
to the linker, via $^, which does contain the names of the
dependency libraries as well.
When libraries are built as regular static libraries, or shared
unix libraries, this has all worked fine. When libraries are
built as DLLs for Windows, though, the norm is not to pass the
actual DLL to the linker, but an import library.
Mingw tools generally can handle linking directly against a DLL
as well, but MSVC tools don't support that, and error out with
a very cryptic error message:
libavdevice\avdevice.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D8
By omitting these parts of the dependencies, linking of these tool
executables succeed in MSVC builds with shared libraries enabled.
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-09-28 09:37:29 +00:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
2011-07-10 19:26:25 +00:00
|
|
|
|
2017-04-21 21:58:32 +00:00
|
|
|
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2024-04-20 00:51:53 +00:00
|
|
|
target_enc_%_fuzzer$(EXESUF): target_enc_%_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2019-11-30 18:57:44 +00:00
|
|
|
tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2020-10-10 15:25:46 +00:00
|
|
|
target_dem_%_fuzzer$(EXESUF): target_dem_%_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2019-05-27 19:50:08 +00:00
|
|
|
tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
2020-07-19 15:54:10 +00:00
|
|
|
|
|
|
|
tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
2019-05-27 19:50:08 +00:00
|
|
|
|
2024-02-17 21:49:06 +00:00
|
|
|
tools/target_sws_fuzzer$(EXESUF): tools/target_sws_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2020-04-12 07:01:55 +00:00
|
|
|
|
|
|
|
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
|
|
|
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
|
2022-07-17 18:27:36 +00:00
|
|
|
tools/enc_recon_frame_test$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/enc_recon_frame_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2021-07-06 07:47:45 +00:00
|
|
|
tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-06-09 11:18:31 +00:00
|
|
|
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-04-14 00:03:41 +00:00
|
|
|
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-04-21 21:58:32 +00:00
|
|
|
tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
2020-10-10 15:25:46 +00:00
|
|
|
tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
2017-04-14 00:03:41 +00:00
|
|
|
|
2016-10-19 05:28:06 +00:00
|
|
|
CONFIGURABLE_COMPONENTS = \
|
|
|
|
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
|
|
|
|
$(SRC_PATH)/libavcodec/bitstream_filters.c \
|
2022-06-26 08:27:21 +00:00
|
|
|
$(SRC_PATH)/libavcodec/hwaccels.h \
|
2018-07-21 17:21:16 +00:00
|
|
|
$(SRC_PATH)/libavcodec/parsers.c \
|
2016-10-19 05:28:06 +00:00
|
|
|
$(SRC_PATH)/libavformat/protocols.c \
|
|
|
|
|
2022-03-17 21:26:30 +00:00
|
|
|
config_components.h: ffbuild/.config
|
2017-05-03 10:51:48 +00:00
|
|
|
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
2010-07-22 17:47:56 +00:00
|
|
|
@-tput bold 2>/dev/null
|
2022-03-17 21:26:30 +00:00
|
|
|
@-printf '\nWARNING: $(?) newer than config_components.h, rerun configure\n\n'
|
2010-07-22 17:47:56 +00:00
|
|
|
@-tput sgr0 2>/dev/null
|
2010-07-20 18:10:27 +00:00
|
|
|
|
2017-02-06 19:07:02 +00:00
|
|
|
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
2012-10-25 14:13:06 +00:00
|
|
|
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
2014-04-05 11:46:51 +00:00
|
|
|
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
2023-12-05 15:54:26 +00:00
|
|
|
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
2015-12-03 13:22:16 +00:00
|
|
|
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
2024-05-07 19:08:38 +00:00
|
|
|
MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS RVVB-OBJS \
|
2023-12-05 15:54:26 +00:00
|
|
|
OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS
|
2008-08-24 23:17:26 +00:00
|
|
|
|
|
|
|
define RESET
|
|
|
|
$(1) :=
|
|
|
|
$(1)-yes :=
|
|
|
|
endef
|
|
|
|
|
|
|
|
define DOSUBDIR
|
|
|
|
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
|
|
|
|
SUBDIR := $(1)/
|
2011-06-28 16:08:00 +00:00
|
|
|
include $(SRC_PATH)/$(1)/Makefile
|
2012-01-25 12:35:19 +00:00
|
|
|
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
|
2014-05-13 21:03:28 +00:00
|
|
|
-include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
|
2017-05-03 10:51:48 +00:00
|
|
|
include $(SRC_PATH)/ffbuild/library.mak
|
2008-08-24 23:17:26 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
|
|
|
|
2017-10-01 21:21:02 +00:00
|
|
|
include $(SRC_PATH)/fftools/Makefile
|
2013-11-02 16:05:28 +00:00
|
|
|
include $(SRC_PATH)/doc/Makefile
|
2017-02-15 12:31:52 +00:00
|
|
|
include $(SRC_PATH)/doc/examples/Makefile
|
2013-11-02 16:05:28 +00:00
|
|
|
|
2022-05-06 09:43:18 +00:00
|
|
|
$(ALLFFLIBS:%=lib%/version.o): libavutil/ffversion.h
|
2013-12-03 00:23:58 +00:00
|
|
|
|
2013-11-27 00:52:55 +00:00
|
|
|
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
2017-10-06 20:15:35 +00:00
|
|
|
ifeq ($(STRIPTYPE),direct)
|
|
|
|
$(STRIP) -o $@ $<
|
|
|
|
else
|
2022-05-25 03:46:55 +00:00
|
|
|
$(RM) $@
|
2013-11-26 00:50:25 +00:00
|
|
|
$(CP) $< $@
|
|
|
|
$(STRIP) $@
|
2017-10-06 20:15:35 +00:00
|
|
|
endif
|
2013-11-26 00:50:25 +00:00
|
|
|
|
2017-10-01 21:21:02 +00:00
|
|
|
%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
|
2014-07-16 15:00:11 +00:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2017-05-03 10:51:48 +00:00
|
|
|
VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
|
2023-12-15 11:03:49 +00:00
|
|
|
ifeq ($(VERSION_TRACKING),yes)
|
2011-06-06 21:38:38 +00:00
|
|
|
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
2023-12-15 11:03:49 +00:00
|
|
|
endif
|
2010-03-10 02:56:56 +00:00
|
|
|
|
2017-05-03 10:51:48 +00:00
|
|
|
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
|
2010-03-10 02:56:56 +00:00
|
|
|
.version: M=@
|
|
|
|
|
2023-12-15 11:03:49 +00:00
|
|
|
ifneq ($(VERSION_TRACKING),yes)
|
|
|
|
libavutil/ffversion.h .version: REVISION=unknown
|
|
|
|
endif
|
2013-11-29 00:29:41 +00:00
|
|
|
libavutil/ffversion.h .version:
|
2023-12-15 11:03:49 +00:00
|
|
|
$(M)revision=$(REVISION) $(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
|
2010-03-10 02:56:56 +00:00
|
|
|
$(Q)touch .version
|
|
|
|
|
|
|
|
# force version.sh to run whenever version might have changed
|
|
|
|
-include .version
|
2009-02-21 18:19:26 +00:00
|
|
|
|
2011-06-07 09:11:21 +00:00
|
|
|
install: install-libs install-headers
|
2011-06-05 20:52:32 +00:00
|
|
|
|
|
|
|
install-libs: install-libs-yes
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2017-10-05 03:47:41 +00:00
|
|
|
install-data: $(DATA_FILES)
|
|
|
|
$(Q)mkdir -p "$(DATADIR)"
|
2010-03-06 17:14:13 +00:00
|
|
|
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
2009-01-25 22:44:57 +00:00
|
|
|
|
2017-11-06 16:44:33 +00:00
|
|
|
uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
|
2010-01-26 22:23:12 +00:00
|
|
|
|
|
|
|
uninstall-data:
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) -r "$(DATADIR)"
|
2010-01-26 22:23:12 +00:00
|
|
|
|
2011-06-06 18:44:29 +00:00
|
|
|
clean::
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $(CLEANSUFFIXES)
|
2018-12-28 13:04:10 +00:00
|
|
|
$(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(addprefix compat/*/*/,$(CLEANSUFFIXES))
|
2011-11-29 19:35:48 +00:00
|
|
|
$(RM) -r coverage-html
|
2016-02-02 23:24:26 +00:00
|
|
|
$(RM) -rf coverage.info coverage.info.in lcov
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2017-11-13 20:37:56 +00:00
|
|
|
distclean:: clean
|
2022-03-17 21:23:12 +00:00
|
|
|
$(RM) .version config.asm config.h config_components.h mapfile \
|
2017-05-03 10:51:48 +00:00
|
|
|
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
|
|
|
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
2017-12-22 22:17:00 +00:00
|
|
|
libavcodec/bsf_list.c libavformat/protocol_list.c \
|
2018-01-21 16:06:54 +00:00
|
|
|
libavcodec/codec_list.c libavcodec/parser_list.c \
|
2020-03-11 10:39:44 +00:00
|
|
|
libavfilter/filter_list.c libavdevice/indev_list.c libavdevice/outdev_list.c \
|
2018-03-23 10:16:15 +00:00
|
|
|
libavformat/muxer_list.c libavformat/demuxer_list.c
|
2016-01-26 21:54:01 +00:00
|
|
|
ifeq ($(SRC_LINK),src)
|
|
|
|
$(RM) src
|
|
|
|
endif
|
2015-11-25 10:47:14 +00:00
|
|
|
$(RM) -rf doc/examples/pc-uninstalled
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2010-07-22 17:47:56 +00:00
|
|
|
config:
|
2011-03-17 16:01:10 +00:00
|
|
|
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
|
2009-06-15 22:12:23 +00:00
|
|
|
|
2017-10-11 21:37:56 +00:00
|
|
|
build: all alltools examples testprogs
|
2012-06-28 22:05:40 +00:00
|
|
|
check: all alltools examples testprogs fate
|
2011-06-26 11:52:40 +00:00
|
|
|
|
2011-06-28 16:08:00 +00:00
|
|
|
include $(SRC_PATH)/tests/Makefile
|
2010-08-26 13:58:45 +00:00
|
|
|
|
2019-02-03 11:59:57 +00:00
|
|
|
$(sort $(OUTDIRS)):
|
2011-06-28 17:45:13 +00:00
|
|
|
$(Q)mkdir -p $@
|
|
|
|
|
2011-06-06 14:21:12 +00:00
|
|
|
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
|
|
|
%.h:
|
|
|
|
@:
|
|
|
|
|
|
|
|
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
|
|
|
# so this saves some time on slow systems.
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2017-02-28 21:11:39 +00:00
|
|
|
.PHONY: all all-yes alltools build check config testprogs
|
|
|
|
.PHONY: *clean install* uninstall*
|