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