2013-03-26 00:11:11 +00:00
|
|
|
include avbuild/config.mak
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.c $(SRC_PATH)
|
2015-11-23 22:08:49 +00:00
|
|
|
vpath %.m $(SRC_PATH)
|
2011-06-06 21:38:38 +00:00
|
|
|
vpath %.h $(SRC_PATH)
|
|
|
|
vpath %.S $(SRC_PATH)
|
|
|
|
vpath %.asm $(SRC_PATH)
|
|
|
|
vpath %.v $(SRC_PATH)
|
|
|
|
vpath %.texi $(SRC_PATH)
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2011-06-05 21:29:37 +00:00
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
2016-10-08 14:18:33 +00:00
|
|
|
BRIEF = CC HOSTCC HOSTLD AS X86ASM AR LD
|
|
|
|
SILENT = DEPCC DEPHOSTCC DEPAS DEPX86ASM RANLIB RM STRIP
|
2011-06-05 21:29:37 +00:00
|
|
|
MSG = $@
|
|
|
|
M = @$(call ECHO,$(TAG),$@);
|
|
|
|
$(foreach VAR,$(BRIEF), \
|
|
|
|
$(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
|
|
|
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
2011-06-06 21:38:38 +00:00
|
|
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
|
2011-06-05 21:29:37 +00:00
|
|
|
endif
|
|
|
|
|
2012-03-23 21:42:17 +00:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
|
2011-07-13 17:17:54 +00:00
|
|
|
|
2011-06-05 21:29:37 +00:00
|
|
|
IFLAGS := -I. -I$(SRC_PATH)
|
|
|
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
|
|
|
CFLAGS += $(ECFLAGS)
|
2012-07-20 12:43:07 +00:00
|
|
|
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
2015-11-23 22:08:49 +00:00
|
|
|
OBJCFLAGS += $(EOBJCFLAGS)
|
|
|
|
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
|
2012-07-20 12:43:07 +00:00
|
|
|
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
2016-10-13 00:45:09 +00:00
|
|
|
X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
|
2013-02-03 14:13:17 +00:00
|
|
|
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
2012-08-28 15:06:56 +00:00
|
|
|
LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
|
2011-06-05 21:29:37 +00:00
|
|
|
|
2011-06-25 10:57:32 +00:00
|
|
|
define COMPILE
|
2012-07-20 12:43:07 +00:00
|
|
|
$(call $(1)DEP,$(1))
|
2012-07-20 22:43:27 +00:00
|
|
|
$($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
|
2011-06-25 10:57:32 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
COMPILE_C = $(call COMPILE,CC)
|
|
|
|
COMPILE_S = $(call COMPILE,AS)
|
2015-11-23 22:08:49 +00:00
|
|
|
COMPILE_M = $(call COMPILE,OBJCC)
|
2016-10-13 00:45:09 +00:00
|
|
|
COMPILE_X86ASM = $(call COMPILE,X86ASM)
|
2013-12-02 02:51:48 +00:00
|
|
|
COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
2011-06-25 10:57:32 +00:00
|
|
|
|
2011-06-05 21:29:37 +00:00
|
|
|
%.o: %.c
|
2011-06-25 10:57:32 +00:00
|
|
|
$(COMPILE_C)
|
2011-06-05 21:29:37 +00:00
|
|
|
|
|
|
|
%.o: %.S
|
2011-06-25 10:57:32 +00:00
|
|
|
$(COMPILE_S)
|
2011-06-05 21:29:37 +00:00
|
|
|
|
2015-11-23 22:08:49 +00:00
|
|
|
%.o: %.m
|
|
|
|
$(COMPILE_M)
|
|
|
|
|
2013-12-01 05:01:51 +00:00
|
|
|
%_host.o: %.c
|
|
|
|
$(COMPILE_HOSTC)
|
|
|
|
|
2016-10-08 14:48:29 +00:00
|
|
|
%.o: %.asm
|
2016-10-13 00:45:09 +00:00
|
|
|
$(COMPILE_X86ASM)
|
2016-10-08 14:48:29 +00:00
|
|
|
-$(STRIP) $(STRIPFLAGS) $@
|
|
|
|
|
2012-10-03 12:48:27 +00:00
|
|
|
%.i: %.c
|
|
|
|
$(CC) $(CCFLAGS) $(CC_E) $<
|
|
|
|
|
2012-08-07 01:11:25 +00:00
|
|
|
%.h.c:
|
|
|
|
$(Q)echo '#include "$*.h"' >$@
|
2011-06-05 21:29:37 +00:00
|
|
|
|
2016-12-20 13:27:19 +00:00
|
|
|
%.c %.h %.pc %.ver %.version: TAG = GEN
|
2011-06-05 21:29:37 +00:00
|
|
|
|
2011-01-25 13:25:18 +00:00
|
|
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
|
2012-03-14 19:08:50 +00:00
|
|
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
2008-08-24 23:17:26 +00:00
|
|
|
|
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
|
2012-03-23 21:42:17 +00:00
|
|
|
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
|
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-10-19 06:22:23 +00:00
|
|
|
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
|
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
|
2013-03-26 00:11:11 +00:00
|
|
|
include $(SRC_PATH)/avbuild/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
|
2017-01-22 15:42:36 +00:00
|
|
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
2011-07-10 19:26:25 +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 \
|
|
|
|
$(SRC_PATH)/libavformat/protocols.c \
|
|
|
|
|
2013-03-26 00:11:11 +00:00
|
|
|
config.h: avbuild/.config
|
|
|
|
avbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
2010-07-22 17:47:56 +00:00
|
|
|
@-tput bold 2>/dev/null
|
2016-12-04 21:01:50 +00:00
|
|
|
@-printf '\nWARNING: $(?) newer than config.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 \
|
2016-10-08 14:18:33 +00:00
|
|
|
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
2012-08-08 13:41:36 +00:00
|
|
|
OBJS 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
|
2013-03-26 00:11:11 +00:00
|
|
|
include $(SRC_PATH)/avbuild/library.mak
|
2008-08-24 23:17:26 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
|
|
|
|
2017-01-04 14:09:29 +00:00
|
|
|
include $(SRC_PATH)/avtools/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
|
|
|
|
2017-01-04 14:09:29 +00:00
|
|
|
$(PROGS): %$(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
|
|
|
|
2013-03-26 00:11:11 +00:00
|
|
|
VERSION_SH = $(SRC_PATH)/avbuild/version.sh
|
2011-06-06 21:38:38 +00:00
|
|
|
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
2010-03-10 02:56:56 +00:00
|
|
|
|
2013-03-26 00:11:11 +00:00
|
|
|
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) avbuild/config.mak
|
2010-03-10 02:56:56 +00:00
|
|
|
.version: M=@
|
|
|
|
|
2017-01-04 14:09:29 +00:00
|
|
|
libavutil/utils.o: avversion.h
|
2015-07-02 17:04:59 +00:00
|
|
|
avversion.h .version:
|
|
|
|
$(M)$(VERSION_SH) $(SRC_PATH) avversion.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
|
|
|
|
2009-01-25 22:44:57 +00:00
|
|
|
install-data: $(DATA_FILES)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(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)
|
2017-10-19 17:18:18 +00:00
|
|
|
$(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES))
|
2013-03-23 07:17:24 +00:00
|
|
|
$(RM) -rf coverage.info lcov
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2017-11-13 20:34:15 +00:00
|
|
|
distclean: clean
|
2013-03-26 00:11:11 +00:00
|
|
|
$(RM) .version avversion.h config.asm config.h mapfile \
|
|
|
|
avbuild/.config avbuild/config.* libavutil/avconfig.h \
|
|
|
|
libavcodec/bsf_list.c libavformat/protocol_list.c
|
2008-08-24 23:17:26 +00:00
|
|
|
|
2010-07-22 17:47:56 +00:00
|
|
|
config:
|
2011-03-14 21:23:10 +00:00
|
|
|
$(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
|
2009-06-15 22:12:23 +00:00
|
|
|
|
2017-02-28 21:11:39 +00:00
|
|
|
build: all alltools checkheaders examples testprogs
|
2011-06-26 11:52:40 +00:00
|
|
|
check: all alltools checkheaders examples testprogs fate
|
|
|
|
|
2011-06-28 16:08:00 +00:00
|
|
|
include $(SRC_PATH)/tests/Makefile
|
2010-08-26 13:58:45 +00:00
|
|
|
|
2011-06-28 17:45:13 +00:00
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(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*
|