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