Stop make complaining about moved/deleted headers
[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
5671fc14
MR
34ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
35
7f02d357
MR
36IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
37CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
8be0a5c3 38CFLAGS += $(ECFLAGS)
8b2121e3 39
7f02d357
MR
40HOSTCFLAGS += $(IFLAGS)
41
8b2121e3 42%.o: %.c
07dec06e 43 $(CCDEP)
bce7b696 44 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
8b2121e3
MR
45
46%.o: %.S
07dec06e 47 $(ASDEP)
bce7b696 48 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
8b2121e3 49
e4d86a57 50%.ho: %.h
bce7b696 51 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 52
bf237413
MR
53%$(EXESUF): %.c
54
a482e61b 55%.ver: %.v
63611f31 56 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
a482e61b 57
7732f641 58%.c %.h: TAG = GEN
93bff1de 59
11d788ca
MR
60# Dummy rule to stop make trying to rebuild removed or renamed headers
61%.h:
62 @:
63
71c61f62 64install: install-libs install-headers
451db983 65install-libs: install-libs-yes
7716f7ff 66
d3cb93b3
RP
67uninstall: uninstall-libs uninstall-headers
68
69.PHONY: all depend dep *clean install* uninstall* examples testprogs
f3a572ca
MR
70
71# Disable suffix rules. Most of the builtin rules are suffix rules,
72# so this saves some time on slow systems.
73.SUFFIXES:
1d536203
MR
74
75# Do not delete intermediate files from chains of implicit rules
0680c40a 76$(OBJS):
71c61f62 77endif
8b2121e3 78
c5662879
DB
79OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
80
8be0a5c3 81CFLAGS += $(CFLAGS-yes)
6ccf540f
DB
82OBJS += $(OBJS-yes)
83FFLIBS := $(FFLIBS-yes) $(FFLIBS)
84TESTPROGS += $(TESTPROGS-yes)
8b2121e3 85
71c61f62 86FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 87FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 88
43a0cb7c 89EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
7acc0104 90OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
2a5500b1 91TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS))
7304c2c4 92TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
de4070b5
MR
93HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
94HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
8b2121e3 95
bea81a52 96DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 97
7b5e8a27 98ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
f89c1402 99SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
9b55e2e7 100SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
95f2c769 101checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 102
de4070b5
MR
103$(HOSTOBJS): %.o: %.c
104 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
105
106$(HOSTPROGS): %$(HOSTEXESUF): %.o
107 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
108
caec74dd
MR
109DEPS := $(OBJS:.o=.d)
110depend dep: $(DEPS)
8b2121e3 111
a482e61b 112CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
79de9c83 113DISTCLEANSUFFIXES = *.pc
8e8a67fa 114LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 115
c1c3933a 116-include $(wildcard $(DEPS))