2011-06-30 01:01:14 +03:00
|
|
|
MAIN_MAKEFILE=1
|
2017-05-03 12:51:48 +02:00
|
|
|
include ffbuild/config.mak
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2011-06-07 00:38:38 +03:00
|
|
|
vpath %.c $(SRC_PATH)
|
2011-08-31 01:41:25 +03:00
|
|
|
vpath %.cpp $(SRC_PATH)
|
2011-06-07 00:38:38 +03:00
|
|
|
vpath %.h $(SRC_PATH)
|
2015-12-28 23:00:39 +02:00
|
|
|
vpath %.inc $(SRC_PATH)
|
2014-04-01 06:12:20 +03:00
|
|
|
vpath %.m $(SRC_PATH)
|
2011-06-07 00:38:38 +03:00
|
|
|
vpath %.S $(SRC_PATH)
|
|
|
|
vpath %.asm $(SRC_PATH)
|
2013-12-05 23:50:14 +03:00
|
|
|
vpath %.rc $(SRC_PATH)
|
2011-06-07 00:38:38 +03:00
|
|
|
vpath %.v $(SRC_PATH)
|
|
|
|
vpath %.texi $(SRC_PATH)
|
2017-05-11 22:53:41 +02:00
|
|
|
vpath %.cu $(SRC_PATH)
|
|
|
|
vpath %.ptx $(SRC_PATH)
|
2021-12-20 11:09:08 +02:00
|
|
|
vpath %.metal $(SRC_PATH)
|
2011-12-24 03:28:30 +03:00
|
|
|
vpath %/fate_config.sh.template $(SRC_PATH)
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2016-03-21 05:18:48 +02:00
|
|
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
2012-03-14 22:08:50 +03:00
|
|
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2022-05-06 11:43:18 +02:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
|
|
|
|
|
2014-05-15 15:53:30 +03: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 22:01:07 +03:00
|
|
|
FFLIBS-$(CONFIG_POSTPROC) += postproc
|
|
|
|
FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
|
2014-05-15 15:53:30 +03:00
|
|
|
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2010-01-27 01:13:01 +02:00
|
|
|
FFLIBS := avutil
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2011-12-28 00:29:40 +03:00
|
|
|
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
|
2009-01-26 00:44:57 +02:00
|
|
|
|
2011-05-17 18:06:57 +03:00
|
|
|
SKIPHEADERS = compat/w32pthreads.h
|
2010-03-08 20:43:38 +02:00
|
|
|
|
2016-12-07 16:27:37 +02:00
|
|
|
# first so "all" becomes default target
|
|
|
|
all: all-yes
|
|
|
|
|
2016-12-05 19:38:53 +02:00
|
|
|
include $(SRC_PATH)/tools/Makefile
|
2017-05-03 12:51:48 +02:00
|
|
|
include $(SRC_PATH)/ffbuild/common.mak
|
2008-08-25 02:17:26 +03:00
|
|
|
|
|
|
|
FF_EXTRALIBS := $(FFEXTRALIBS)
|
|
|
|
FF_DEP_LIBS := $(DEP_LIBS)
|
2015-07-21 23:22:42 +02:00
|
|
|
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2016-11-29 16:09:35 +02: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 11:37:29 +02:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
2011-07-10 22:26:25 +03:00
|
|
|
|
2017-04-21 23:58:32 +02:00
|
|
|
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
|
|
|
2019-11-30 20:57:44 +02: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 17:25:46 +02: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 21:50:08 +02: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 17:54:10 +02: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 21:50:08 +02:00
|
|
|
|
2020-04-12 09:01:55 +02:00
|
|
|
|
|
|
|
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
|
|
|
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
|
2022-07-17 20:27:36 +02:00
|
|
|
tools/enc_recon_frame_test$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/enc_recon_frame_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2021-07-06 09:47:45 +02:00
|
|
|
tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-06-09 13:18:31 +02:00
|
|
|
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-04-14 02:03:41 +02:00
|
|
|
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
|
|
|
|
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
2017-04-21 23:58:32 +02:00
|
|
|
tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
2020-10-10 17:25:46 +02:00
|
|
|
tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
2017-04-14 02:03:41 +02:00
|
|
|
|
2016-10-19 07:28:06 +02:00
|
|
|
CONFIGURABLE_COMPONENTS = \
|
|
|
|
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
|
|
|
|
$(SRC_PATH)/libavcodec/bitstream_filters.c \
|
2022-06-26 10:27:21 +02:00
|
|
|
$(SRC_PATH)/libavcodec/hwaccels.h \
|
2018-07-21 19:21:16 +02:00
|
|
|
$(SRC_PATH)/libavcodec/parsers.c \
|
2016-10-19 07:28:06 +02:00
|
|
|
$(SRC_PATH)/libavformat/protocols.c \
|
|
|
|
|
2022-03-17 23:26:30 +02:00
|
|
|
config_components.h: ffbuild/.config
|
2017-05-03 12:51:48 +02:00
|
|
|
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
2010-07-22 20:47:56 +03:00
|
|
|
@-tput bold 2>/dev/null
|
2022-03-17 23:26:30 +02:00
|
|
|
@-printf '\nWARNING: $(?) newer than config_components.h, rerun configure\n\n'
|
2010-07-22 20:47:56 +03:00
|
|
|
@-tput sgr0 2>/dev/null
|
2010-07-20 21:10:27 +03:00
|
|
|
|
2017-02-06 21:07:02 +02:00
|
|
|
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
2012-10-25 17:13:06 +03:00
|
|
|
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
2014-04-05 14:46:51 +03:00
|
|
|
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
2022-09-26 16:52:26 +02:00
|
|
|
ALTIVEC-OBJS VSX-OBJS RVV-OBJS MMX-OBJS X86ASM-OBJS \
|
2015-12-03 15:22:16 +02:00
|
|
|
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
2021-02-09 13:40:04 +02:00
|
|
|
MMI-OBJS LSX-OBJS LASX-OBJS OBJS SLIBOBJS SHLIBOBJS \
|
|
|
|
STLIBOBJS HOSTOBJS TESTOBJS
|
2008-08-25 02:17:26 +03:00
|
|
|
|
|
|
|
define RESET
|
|
|
|
$(1) :=
|
|
|
|
$(1)-yes :=
|
|
|
|
endef
|
|
|
|
|
|
|
|
define DOSUBDIR
|
|
|
|
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
|
|
|
|
SUBDIR := $(1)/
|
2011-06-28 19:08:00 +03:00
|
|
|
include $(SRC_PATH)/$(1)/Makefile
|
2012-01-25 15:35:19 +03:00
|
|
|
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
|
2014-05-14 00:03:28 +03:00
|
|
|
-include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
|
2017-05-03 12:51:48 +02:00
|
|
|
include $(SRC_PATH)/ffbuild/library.mak
|
2008-08-25 02:17:26 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
|
|
|
|
2017-10-01 23:21:02 +02:00
|
|
|
include $(SRC_PATH)/fftools/Makefile
|
2013-11-02 19:05:28 +03:00
|
|
|
include $(SRC_PATH)/doc/Makefile
|
2017-02-15 14:31:52 +02:00
|
|
|
include $(SRC_PATH)/doc/examples/Makefile
|
2013-11-02 19:05:28 +03:00
|
|
|
|
2022-05-06 11:43:18 +02:00
|
|
|
$(ALLFFLIBS:%=lib%/version.o): libavutil/ffversion.h
|
2013-12-03 03:23:58 +03:00
|
|
|
|
2013-11-27 03:52:55 +03:00
|
|
|
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
2017-10-06 22:15:35 +02:00
|
|
|
ifeq ($(STRIPTYPE),direct)
|
|
|
|
$(STRIP) -o $@ $<
|
|
|
|
else
|
2022-05-25 05:46:55 +02:00
|
|
|
$(RM) $@
|
2013-11-26 03:50:25 +03:00
|
|
|
$(CP) $< $@
|
|
|
|
$(STRIP) $@
|
2017-10-06 22:15:35 +02:00
|
|
|
endif
|
2013-11-26 03:50:25 +03:00
|
|
|
|
2017-10-01 23:21:02 +02:00
|
|
|
%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
|
2014-07-16 18:00:11 +03:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2017-05-03 12:51:48 +02:00
|
|
|
VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
|
2011-06-07 00:38:38 +03:00
|
|
|
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
2010-03-10 04:56:56 +02:00
|
|
|
|
2017-05-03 12:51:48 +02:00
|
|
|
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
|
2010-03-10 04:56:56 +02:00
|
|
|
.version: M=@
|
|
|
|
|
2013-11-29 03:29:41 +03:00
|
|
|
libavutil/ffversion.h .version:
|
|
|
|
$(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
|
2010-03-10 04:56:56 +02:00
|
|
|
$(Q)touch .version
|
|
|
|
|
|
|
|
# force version.sh to run whenever version might have changed
|
|
|
|
-include .version
|
2009-02-21 20:19:26 +02:00
|
|
|
|
2011-06-07 12:11:21 +03:00
|
|
|
install: install-libs install-headers
|
2011-06-05 23:52:32 +03:00
|
|
|
|
|
|
|
install-libs: install-libs-yes
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2017-10-05 05:47:41 +02:00
|
|
|
install-data: $(DATA_FILES)
|
|
|
|
$(Q)mkdir -p "$(DATADIR)"
|
2010-03-06 19:14:13 +02:00
|
|
|
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
2009-01-26 00:44:57 +02:00
|
|
|
|
2017-11-06 18:44:33 +02:00
|
|
|
uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
|
2010-01-27 00:23:12 +02:00
|
|
|
|
|
|
|
uninstall-data:
|
2010-03-06 16:25:10 +02:00
|
|
|
$(RM) -r "$(DATADIR)"
|
2010-01-27 00:23:12 +02:00
|
|
|
|
2011-06-06 21:44:29 +03:00
|
|
|
clean::
|
2010-03-06 16:25:10 +02:00
|
|
|
$(RM) $(CLEANSUFFIXES)
|
2018-12-28 15:04:10 +02:00
|
|
|
$(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(addprefix compat/*/*/,$(CLEANSUFFIXES))
|
2011-11-29 22:35:48 +03:00
|
|
|
$(RM) -r coverage-html
|
2016-02-03 01:24:26 +02:00
|
|
|
$(RM) -rf coverage.info coverage.info.in lcov
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2017-11-13 22:37:56 +02:00
|
|
|
distclean:: clean
|
2022-03-17 23:23:12 +02:00
|
|
|
$(RM) .version config.asm config.h config_components.h mapfile \
|
2017-05-03 12:51:48 +02:00
|
|
|
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
|
|
|
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
2017-12-23 00:17:00 +02:00
|
|
|
libavcodec/bsf_list.c libavformat/protocol_list.c \
|
2018-01-21 18:06:54 +02:00
|
|
|
libavcodec/codec_list.c libavcodec/parser_list.c \
|
2020-03-11 12:39:44 +02:00
|
|
|
libavfilter/filter_list.c libavdevice/indev_list.c libavdevice/outdev_list.c \
|
2018-03-23 12:16:15 +02:00
|
|
|
libavformat/muxer_list.c libavformat/demuxer_list.c
|
2016-01-26 23:54:01 +02:00
|
|
|
ifeq ($(SRC_LINK),src)
|
|
|
|
$(RM) src
|
|
|
|
endif
|
2015-11-25 12:47:14 +02:00
|
|
|
$(RM) -rf doc/examples/pc-uninstalled
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2010-07-22 20:47:56 +03:00
|
|
|
config:
|
2011-03-17 18:01:10 +02:00
|
|
|
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
|
2009-06-16 01:12:23 +03:00
|
|
|
|
2017-10-11 23:37:56 +02:00
|
|
|
build: all alltools examples testprogs
|
2012-06-29 01:05:40 +03:00
|
|
|
check: all alltools examples testprogs fate
|
2011-06-26 14:52:40 +03:00
|
|
|
|
2011-06-28 19:08:00 +03:00
|
|
|
include $(SRC_PATH)/tests/Makefile
|
2010-08-26 16:58:45 +03:00
|
|
|
|
2019-02-03 13:59:57 +02:00
|
|
|
$(sort $(OUTDIRS)):
|
2011-06-28 20:45:13 +03:00
|
|
|
$(Q)mkdir -p $@
|
|
|
|
|
2011-06-06 17:21:12 +03: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 23:11:39 +02:00
|
|
|
.PHONY: all all-yes alltools build check config testprogs
|
|
|
|
.PHONY: *clean install* uninstall*
|