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)
|
2011-12-24 03:28:30 +03:00
|
|
|
vpath %/fate_config.sh.template $(SRC_PATH)
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2013-11-26 02:05:38 +03:00
|
|
|
AVPROGS-$(CONFIG_FFMPEG) += ffmpeg
|
|
|
|
AVPROGS-$(CONFIG_FFPLAY) += ffplay
|
|
|
|
AVPROGS-$(CONFIG_FFPROBE) += ffprobe
|
|
|
|
AVPROGS-$(CONFIG_FFSERVER) += ffserver
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2013-11-26 02:05:38 +03:00
|
|
|
AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
|
|
|
INSTPROGS = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
2013-11-02 18:44:18 +03:00
|
|
|
PROGS += $(AVPROGS)
|
2012-10-03 15:48:27 +03:00
|
|
|
|
2013-11-26 02:05:38 +03:00
|
|
|
AVBASENAMES = ffmpeg ffplay ffprobe ffserver
|
|
|
|
ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
|
|
|
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
2012-10-03 15:48:27 +03:00
|
|
|
|
2013-11-26 02:05:38 +03:00
|
|
|
$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
|
2013-12-09 06:01:00 +03:00
|
|
|
$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o))
|
2011-06-06 00:29:37 +03:00
|
|
|
|
2013-11-26 02:05:38 +03:00
|
|
|
OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o
|
2015-07-11 13:23:21 +02:00
|
|
|
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
|
2015-10-22 16:18:02 +02:00
|
|
|
OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o
|
2016-05-08 23:39:20 +02:00
|
|
|
OBJS-ffmpeg-$(CONFIG_VAAPI) += ffmpeg_vaapi.o
|
2016-05-09 16:52:05 +02:00
|
|
|
ifndef CONFIG_VIDEOTOOLBOX
|
|
|
|
OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
|
|
|
|
endif
|
2016-06-04 19:07:21 +02:00
|
|
|
OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o
|
2016-05-09 16:52:05 +02:00
|
|
|
OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
|
|
|
|
OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
|
2014-10-19 16:39:06 +03:00
|
|
|
OBJS-ffserver += ffserver_config.o
|
2013-11-03 21:21:00 +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
|
|
|
|
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
|
2012-03-24 00:42:17 +03:00
|
|
|
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
|
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
|
2012-09-13 22:12:56 +03:00
|
|
|
EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
|
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
|
|
|
|
2013-11-02 18:44:18 +03:00
|
|
|
all: $(AVPROGS)
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2016-11-29 16:09:35 +02:00
|
|
|
$(TOOLS): %$(EXESUF): %.o
|
2014-07-16 18:00:11 +03:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(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)
|
|
|
|
|
2017-04-14 02:03:41 +02:00
|
|
|
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
|
|
|
|
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)
|
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 \
|
|
|
|
$(SRC_PATH)/libavformat/protocols.c \
|
|
|
|
|
2017-05-03 12:51:48 +02:00
|
|
|
config.h: ffbuild/.config
|
|
|
|
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
2010-07-22 20:47:56 +03:00
|
|
|
@-tput bold 2>/dev/null
|
2016-12-04 23:01:50 +02:00
|
|
|
@-printf '\nWARNING: $(?) newer than config.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
|
|
|
|
2012-02-06 21:31:18 +03:00
|
|
|
SUBDIR_VARS := CLEANFILES EXAMPLES 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 \
|
2016-10-08 17:43:37 +02:00
|
|
|
ALTIVEC-OBJS VSX-OBJS MMX-OBJS YASM-OBJS \
|
2015-12-03 15:22:16 +02:00
|
|
|
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
2015-07-03 12:11:27 +02:00
|
|
|
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
|
2008-08-25 02:17:26 +03:00
|
|
|
|
|
|
|
define RESET
|
|
|
|
$(1) :=
|
|
|
|
$(1)-yes :=
|
|
|
|
endef
|
|
|
|
|
2017-05-05 00:59:30 +02:00
|
|
|
ifdef CONFIG_RAISE_MAJOR
|
|
|
|
RAISE_MAJOR = 100
|
|
|
|
else
|
|
|
|
RAISE_MAJOR = 0
|
|
|
|
endif
|
|
|
|
|
2008-08-25 02:17:26 +03:00
|
|
|
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))))
|
|
|
|
|
2013-11-02 19:05:28 +03:00
|
|
|
include $(SRC_PATH)/doc/Makefile
|
|
|
|
|
2012-08-04 21:04:08 +03:00
|
|
|
define DOPROG
|
2016-11-29 16:09:35 +02:00
|
|
|
OBJS-$(1) += $(1).o $(OBJS-$(1)-yes)
|
2012-10-16 15:15:16 +03:00
|
|
|
$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
|
2012-08-04 21:04:08 +03:00
|
|
|
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
|
2012-08-26 06:19:30 +03:00
|
|
|
$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
|
2017-04-17 10:22:52 +02:00
|
|
|
$(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(EXTRALIBS-$(1))
|
2012-08-04 21:04:08 +03:00
|
|
|
-include $$(OBJS-$(1):.o=.d)
|
|
|
|
endef
|
|
|
|
|
2013-11-27 03:52:55 +03:00
|
|
|
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2014-12-20 05:09:01 +02:00
|
|
|
ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.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)
|
2013-11-26 03:50:25 +03:00
|
|
|
$(CP) $< $@
|
|
|
|
$(STRIP) $@
|
|
|
|
|
2012-10-16 15:15:16 +03:00
|
|
|
%$(PROGSSUF)_g$(EXESUF): %.o $(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
|
|
|
|
2013-11-02 18:44:18 +03:00
|
|
|
ifdef AVPROGS
|
2011-06-07 12:11:21 +03:00
|
|
|
install: install-progs install-data
|
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
|
|
|
2011-06-11 21:54:23 +03:00
|
|
|
install-progs-yes:
|
2011-06-07 12:11:21 +03:00
|
|
|
install-progs-$(CONFIG_SHARED): install-libs
|
|
|
|
|
2013-11-02 18:44:18 +03:00
|
|
|
install-progs: install-progs-yes $(AVPROGS)
|
2010-03-06 19:14:19 +02:00
|
|
|
$(Q)mkdir -p "$(BINDIR)"
|
2011-09-06 16:48:14 +03:00
|
|
|
$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
|
2008-08-25 02:17:26 +03:00
|
|
|
|
2012-05-10 00:57:40 +03:00
|
|
|
install-data: $(DATA_FILES) $(EXAMPLES_FILES)
|
|
|
|
$(Q)mkdir -p "$(DATADIR)/examples"
|
2010-03-06 19:14:13 +02:00
|
|
|
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
2012-05-10 00:57:40 +03:00
|
|
|
$(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
|
2009-01-26 00:44:57 +02:00
|
|
|
|
2011-06-06 20:03:22 +03:00
|
|
|
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
|
2010-01-27 00:23:12 +02:00
|
|
|
|
|
|
|
uninstall-progs:
|
2013-11-02 18:44:18 +03:00
|
|
|
$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
|
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::
|
2013-11-26 02:05:38 +03:00
|
|
|
$(RM) $(ALLAVPROGS) $(ALLAVPROGS_G)
|
2010-03-06 16:25:10 +02:00
|
|
|
$(RM) $(CLEANSUFFIXES)
|
2017-02-21 15:36:15 +02:00
|
|
|
$(RM) $(CLEANSUFFIXES:%=compat/msvcrt/%)
|
2017-03-01 14:42:43 +02:00
|
|
|
$(RM) $(CLEANSUFFIXES:%=compat/atomics/pthread/%)
|
2017-02-21 15:36:15 +02:00
|
|
|
$(RM) $(CLEANSUFFIXES:%=compat/%)
|
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
|
|
|
|
|
|
|
distclean::
|
2010-03-06 16:25:10 +02:00
|
|
|
$(RM) $(DISTCLEANSUFFIXES)
|
2017-05-03 12:51:48 +02:00
|
|
|
$(RM) .version avversion.h config.asm config.h mapfile \
|
|
|
|
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
|
|
|
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
|
|
|
libavcodec/bsf_list.c libavformat/protocol_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
|
|
|
|
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
|
|
|
|
2011-06-28 20:45:13 +03:00
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(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:
|
|
|
|
|
2012-05-12 18:33:16 +03:00
|
|
|
.PHONY: all all-yes alltools check *clean config install*
|
2011-06-06 21:44:29 +03:00
|
|
|
.PHONY: testprogs uninstall*
|