avcodec/jpegxl_parse{,r}: fix integer overflow for some malformed files
[FFMpeg-mirror.git] / Makefile
blobe2250f6bc6f2cf56aad5c70fe9719fc789c021a6
1 MAIN_MAKEFILE=1
2 include ffbuild/config.mak
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 %.metal $(SRC_PATH)
17 vpath %/fate_config.sh.template $(SRC_PATH)
19 TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
20 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
22 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
24 # $(FFLIBS-yes) needs to be in linking order
25 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
26 FFLIBS-$(CONFIG_AVFILTER) += avfilter
27 FFLIBS-$(CONFIG_AVFORMAT) += avformat
28 FFLIBS-$(CONFIG_AVCODEC) += avcodec
29 FFLIBS-$(CONFIG_POSTPROC) += postproc
30 FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
31 FFLIBS-$(CONFIG_SWSCALE) += swscale
33 FFLIBS := avutil
35 DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
37 SKIPHEADERS = compat/w32pthreads.h
39 # first so "all" becomes default target
40 all: all-yes
42 include $(SRC_PATH)/tools/Makefile
43 include $(SRC_PATH)/ffbuild/common.mak
45 FF_EXTRALIBS := $(FFEXTRALIBS)
46 FF_DEP_LIBS := $(DEP_LIBS)
47 FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
49 $(TOOLS): %$(EXESUF): %.o
50 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter-out $(FF_DEP_LIBS), $^) $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
52 target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
53 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
55 target_enc_%_fuzzer$(EXESUF): target_enc_%_fuzzer.o $(FF_DEP_LIBS)
56 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
58 tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS)
59 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
61 target_dem_%_fuzzer$(EXESUF): target_dem_%_fuzzer.o $(FF_DEP_LIBS)
62 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
64 tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
65 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
67 tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
68 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
70 tools/target_sws_fuzzer$(EXESUF): tools/target_sws_fuzzer.o $(FF_DEP_LIBS)
71 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
73 tools/target_swr_fuzzer$(EXESUF): tools/target_swr_fuzzer.o $(FF_DEP_LIBS)
74 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
76 tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
77 tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
78 tools/enc_recon_frame_test$(EXESUF): $(FF_DEP_LIBS)
79 tools/enc_recon_frame_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
80 tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS)
81 tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS)
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 tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
88 CONFIGURABLE_COMPONENTS = \
89 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
90 $(SRC_PATH)/libavcodec/bitstream_filters.c \
91 $(SRC_PATH)/libavcodec/hwaccels.h \
92 $(SRC_PATH)/libavcodec/parsers.c \
93 $(SRC_PATH)/libavformat/protocols.c \
95 config_components.h: ffbuild/.config
96 ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
97 @-tput bold 2>/dev/null
98 @-printf '\nWARNING: $(?) newer than config_components.h, rerun configure\n\n'
99 @-tput sgr0 2>/dev/null
101 SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
102 HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
103 ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
104 ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
105 MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
106 MMI-OBJS LSX-OBJS LASX-OBJS RV-OBJS RVV-OBJS RVVB-OBJS \
107 OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS \
108 SIMD128-OBJS
110 define RESET
111 $(1) :=
112 $(1)-yes :=
113 endef
115 define DOSUBDIR
116 $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
117 SUBDIR := $(1)/
118 include $(SRC_PATH)/$(1)/Makefile
119 -include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
120 -include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
121 include $(SRC_PATH)/ffbuild/library.mak
122 endef
124 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
126 include $(SRC_PATH)/fftools/Makefile
127 include $(SRC_PATH)/doc/Makefile
128 include $(SRC_PATH)/doc/examples/Makefile
130 $(ALLFFLIBS:%=lib%/version.o): libavutil/ffversion.h
132 $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
133 ifeq ($(STRIPTYPE),direct)
134 $(STRIP) -o $@ $<
135 else
136 $(RM) $@
137 $(CP) $< $@
138 $(STRIP) $@
139 endif
141 %$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
142 $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
144 VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
145 ifeq ($(VERSION_TRACKING),yes)
146 GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
147 endif
149 .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
150 .version: M=@
152 ifneq ($(VERSION_TRACKING),yes)
153 libavutil/ffversion.h .version: REVISION=unknown
154 endif
155 libavutil/ffversion.h .version:
156 $(M)revision=$(REVISION) $(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
157 $(Q)touch .version
159 # force version.sh to run whenever version might have changed
160 -include .version
162 install: install-libs install-headers
164 install-libs: install-libs-yes
166 install-data: $(DATA_FILES)
167 $(Q)mkdir -p "$(DATADIR)"
168 $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
170 uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
172 uninstall-data:
173 $(RM) -r "$(DATADIR)"
175 clean::
176 $(RM) $(CLEANSUFFIXES)
177 $(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(addprefix compat/*/*/,$(CLEANSUFFIXES))
178 $(RM) -r coverage-html
179 $(RM) -rf coverage.info coverage.info.in lcov
181 distclean:: clean
182 $(RM) .version config.asm config.h config_components.h mapfile \
183 ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
184 version.h libavutil/ffversion.h libavcodec/codec_names.h \
185 libavcodec/bsf_list.c libavformat/protocol_list.c \
186 libavcodec/codec_list.c libavcodec/parser_list.c \
187 libavfilter/filter_list.c libavdevice/indev_list.c libavdevice/outdev_list.c \
188 libavformat/muxer_list.c libavformat/demuxer_list.c
189 ifeq ($(SRC_LINK),src)
190 $(RM) src
191 endif
192 $(RM) -rf doc/examples/pc-uninstalled
194 config:
195 $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
197 build: all alltools examples testprogs
198 check: all alltools examples testprogs fate
200 include $(SRC_PATH)/tests/Makefile
202 $(sort $(OUTDIRS)):
203 $(Q)mkdir -p $@
205 # Dummy rule to stop make trying to rebuild removed or renamed headers
206 %.h:
209 # Disable suffix rules. Most of the builtin rules are suffix rules,
210 # so this saves some time on slow systems.
211 .SUFFIXES:
213 .PHONY: all all-yes alltools build check config testprogs
214 .PHONY: *clean install* uninstall*