configure: use nm -P on Solaris
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
71c61f62 5all: # make "all" default target
0e32c8c6 6
8e255b8b 7ifndef SUBDIR
6ccf540f
DB
8vpath %.c $(SRC_DIR)
9vpath %.h $(SRC_DIR)
10vpath %.S $(SRC_DIR)
304d586d 11vpath %.asm $(SRC_DIR)
a482e61b 12vpath %.v $(SRC_DIR)
8b2121e3 13
9e6165b5
MR
14ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
15BUILD_ROOT_REL = .
16else
17BUILD_ROOT_REL = ..
18endif
19
5671fc14
MR
20ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
21
04a803be 22CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
8b2121e3
MR
23
24%.o: %.c
07dec06e 25 $(CCDEP)
bce7b696 26 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
8b2121e3
MR
27
28%.o: %.S
07dec06e 29 $(ASDEP)
bce7b696 30 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
8b2121e3 31
e4d86a57 32%.ho: %.h
bce7b696 33 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
e4d86a57 34
bf237413
MR
35%$(EXESUF): %.c
36
a482e61b
MR
37%.ver: %.v
38 sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
39
9e6165b5
MR
40SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
41ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
42$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
43endif
44
873b0923 45$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
1db2c5c9 46 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
9e6165b5 47
71c61f62 48install: install-libs install-headers
7716f7ff 49
93fe7eb6 50.PHONY: all depend dep *clean install* uninstall examples testprogs
71c61f62 51endif
8b2121e3 52
c5662879
DB
53OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
54
6ccf540f
DB
55CFLAGS += $(CFLAGS-yes)
56OBJS += $(OBJS-yes)
57FFLIBS := $(FFLIBS-yes) $(FFLIBS)
58TESTPROGS += $(TESTPROGS-yes)
8b2121e3 59
71c61f62 60FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
bdc2cc16 61FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
8b2121e3 62
43a0cb7c 63EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
6ccf540f 64OBJS := $(addprefix $(SUBDIR),$(OBJS))
7304c2c4 65TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
de4070b5
MR
66HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
67HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
8b2121e3 68
bea81a52 69DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
76ca42a8 70
7b5e8a27 71ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
95f2c769
MR
72SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
73checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
8b2121e3 74
de4070b5
MR
75$(HOSTOBJS): %.o: %.c
76 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
77
78$(HOSTPROGS): %$(HOSTEXESUF): %.o
79 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
80
caec74dd
MR
81DEPS := $(OBJS:.o=.d)
82depend dep: $(DEPS)
8b2121e3 83
a482e61b 84CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
79de9c83 85DISTCLEANSUFFIXES = *.pc
8e8a67fa 86LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76a448ed 87
c1c3933a 88-include $(wildcard $(DEPS))