lavf: Remove codec_tag from dashenc and smoothstreamingenc
[ffmpeg.git] / Makefile
1 MAIN_MAKEFILE=1
2 include ffbuild/config.mak
3
4 vpath %.c    $(SRC_PATH)
5 vpath %.cpp  $(SRC_PATH)
6 vpath %.h    $(SRC_PATH)
7 vpath %.inc  $(SRC_PATH)
8 vpath %.m    $(SRC_PATH)
9 vpath %.S    $(SRC_PATH)
10 vpath %.asm  $(SRC_PATH)
11 vpath %.rc   $(SRC_PATH)
12 vpath %.v    $(SRC_PATH)
13 vpath %.texi $(SRC_PATH)
14 vpath %.cu   $(SRC_PATH)
15 vpath %.ptx  $(SRC_PATH)
16 vpath %/fate_config.sh.template $(SRC_PATH)
17
18 AVPROGS-$(CONFIG_FFMPEG)   += ffmpeg
19 AVPROGS-$(CONFIG_FFPLAY)   += ffplay
20 AVPROGS-$(CONFIG_FFPROBE)  += ffprobe
21 AVPROGS-$(CONFIG_FFSERVER) += ffserver
22
23 AVPROGS    := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
24 INSTPROGS   = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
25 PROGS      += $(AVPROGS)
26
27 AVBASENAMES  = ffmpeg ffplay ffprobe ffserver
28 ALLAVPROGS   = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
29 ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
30
31 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
32 $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o))
33
34 OBJS-ffmpeg                   += ffmpeg_opt.o ffmpeg_filter.o ffmpeg_hw.o
35 OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
36 OBJS-ffmpeg-$(CONFIG_LIBMFX)  += ffmpeg_qsv.o
37 ifndef CONFIG_VIDEOTOOLBOX
38 OBJS-ffmpeg-$(CONFIG_VDA)     += ffmpeg_videotoolbox.o
39 endif
40 OBJS-ffmpeg-$(CONFIG_CUVID)   += ffmpeg_cuvid.o
41 OBJS-ffserver                 += ffserver_config.o
42
43 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
44 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
45
46 # $(FFLIBS-yes) needs to be in linking order
47 FFLIBS-$(CONFIG_AVDEVICE)   += avdevice
48 FFLIBS-$(CONFIG_AVFILTER)   += avfilter
49 FFLIBS-$(CONFIG_AVFORMAT)   += avformat
50 FFLIBS-$(CONFIG_AVCODEC)    += avcodec
51 FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
52 FFLIBS-$(CONFIG_POSTPROC)   += postproc
53 FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
54 FFLIBS-$(CONFIG_SWSCALE)    += swscale
55
56 FFLIBS := avutil
57
58 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
59 EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
60
61 SKIPHEADERS = compat/w32pthreads.h
62
63 # first so "all" becomes default target
64 all: all-yes
65
66 include $(SRC_PATH)/tools/Makefile
67 include $(SRC_PATH)/ffbuild/common.mak
68
69 FF_EXTRALIBS := $(FFEXTRALIBS)
70 FF_DEP_LIBS  := $(DEP_LIBS)
71 FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
72
73 all: $(AVPROGS)
74
75 $(TOOLS): %$(EXESUF): %.o
76         $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
77
78 target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
79         $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
80
81 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
82 tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
83 tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
84 tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
85 tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
86
87 CONFIGURABLE_COMPONENTS =                                           \
88     $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))                 \
89     $(SRC_PATH)/libavcodec/bitstream_filters.c                      \
90     $(SRC_PATH)/libavformat/protocols.c                             \
91
92 config.h: ffbuild/.config
93 ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
94         @-tput bold 2>/dev/null
95         @-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
96         @-tput sgr0 2>/dev/null
97
98 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS      \
99                HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS            \
100                ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS     \
101                ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS                \
102                MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS         \
103                MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
104
105 define RESET
106 $(1) :=
107 $(1)-yes :=
108 endef
109
110 define DOSUBDIR
111 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
112 SUBDIR := $(1)/
113 include $(SRC_PATH)/$(1)/Makefile
114 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
115 -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
116 include $(SRC_PATH)/ffbuild/library.mak
117 endef
118
119 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
120
121 include $(SRC_PATH)/doc/Makefile
122
123 define DOPROG
124 OBJS-$(1) += $(1).o $(OBJS-$(1)-yes)
125 $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
126 $$(OBJS-$(1)): CFLAGS  += $(CFLAGS-$(1))
127 $(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
128 $(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(EXTRALIBS-$(1))
129 -include $$(OBJS-$(1):.o=.d)
130 endef
131
132 $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
133
134 ffprobe.o cmdutils.o 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
135
136 $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
137         $(CP) $< $@
138         $(STRIP) $@
139
140 %$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS)
141         $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
142
143 VERSION_SH  = $(SRC_PATH)/ffbuild/version.sh
144 GIT_LOG     = $(SRC_PATH)/.git/logs/HEAD
145
146 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
147 .version: M=@
148
149 libavutil/ffversion.h .version:
150         $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
151         $(Q)touch .version
152
153 # force version.sh to run whenever version might have changed
154 -include .version
155
156 ifdef AVPROGS
157 install: install-progs install-data
158 endif
159
160 install: install-libs install-headers
161
162 install-libs: install-libs-yes
163
164 install-progs-yes:
165 install-progs-$(CONFIG_SHARED): install-libs
166
167 install-progs: install-progs-yes $(AVPROGS)
168         $(Q)mkdir -p "$(BINDIR)"
169         $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
170
171 install-data: $(DATA_FILES) $(EXAMPLES_FILES)
172         $(Q)mkdir -p "$(DATADIR)/examples"
173         $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
174         $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
175
176 uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
177
178 uninstall-progs:
179         $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
180
181 uninstall-data:
182         $(RM) -r "$(DATADIR)"
183
184 clean::
185         $(RM) $(ALLAVPROGS) $(ALLAVPROGS_G)
186         $(RM) $(CLEANSUFFIXES)
187         $(RM) $(CLEANSUFFIXES:%=compat/msvcrt/%)
188         $(RM) $(CLEANSUFFIXES:%=compat/atomics/pthread/%)
189         $(RM) $(CLEANSUFFIXES:%=compat/%)
190         $(RM) -r coverage-html
191         $(RM) -rf coverage.info coverage.info.in lcov
192
193 distclean::
194         $(RM) $(DISTCLEANSUFFIXES)
195         $(RM) .version avversion.h config.asm config.h mapfile  \
196                 ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
197                 version.h libavutil/ffversion.h libavcodec/codec_names.h \
198                 libavcodec/bsf_list.c libavformat/protocol_list.c
199 ifeq ($(SRC_LINK),src)
200         $(RM) src
201 endif
202         $(RM) -rf doc/examples/pc-uninstalled
203
204 config:
205         $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
206
207 check: all alltools examples testprogs fate
208
209 include $(SRC_PATH)/tests/Makefile
210
211 $(sort $(OBJDIRS)):
212         $(Q)mkdir -p $@
213
214 # Dummy rule to stop make trying to rebuild removed or renamed headers
215 %.h:
216         @:
217
218 # Disable suffix rules.  Most of the builtin rules are suffix rules,
219 # so this saves some time on slow systems.
220 .SUFFIXES:
221
222 .PHONY: all all-yes alltools check *clean config install*
223 .PHONY: testprogs uninstall*