2008-08-25 01:17:26 +02:00
|
|
|
include config.mak
|
|
|
|
|
2011-06-06 23:38:38 +02:00
|
|
|
vpath %.c $(SRC_PATH)
|
|
|
|
vpath %.h $(SRC_PATH)
|
|
|
|
vpath %.S $(SRC_PATH)
|
|
|
|
vpath %.asm $(SRC_PATH)
|
|
|
|
vpath %.v $(SRC_PATH)
|
|
|
|
vpath %.texi $(SRC_PATH)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-06-05 23:29:37 +02:00
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
2012-08-28 14:02:35 +02:00
|
|
|
BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
|
2012-08-08 02:41:57 +02:00
|
|
|
SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
|
2011-06-05 23:29:37 +02: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 23:38:38 +02:00
|
|
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
|
2011-06-05 23:29:37 +02:00
|
|
|
endif
|
|
|
|
|
2012-03-23 22:42:17 +01:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
|
2011-07-13 19:17:54 +02:00
|
|
|
|
2011-06-05 23:29:37 +02:00
|
|
|
IFLAGS := -I. -I$(SRC_PATH)
|
|
|
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
|
|
|
CFLAGS += $(ECFLAGS)
|
2012-07-20 14:43:07 +02:00
|
|
|
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
|
|
|
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
2012-07-15 11:48:21 +02:00
|
|
|
YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
|
2013-02-03 15:13:17 +01:00
|
|
|
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
2012-08-28 17:06:56 +02:00
|
|
|
LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
|
2011-06-05 23:29:37 +02:00
|
|
|
|
2011-06-25 12:57:32 +02:00
|
|
|
define COMPILE
|
2012-07-20 14:43:07 +02:00
|
|
|
$(call $(1)DEP,$(1))
|
2012-07-21 00:43:27 +02:00
|
|
|
$($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
|
2011-06-25 12:57:32 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
COMPILE_C = $(call COMPILE,CC)
|
|
|
|
COMPILE_S = $(call COMPILE,AS)
|
|
|
|
|
2011-06-05 23:29:37 +02:00
|
|
|
%.o: %.c
|
2011-06-25 12:57:32 +02:00
|
|
|
$(COMPILE_C)
|
2011-06-05 23:29:37 +02:00
|
|
|
|
|
|
|
%.o: %.S
|
2011-06-25 12:57:32 +02:00
|
|
|
$(COMPILE_S)
|
2011-06-05 23:29:37 +02:00
|
|
|
|
2012-10-03 14:48:27 +02:00
|
|
|
%.i: %.c
|
|
|
|
$(CC) $(CCFLAGS) $(CC_E) $<
|
|
|
|
|
2012-08-07 03:11:25 +02:00
|
|
|
%.h.c:
|
|
|
|
$(Q)echo '#include "$*.h"' >$@
|
2011-06-05 23:29:37 +02:00
|
|
|
|
|
|
|
%.ver: %.v
|
|
|
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
|
|
|
|
|
|
|
%.c %.h: TAG = GEN
|
|
|
|
|
2011-07-27 20:56:59 +02:00
|
|
|
PROGS-$(CONFIG_AVCONV) += avconv
|
2011-07-26 17:51:34 +02:00
|
|
|
PROGS-$(CONFIG_AVPLAY) += avplay
|
2011-07-26 19:04:43 +02:00
|
|
|
PROGS-$(CONFIG_AVPROBE) += avprobe
|
2011-07-26 21:56:56 +02:00
|
|
|
PROGS-$(CONFIG_AVSERVER) += avserver
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-01-20 03:04:19 +01:00
|
|
|
PROGS := $(PROGS-yes:%=%$(EXESUF))
|
2012-10-15 05:05:03 +02:00
|
|
|
OBJS = cmdutils.o $(EXEOBJS)
|
2012-08-02 08:24:02 +02:00
|
|
|
OBJS-avconv = avconv_opt.o avconv_filter.o
|
2011-01-25 14:25:18 +01:00
|
|
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
|
2012-03-14 20:08:50 +01:00
|
|
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
2011-07-10 21:26:25 +02:00
|
|
|
TOOLS = qt-faststart trasher
|
|
|
|
TOOLS-$(CONFIG_ZLIB) += cws2fws
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2012-01-12 11:12:15 +01:00
|
|
|
BASENAMES = avconv avplay avprobe avserver
|
2011-01-20 03:04:19 +01:00
|
|
|
ALLPROGS = $(BASENAMES:%=%$(EXESUF))
|
|
|
|
ALLMANPAGES = $(BASENAMES:%=%.1)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2010-01-27 00:13:01 +01:00
|
|
|
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
2008-08-25 01:17:26 +02:00
|
|
|
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
2010-01-27 00:13:01 +01:00
|
|
|
FFLIBS-$(CONFIG_AVFORMAT) += avformat
|
2012-03-23 22:42:17 +01:00
|
|
|
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
|
2010-01-27 01:26:41 +01:00
|
|
|
FFLIBS-$(CONFIG_AVCODEC) += avcodec
|
2010-01-27 00:13:01 +01:00
|
|
|
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2010-01-27 00:13:01 +01:00
|
|
|
FFLIBS := avutil
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-10-19 08:22:23 +02:00
|
|
|
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
|
2009-01-25 23:44:57 +01:00
|
|
|
|
2010-03-08 19:43:38 +01:00
|
|
|
SKIPHEADERS = cmdutils_common_opts.h
|
|
|
|
|
2011-06-28 18:08:00 +02:00
|
|
|
include $(SRC_PATH)/common.mak
|
2008-08-25 01:17:26 +02:00
|
|
|
|
|
|
|
FF_EXTRALIBS := $(FFEXTRALIBS)
|
|
|
|
FF_DEP_LIBS := $(DEP_LIBS)
|
|
|
|
|
2011-07-11 21:53:15 +02:00
|
|
|
all: $(PROGS)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2012-10-15 05:05:03 +02:00
|
|
|
$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
|
|
|
$(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
|
2011-07-10 21:26:25 +02:00
|
|
|
|
2012-08-28 17:24:09 +02:00
|
|
|
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
|
2011-07-10 21:26:25 +02:00
|
|
|
|
2010-07-20 20:10:27 +02:00
|
|
|
config.h: .config
|
2011-06-06 23:38:38 +02:00
|
|
|
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
|
2010-07-22 19:47:56 +02:00
|
|
|
@-tput bold 2>/dev/null
|
|
|
|
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
|
|
|
|
@-tput sgr0 2>/dev/null
|
2010-07-20 20:10:27 +02:00
|
|
|
|
2012-02-06 19:31:18 +01:00
|
|
|
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
2012-10-25 16:13:06 +02:00
|
|
|
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
2012-12-05 00:29:34 +01:00
|
|
|
ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS \
|
2012-10-11 16:48:27 +02:00
|
|
|
ALTIVEC-OBJS VIS-OBJS \
|
2012-08-08 02:41:57 +02:00
|
|
|
MMX-OBJS YASM-OBJS \
|
2012-08-08 15:41:36 +02:00
|
|
|
OBJS HOSTOBJS TESTOBJS
|
2008-08-25 01:17:26 +02:00
|
|
|
|
|
|
|
define RESET
|
|
|
|
$(1) :=
|
|
|
|
$(1)-yes :=
|
|
|
|
endef
|
|
|
|
|
|
|
|
define DOSUBDIR
|
|
|
|
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
|
|
|
|
SUBDIR := $(1)/
|
2011-06-28 18:08:00 +02:00
|
|
|
include $(SRC_PATH)/$(1)/Makefile
|
2012-01-25 13:35:19 +01:00
|
|
|
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
|
2011-12-13 15:55:11 +01:00
|
|
|
include $(SRC_PATH)/library.mak
|
2008-08-25 01:17:26 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
|
|
|
|
2012-08-04 20:04:08 +02:00
|
|
|
define DOPROG
|
2012-10-15 05:05:03 +02:00
|
|
|
OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
|
2012-10-15 04:59:16 +02:00
|
|
|
$(1)$(EXESUF): $$(OBJS-$(1))
|
2012-08-04 20:04:08 +02:00
|
|
|
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
|
|
|
|
$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
|
|
|
|
$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
|
|
|
|
-include $$(OBJS-$(1):.o=.d)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2012-10-15 04:59:16 +02:00
|
|
|
$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
|
|
|
|
$(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-06-28 19:45:13 +02:00
|
|
|
OBJDIRS += tools
|
|
|
|
|
2011-02-20 18:16:42 +01:00
|
|
|
-include $(wildcard tools/*.d)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-06-06 23:38:38 +02:00
|
|
|
VERSION_SH = $(SRC_PATH)/version.sh
|
|
|
|
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
2010-03-10 03:56:56 +01:00
|
|
|
|
2011-03-16 21:53:58 +01:00
|
|
|
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
|
2010-03-10 03:56:56 +01:00
|
|
|
.version: M=@
|
|
|
|
|
|
|
|
version.h .version:
|
2010-03-10 04:10:26 +01:00
|
|
|
$(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
|
2010-03-10 03:56:56 +01:00
|
|
|
$(Q)touch .version
|
|
|
|
|
|
|
|
# force version.sh to run whenever version might have changed
|
|
|
|
-include .version
|
2009-02-21 19:19:26 +01:00
|
|
|
|
2011-06-07 11:11:21 +02:00
|
|
|
ifdef PROGS
|
|
|
|
install: install-progs install-data
|
|
|
|
endif
|
|
|
|
|
|
|
|
install: install-libs install-headers
|
2011-06-05 22:52:32 +02:00
|
|
|
|
|
|
|
install-libs: install-libs-yes
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2011-06-11 20:54:23 +02:00
|
|
|
install-progs-yes:
|
2011-06-07 11:11:21 +02:00
|
|
|
install-progs-$(CONFIG_SHARED): install-libs
|
|
|
|
|
|
|
|
install-progs: install-progs-yes $(PROGS)
|
2010-03-06 18:14:19 +01:00
|
|
|
$(Q)mkdir -p "$(BINDIR)"
|
2010-03-06 18:14:13 +01:00
|
|
|
$(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2009-01-25 23:44:57 +01:00
|
|
|
install-data: $(DATA_FILES)
|
2010-03-06 18:14:19 +01:00
|
|
|
$(Q)mkdir -p "$(DATADIR)"
|
2010-03-06 18:14:13 +01:00
|
|
|
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
2009-01-25 23:44:57 +01:00
|
|
|
|
2011-06-06 19:03:22 +02:00
|
|
|
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
|
2010-01-26 23:23:12 +01:00
|
|
|
|
|
|
|
uninstall-progs:
|
2010-03-06 15:25:10 +01:00
|
|
|
$(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
|
2010-01-26 23:23:12 +01:00
|
|
|
|
|
|
|
uninstall-data:
|
2010-03-06 15:25:10 +01:00
|
|
|
$(RM) -r "$(DATADIR)"
|
2010-01-26 23:23:12 +01:00
|
|
|
|
2011-06-06 20:44:29 +02:00
|
|
|
clean::
|
2011-03-29 21:50:26 +02:00
|
|
|
$(RM) $(ALLPROGS)
|
2010-03-06 15:25:10 +01:00
|
|
|
$(RM) $(CLEANSUFFIXES)
|
2011-02-12 09:50:46 +01:00
|
|
|
$(RM) $(CLEANSUFFIXES:%=tools/%)
|
2008-08-25 01:17:26 +02:00
|
|
|
|
|
|
|
distclean::
|
2010-03-06 15:25:10 +01:00
|
|
|
$(RM) $(DISTCLEANSUFFIXES)
|
2013-03-25 11:52:52 +01:00
|
|
|
$(RM) config.* .config libavutil/avconfig.h .version version.h
|
2008-08-25 01:17:26 +02:00
|
|
|
|
2010-07-22 19:47:56 +02:00
|
|
|
config:
|
2011-03-14 22:23:10 +01:00
|
|
|
$(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
|
2009-06-16 00:12:23 +02:00
|
|
|
|
2011-06-26 13:52:40 +02:00
|
|
|
check: all alltools checkheaders examples testprogs fate
|
|
|
|
|
2011-06-28 18:08:00 +02:00
|
|
|
include $(SRC_PATH)/doc/Makefile
|
|
|
|
include $(SRC_PATH)/tests/Makefile
|
2010-08-26 15:58:45 +02:00
|
|
|
|
2011-06-28 19:45:13 +02:00
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(Q)mkdir -p $@
|
|
|
|
|
2011-06-06 16:21:12 +02: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:
|
|
|
|
|
2011-06-26 13:52:40 +02:00
|
|
|
.PHONY: all all-yes alltools check *clean config examples install*
|
2011-06-06 20:44:29 +02:00
|
|
|
.PHONY: testprogs uninstall*
|