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