Move libm replacements to new header libm.h
[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)
24BRIEF = CC AS YASM AR LD HOSTCC RANLIB STRIP CP
a0ac9501 25SILENT = DEPCC YASMDEP RM
63611f31
MR
26MSG = $@
27$(foreach VAR,$(BRIEF), \
28 $(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
29$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
30$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
31endif
32
5671fc14
MR
33ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
34
72c2bdeb 35CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
8be0a5c3 36CFLAGS += $(ECFLAGS)
8b2121e3
MR
37
38%.o: %.c
07dec06e 39 $(CCDEP)
bce7b696 40 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
8b2121e3
MR
41
42%.o: %.S
07dec06e 43 $(ASDEP)
bce7b696 44 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
8b2121e3 45
e4d86a57 46%.ho: %.h
bce7b696 47 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 48
bf237413
MR
49%$(EXESUF): %.c
50
a482e61b 51%.ver: %.v
63611f31 52 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
a482e61b 53
9e6165b5
MR
54SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
55ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
56$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
57endif
58
873b0923 59$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
1db2c5c9 60 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
9e6165b5 61
71c61f62 62install: install-libs install-headers
451db983 63install-libs: install-libs-yes
7716f7ff 64
d3cb93b3
RP
65uninstall: uninstall-libs uninstall-headers
66
67.PHONY: all depend dep *clean install* uninstall* examples testprogs
f3a572ca
MR
68
69# Disable suffix rules. Most of the builtin rules are suffix rules,
70# so this saves some time on slow systems.
71.SUFFIXES:
1d536203
MR
72
73# Do not delete intermediate files from chains of implicit rules
74.SECONDARY:
71c61f62 75endif
8b2121e3 76
c5662879
DB
77OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
78
8be0a5c3 79CFLAGS += $(CFLAGS-yes)
6ccf540f
DB
80OBJS += $(OBJS-yes)
81FFLIBS := $(FFLIBS-yes) $(FFLIBS)
82TESTPROGS += $(TESTPROGS-yes)
8b2121e3 83
71c61f62 84FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 85FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 86
43a0cb7c 87EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
7acc0104 88OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
2a5500b1 89TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS))
7304c2c4 90TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
de4070b5
MR
91HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
92HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
8b2121e3 93
bea81a52 94DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 95
7b5e8a27 96ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
f89c1402 97SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
9b55e2e7 98SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
95f2c769 99checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 100
de4070b5
MR
101$(HOSTOBJS): %.o: %.c
102 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
103
104$(HOSTPROGS): %$(HOSTEXESUF): %.o
105 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
106
caec74dd
MR
107DEPS := $(OBJS:.o=.d)
108depend dep: $(DEPS)
8b2121e3 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
c1c3933a 114-include $(wildcard $(DEPS))