Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. MAIN_MAKEFILE=1
  2. include ffbuild/config.mak
  3. vpath %.c $(SRC_PATH)
  4. vpath %.cpp $(SRC_PATH)
  5. vpath %.h $(SRC_PATH)
  6. vpath %.inc $(SRC_PATH)
  7. vpath %.m $(SRC_PATH)
  8. vpath %.S $(SRC_PATH)
  9. vpath %.asm $(SRC_PATH)
  10. vpath %.rc $(SRC_PATH)
  11. vpath %.v $(SRC_PATH)
  12. vpath %.texi $(SRC_PATH)
  13. vpath %.cu $(SRC_PATH)
  14. vpath %.ptx $(SRC_PATH)
  15. vpath %/fate_config.sh.template $(SRC_PATH)
  16. TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
  17. HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
  18. # $(FFLIBS-yes) needs to be in linking order
  19. FFLIBS-$(CONFIG_AVDEVICE) += avdevice
  20. FFLIBS-$(CONFIG_AVFILTER) += avfilter
  21. FFLIBS-$(CONFIG_AVFORMAT) += avformat
  22. FFLIBS-$(CONFIG_AVCODEC) += avcodec
  23. FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
  24. FFLIBS-$(CONFIG_POSTPROC) += postproc
  25. FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
  26. FFLIBS-$(CONFIG_SWSCALE) += swscale
  27. FFLIBS := avutil
  28. DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
  29. SKIPHEADERS = compat/w32pthreads.h
  30. # first so "all" becomes default target
  31. all: all-yes
  32. include $(SRC_PATH)/tools/Makefile
  33. include $(SRC_PATH)/ffbuild/common.mak
  34. FF_EXTRALIBS := $(FFEXTRALIBS)
  35. FF_DEP_LIBS := $(DEP_LIBS)
  36. FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
  37. $(TOOLS): %$(EXESUF): %.o
  38. $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
  39. target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
  40. $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
  41. tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
  42. tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
  43. tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
  44. tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
  45. CONFIGURABLE_COMPONENTS = \
  46. $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
  47. $(SRC_PATH)/libavcodec/bitstream_filters.c \
  48. $(SRC_PATH)/libavcodec/parsers.c \
  49. $(SRC_PATH)/libavformat/protocols.c \
  50. config.h: ffbuild/.config
  51. ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
  52. @-tput bold 2>/dev/null
  53. @-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
  54. @-tput sgr0 2>/dev/null
  55. SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
  56. HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
  57. ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
  58. ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
  59. MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
  60. MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
  61. define RESET
  62. $(1) :=
  63. $(1)-yes :=
  64. endef
  65. define DOSUBDIR
  66. $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
  67. SUBDIR := $(1)/
  68. include $(SRC_PATH)/$(1)/Makefile
  69. -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
  70. -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
  71. include $(SRC_PATH)/ffbuild/library.mak
  72. endef
  73. $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
  74. include $(SRC_PATH)/fftools/Makefile
  75. include $(SRC_PATH)/doc/Makefile
  76. include $(SRC_PATH)/doc/examples/Makefile
  77. 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
  78. $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
  79. ifeq ($(STRIPTYPE),direct)
  80. $(STRIP) -o $@ $<
  81. else
  82. $(CP) $< $@
  83. $(STRIP) $@
  84. endif
  85. %$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
  86. $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
  87. VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
  88. GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
  89. .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
  90. .version: M=@
  91. libavutil/ffversion.h .version:
  92. $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
  93. $(Q)touch .version
  94. # force version.sh to run whenever version might have changed
  95. -include .version
  96. install: install-libs install-headers
  97. install-libs: install-libs-yes
  98. install-data: $(DATA_FILES)
  99. $(Q)mkdir -p "$(DATADIR)"
  100. $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
  101. uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
  102. uninstall-data:
  103. $(RM) -r "$(DATADIR)"
  104. clean::
  105. $(RM) $(CLEANSUFFIXES)
  106. $(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES))
  107. $(RM) -r coverage-html
  108. $(RM) -rf coverage.info coverage.info.in lcov
  109. distclean:: clean
  110. $(RM) .version avversion.h config.asm config.h mapfile \
  111. ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
  112. version.h libavutil/ffversion.h libavcodec/codec_names.h \
  113. libavcodec/bsf_list.c libavformat/protocol_list.c \
  114. libavcodec/codec_list.c libavcodec/parser_list.c \
  115. libavformat/muxer_list.c libavformat/demuxer_list.c
  116. ifeq ($(SRC_LINK),src)
  117. $(RM) src
  118. endif
  119. $(RM) -rf doc/examples/pc-uninstalled
  120. config:
  121. $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
  122. build: all alltools examples testprogs
  123. check: all alltools examples testprogs fate
  124. include $(SRC_PATH)/tests/Makefile
  125. $(sort $(OBJDIRS)):
  126. $(Q)mkdir -p $@
  127. # Dummy rule to stop make trying to rebuild removed or renamed headers
  128. %.h:
  129. @:
  130. # Disable suffix rules. Most of the builtin rules are suffix rules,
  131. # so this saves some time on slow systems.
  132. .SUFFIXES:
  133. .PHONY: all all-yes alltools build check config testprogs
  134. .PHONY: *clean install* uninstall*