Subversion Repositories Kolibri OS

Rev

Rev 4349 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. MAIN_MAKEFILE=1
  2. include config.mak
  3.  
  4. vpath %.c    $(SRC_PATH)
  5. vpath %.cpp  $(SRC_PATH)
  6. vpath %.h    $(SRC_PATH)
  7. vpath %.S    $(SRC_PATH)
  8. vpath %.asm  $(SRC_PATH)
  9. vpath %.v    $(SRC_PATH)
  10. vpath %.texi $(SRC_PATH)
  11. vpath %/fate_config.sh.template $(SRC_PATH)
  12.  
  13. PROGS-$(CONFIG_FFMPEG)   += ffmpeg
  14. PROGS-$(CONFIG_FFPLAY)   += ffplay
  15. PROGS-$(CONFIG_FFPROBE)  += ffprobe
  16. PROGS-$(CONFIG_FFSERVER) += ffserver
  17.  
  18. PROGS      := $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
  19. INSTPROGS   = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
  20.  
  21. OBJS        = cmdutils.o $(EXEOBJS)
  22. OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o
  23. TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
  24. HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
  25. TOOLS       = qt-faststart trasher
  26. TOOLS-$(CONFIG_ZLIB) += cws2fws
  27.  
  28. BASENAMES   = ffmpeg ffplay ffprobe ffserver
  29. ALLPROGS    = $(BASENAMES:%=%$(PROGSSUF)$(EXESUF))
  30. ALLPROGS_G  = $(BASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
  31.  
  32. FFLIBS-$(CONFIG_AVDEVICE) += avdevice
  33. FFLIBS-$(CONFIG_AVFILTER) += avfilter
  34. FFLIBS-$(CONFIG_AVFORMAT) += avformat
  35. FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
  36. FFLIBS-$(CONFIG_AVCODEC)  += avcodec
  37. FFLIBS-$(CONFIG_POSTPROC) += postproc
  38. FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
  39. FFLIBS-$(CONFIG_SWSCALE)  += swscale
  40.  
  41. FFLIBS := avutil
  42.  
  43. DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
  44. EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
  45.  
  46. SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
  47.  
  48. include $(SRC_PATH)/common.mak
  49.  
  50. FF_EXTRALIBS := $(FFEXTRALIBS)
  51. FF_DEP_LIBS  := $(DEP_LIBS)
  52.  
  53. all: $(PROGS)
  54.  
  55. $(PROGS): %$(EXESUF): %_g$(EXESUF)
  56.         $(CP) $< $@
  57.         $(STRIP) $@
  58.  
  59. $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
  60.         $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
  61.  
  62. tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
  63.  
  64. config.h: .config
  65. .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
  66.         @-tput bold 2>/dev/null
  67.         @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
  68.         @-tput sgr0 2>/dev/null
  69.  
  70. SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS      \
  71.                HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS            \
  72.                ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS                \
  73.                ALTIVEC-OBJS VIS-OBJS                                     \
  74.                MMX-OBJS YASM-OBJS                                        \
  75.                MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS  \
  76.                OBJS HOSTOBJS TESTOBJS
  77.  
  78. define RESET
  79. $(1) :=
  80. $(1)-yes :=
  81. endef
  82.  
  83. define DOSUBDIR
  84. $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
  85. SUBDIR := $(1)/
  86. include $(SRC_PATH)/$(1)/Makefile
  87. -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
  88. include $(SRC_PATH)/library.mak
  89. endef
  90.  
  91. $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
  92.  
  93. define DOPROG
  94. OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
  95. $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
  96. $$(OBJS-$(1)): CFLAGS  += $(CFLAGS-$(1))
  97. $(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
  98. $(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
  99. -include $$(OBJS-$(1):.o=.d)
  100. endef
  101.  
  102. $(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
  103.  
  104. %$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS)
  105.         $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
  106.  
  107. OBJDIRS += tools
  108.  
  109. -include $(wildcard tools/*.d)
  110.  
  111. VERSION_SH  = $(SRC_PATH)/version.sh
  112. GIT_LOG     = $(SRC_PATH)/.git/logs/HEAD
  113.  
  114. .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
  115. .version: M=@
  116.  
  117. version.h .version:
  118.         $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
  119.         $(Q)touch .version
  120.  
  121. # force version.sh to run whenever version might have changed
  122. -include .version
  123.  
  124. ifdef PROGS
  125. install: install-progs install-data
  126. endif
  127.  
  128. install: install-libs install-headers
  129.  
  130. install-libs: install-libs-yes
  131.  
  132. install-progs-yes:
  133. install-progs-$(CONFIG_SHARED): install-libs
  134.  
  135. install-progs: install-progs-yes $(PROGS)
  136.         $(Q)mkdir -p "$(BINDIR)"
  137.         $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
  138.  
  139. install-data: $(DATA_FILES) $(EXAMPLES_FILES)
  140.         $(Q)mkdir -p "$(DATADIR)/examples"
  141.         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
  142.         $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
  143.  
  144. uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
  145.  
  146. uninstall-progs:
  147.         $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
  148.  
  149. uninstall-data:
  150.         $(RM) -r "$(DATADIR)"
  151.  
  152. clean::
  153.         $(RM) $(ALLPROGS) $(ALLPROGS_G)
  154.         $(RM) $(CLEANSUFFIXES)
  155.         $(RM) $(CLEANSUFFIXES:%=tools/%)
  156.         $(RM) -r coverage-html
  157.         $(RM) -rf coverage.info lcov
  158.  
  159. distclean::
  160.         $(RM) $(DISTCLEANSUFFIXES)
  161.         $(RM) config.* .config libavutil/avconfig.h .version version.h libavcodec/codec_names.h
  162.  
  163. config:
  164.         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
  165.  
  166. check: all alltools examples testprogs fate
  167.  
  168. #include $(SRC_PATH)/doc/Makefile
  169. #include $(SRC_PATH)/tests/Makefile
  170.  
  171. $(sort $(OBJDIRS)):
  172.         $(Q)mkdir -p $@
  173.  
  174. # Dummy rule to stop make trying to rebuild removed or renamed headers
  175. %.h:
  176.         @:
  177.  
  178. # Disable suffix rules.  Most of the builtin rules are suffix rules,
  179. # so this saves some time on slow systems.
  180. .SUFFIXES:
  181.  
  182. .PHONY: all all-yes alltools check *clean config install*
  183. .PHONY: testprogs uninstall*
  184.