Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf.
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
451db983
MR
5# first so "all" becomes default target
6all: all-yes
0e32c8c6 7
8e255b8b 8ifndef SUBDIR
6ccf540f
DB
9vpath %.c $(SRC_DIR)
10vpath %.h $(SRC_DIR)
11vpath %.S $(SRC_DIR)
304d586d 12vpath %.asm $(SRC_DIR)
a482e61b 13vpath %.v $(SRC_DIR)
8b2121e3 14
9e6165b5
MR
15ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
16BUILD_ROOT_REL = .
17else
18BUILD_ROOT_REL = ..
19endif
20
63611f31
MR
21ifndef V
22Q = @
23ECHO = printf "$(1)\t%s\n" $(2)
de5aba8c
MR
24BRIEF = CC AS YASM AR LD HOSTCC STRIP CP
25SILENT = DEPCC YASMDEP RM RANLIB
63611f31 26MSG = $@
7732f641 27M = @$(call ECHO,$(TAG),$@);
63611f31 28$(foreach VAR,$(BRIEF), \
bf9aa44b
MR
29 $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
30$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
63611f31
MR
31$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
32endif
33
aac6ca69 34ALLFFLIBS = avcodec avcore avdevice avfilter avformat avutil postproc swscale
5671fc14 35
7f02d357
MR
36IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
37CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
8be0a5c3 38CFLAGS += $(ECFLAGS)
55127e7b 39YASMFLAGS += $(IFLAGS) -Pconfig.asm
8b2121e3 40
7f02d357
MR
41HOSTCFLAGS += $(IFLAGS)
42
8b2121e3 43%.o: %.c
07dec06e 44 $(CCDEP)
bce7b696 45 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
8b2121e3
MR
46
47%.o: %.S
07dec06e 48 $(ASDEP)
bce7b696 49 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
8b2121e3 50
e4d86a57 51%.ho: %.h
bce7b696 52 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 53
bf237413
MR
54%$(EXESUF): %.c
55
a482e61b 56%.ver: %.v
63611f31 57 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
a482e61b 58
7732f641 59%.c %.h: TAG = GEN
93bff1de 60
11d788ca
MR
61# Dummy rule to stop make trying to rebuild removed or renamed headers
62%.h:
63 @:
64
71c61f62 65install: install-libs install-headers
451db983 66install-libs: install-libs-yes
7716f7ff 67
d3cb93b3
RP
68uninstall: uninstall-libs uninstall-headers
69
70.PHONY: all depend dep *clean install* uninstall* examples testprogs
f3a572ca
MR
71
72# Disable suffix rules. Most of the builtin rules are suffix rules,
73# so this saves some time on slow systems.
74.SUFFIXES:
1d536203
MR
75
76# Do not delete intermediate files from chains of implicit rules
0680c40a 77$(OBJS):
71c61f62 78endif
8b2121e3 79
c5662879
DB
80OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
81
8be0a5c3 82CFLAGS += $(CFLAGS-yes)
6ccf540f
DB
83OBJS += $(OBJS-yes)
84FFLIBS := $(FFLIBS-yes) $(FFLIBS)
85TESTPROGS += $(TESTPROGS-yes)
8b2121e3 86
71c61f62 87FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 88FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 89
43a0cb7c 90EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
7acc0104 91OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
2a5500b1 92TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS))
7304c2c4 93TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
de4070b5
MR
94HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
95HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
8b2121e3 96
bea81a52 97DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 98
7b5e8a27 99ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
f89c1402 100SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
9b55e2e7 101SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
95f2c769 102checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 103
de4070b5
MR
104$(HOSTOBJS): %.o: %.c
105 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
106
107$(HOSTPROGS): %$(HOSTEXESUF): %.o
108 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
109
a482e61b 110CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
79de9c83 111DISTCLEANSUFFIXES = *.pc
8e8a67fa 112LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 113
6fa5a91b 114-include $(wildcard $(OBJS:.o=.d))