sample size is 1 if bits per sample is 8 and mono channel
[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
06aa32ff 13all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
8b2121e3
MR
14
15$(LIB): $(STATIC_OBJS)
16 rm -f $@
17 $(AR) rc $@ $^ $(EXTRAOBJS)
18 $(RANLIB) $@
19
baa3a937
MR
20$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
21 ln -sf $^ $@
22
23$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
8b2121e3 24 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
2f30a81d 25ifeq ($(CONFIG_MINGW),yes)
8b2121e3
MR
26 -lib /machine:i386 /def:$(@:.dll=.def)
27endif
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
39depend: $(SRCS)
40 $(CC) -MM $(CFLAGS) $^ 1>.depend
41
42dep: depend
43
44clean::
b8635ec6 45 rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
8b2121e3
MR
46 *.lib *.def *.dll.a *.exp
47
48distclean: clean
49 rm -f .depend
50
51ifeq ($(BUILD_SHARED),yes)
52INSTLIBTARGETS += install-lib-shared
53endif
54ifeq ($(BUILD_STATIC),yes)
55INSTLIBTARGETS += install-lib-static
56endif
57
58install: install-libs install-headers
59
60install-libs: $(INSTLIBTARGETS)
61
62install-lib-shared: $(SLIBNAME)
b8e10478 63 install -d "$(shlibdir)"
2f30a81d 64ifeq ($(CONFIG_MINGW),yes)
8b2121e3
MR
65 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
66else
67 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
84c22efd 68 $(shlibdir)/$(SLIBNAME_WITH_VERSION)
8b2121e3 69 ln -sf $(SLIBNAME_WITH_VERSION) \
eb9ab583 70 $(shlibdir)/$(SLIBNAME_WITH_MAJOR)
8b2121e3 71 ln -sf $(SLIBNAME_WITH_VERSION) \
eb9ab583 72 $(shlibdir)/$(SLIBNAME)
8b2121e3
MR
73endif
74
75install-lib-static: $(LIB)
c7bb67c4 76 install -d "$(libdir)"
8b2121e3
MR
77 install -m 644 $(LIB) "$(libdir)"
78
79install-headers:
c7bb67c4
MR
80 install -d "$(incdir)"
81 install -d "$(libdir)/pkgconfig"
8b2121e3
MR
82 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
83 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
84
f9edb717
DB
85uninstall: uninstall-libs uninstall-headers
86
87uninstall-libs:
2f30a81d 88ifeq ($(CONFIG_MINGW),yes)
f9edb717
DB
89 -rm -f $(prefix)/$(SLIBNAME)
90else
91 -rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
eb9ab583
DB
92 $(libdir)/$(SLIBNAME) \
93 $(libdir)/$(SLIBNAME_WITH_VERSION)
f9edb717
DB
94endif
95 -rm -f $(libdir)/$(LIB)
96
97uninstall-headers:
98 rm -f $(addprefix $(incdir)/,$(HEADERS))
99 rm -f $(libdir)/pkgconfig/lib$(NAME).pc
100
8b2121e3
MR
101#
102# include dependency files if they exist
103#
104ifneq ($(wildcard .depend),)
105include .depend
106endif