support D-10, XDCAM, fix ebu_small_d10_50_audio_resampling_problem.mxf, xdcam-pal...
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
42225a30 5SRC_DIR = $(SRC_PATH)/lib$(NAME)
8b2121e3
MR
6VPATH = $(SRC_DIR)
7
1540cfdc 8SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
8b2121e3
MR
9OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
10STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
11SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
12
3aba4289 13EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
0533322e 14
06aa32ff 15all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
8b2121e3
MR
16
17$(LIB): $(STATIC_OBJS)
18 rm -f $@
19 $(AR) rc $@ $^ $(EXTRAOBJS)
20 $(RANLIB) $@
21
baa3a937
MR
22$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
23 ln -sf $^ $@
24
25$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
8b2121e3 26 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
5cb854e1 27 $(SLIB_EXTRA_CMD)
8b2121e3
MR
28
29%.o: %.c
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
31
32%.o: %.S
33 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
34
35# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
36%.o: %.cpp
37 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
38
9d0199f4 39depend dep: $(SRCS)
8b2121e3
MR
40 $(CC) -MM $(CFLAGS) $^ 1>.depend
41
8b2121e3 42clean::
b8635ec6 43 rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
8b2121e3
MR
44 *.lib *.def *.dll.a *.exp
45
46distclean: clean
47 rm -f .depend
48
49ifeq ($(BUILD_SHARED),yes)
50INSTLIBTARGETS += install-lib-shared
51endif
52ifeq ($(BUILD_STATIC),yes)
53INSTLIBTARGETS += install-lib-static
54endif
55
56install: install-libs install-headers
57
58install-libs: $(INSTLIBTARGETS)
59
60install-lib-shared: $(SLIBNAME)
b8e10478 61 install -d "$(shlibdir)"
8b2121e3 62 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
afa61532 63 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
e35a3b7d
DB
64 cd "$(shlibdir)" && \
65 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
66 cd "$(shlibdir)" && \
67 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
8b2121e3
MR
68
69install-lib-static: $(LIB)
c7bb67c4 70 install -d "$(libdir)"
8b2121e3 71 install -m 644 $(LIB) "$(libdir)"
d7e27559 72 $(LIB_INSTALL_EXTRA_CMD)
8b2121e3
MR
73
74install-headers:
c7bb67c4
MR
75 install -d "$(incdir)"
76 install -d "$(libdir)/pkgconfig"
8b2121e3
MR
77 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
78 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
79
f9edb717
DB
80uninstall: uninstall-libs uninstall-headers
81
82uninstall-libs:
afa61532
DB
83 -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
84 "$(shlibdir)/$(SLIBNAME)" \
85 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
afa61532 86 -rm -f "$(libdir)/$(LIB)"
f9edb717
DB
87
88uninstall-headers:
afa61532
DB
89 rm -f "$(addprefix $(incdir)/,$(HEADERS))"
90 rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
f9edb717 91
3263626f
DB
92.PHONY: all depend dep clean distclean install* uninstall*
93
8b2121e3
MR
94#
95# include dependency files if they exist
96#
97ifneq ($(wildcard .depend),)
98include .depend
99endif