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