Makefile 5.13 KB
Newer Older
1
MAIN_MAKEFILE=1
2
include ffbuild/config.mak
3

4
vpath %.c    $(SRC_PATH)
Mohamed Naufal's avatar
Mohamed Naufal committed
5
vpath %.cpp  $(SRC_PATH)
6
vpath %.h    $(SRC_PATH)
7
vpath %.inc  $(SRC_PATH)
8
vpath %.m    $(SRC_PATH)
9 10
vpath %.S    $(SRC_PATH)
vpath %.asm  $(SRC_PATH)
11
vpath %.rc   $(SRC_PATH)
12 13
vpath %.v    $(SRC_PATH)
vpath %.texi $(SRC_PATH)
14 15
vpath %.cu   $(SRC_PATH)
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 22 23 24 25
# $(FFLIBS-yes) needs to be in linking order
FFLIBS-$(CONFIG_AVDEVICE)   += avdevice
FFLIBS-$(CONFIG_AVFILTER)   += avfilter
FFLIBS-$(CONFIG_AVFORMAT)   += avformat
FFLIBS-$(CONFIG_AVCODEC)    += avcodec
Justin Ruggles's avatar
Justin Ruggles committed
26
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
27 28
FFLIBS-$(CONFIG_POSTPROC)   += postproc
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 38 39
# first so "all" becomes default target
all: all-yes

40
include $(SRC_PATH)/tools/Makefile
41
include $(SRC_PATH)/ffbuild/common.mak
42 43 44

FF_EXTRALIBS := $(FFEXTRALIBS)
FF_DEP_LIBS  := $(DEP_LIBS)
45
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
46

Diego Biurrun's avatar
Diego Biurrun committed
47
$(TOOLS): %$(EXESUF): %.o
48
	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
49

50 51 52
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)

Paul B Mahol's avatar
Paul B Mahol committed
53
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
54 55
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
56
tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
57

58 59 60 61 62
CONFIGURABLE_COMPONENTS =                                           \
    $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))                 \
    $(SRC_PATH)/libavcodec/bitstream_filters.c                      \
    $(SRC_PATH)/libavformat/protocols.c                             \

63 64
config.h: ffbuild/.config
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
65
	@-tput bold 2>/dev/null
66
	@-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
67
	@-tput sgr0 2>/dev/null
68

69
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS               \
70
               HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS            \
71
               ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS     \
72
               ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS                \
73
               MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS         \
74
               MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
75 76 77 78 79 80 81 82 83

define RESET
$(1) :=
$(1)-yes :=
endef

define DOSUBDIR
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
SUBDIR := $(1)/
84
include $(SRC_PATH)/$(1)/Makefile
85
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
86
-include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
87
include $(SRC_PATH)/ffbuild/library.mak
88 89 90 91
endef

$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))

James Almer's avatar
James Almer committed
92
include $(SRC_PATH)/fftools/Makefile
93
include $(SRC_PATH)/doc/Makefile
94
include $(SRC_PATH)/doc/examples/Makefile
95

James Almer's avatar
James Almer committed
96
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
97

98
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
99 100 101
ifeq ($(STRIPTYPE),direct)
	$(STRIP) -o $@ $<
else
102 103
	$(CP) $< $@
	$(STRIP) $@
104
endif
105

James Almer's avatar
James Almer committed
106
%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
107
	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
108

109
VERSION_SH  = $(SRC_PATH)/ffbuild/version.sh
110
GIT_LOG     = $(SRC_PATH)/.git/logs/HEAD
111

112
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
113 114
.version: M=@

115 116
libavutil/ffversion.h .version:
	$(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION)
117 118 119 120
	$(Q)touch .version

# force version.sh to run whenever version might have changed
-include .version
121

122
install: install-libs install-headers
123 124

install-libs: install-libs-yes
125

126 127
install-data: $(DATA_FILES)
	$(Q)mkdir -p "$(DATADIR)"
128
	$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
129

130
uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
131 132

uninstall-data:
133
	$(RM) -r "$(DATADIR)"
134

135
clean::
136
	$(RM) $(CLEANSUFFIXES)
137
	$(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES))
138
	$(RM) -r coverage-html
139
	$(RM) -rf coverage.info coverage.info.in lcov
140

141
distclean:: clean
142 143 144 145
	$(RM) .version avversion.h config.asm config.h mapfile  \
		ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
		version.h libavutil/ffversion.h libavcodec/codec_names.h \
		libavcodec/bsf_list.c libavformat/protocol_list.c
146 147 148
ifeq ($(SRC_LINK),src)
	$(RM) src
endif
149
	$(RM) -rf doc/examples/pc-uninstalled
150

151
config:
152
	$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
153

James Almer's avatar
James Almer committed
154
build: all alltools examples testprogs
155
check: all alltools examples testprogs fate
156

157
include $(SRC_PATH)/tests/Makefile
158

159 160 161
$(sort $(OBJDIRS)):
	$(Q)mkdir -p $@

162 163 164 165 166 167 168 169
# Dummy rule to stop make trying to rebuild removed or renamed headers
%.h:
	@:

# Disable suffix rules.  Most of the builtin rules are suffix rules,
# so this saves some time on slow systems.
.SUFFIXES:

170 171
.PHONY: all all-yes alltools build check config testprogs
.PHONY: *clean install* uninstall*