2 # common bits used by all libraries
5 VPATH = $(SRC_PATH_BARE)/lib$(NAME)
8 CFLAGS += $(CFLAGS-yes)
10 ASM_OBJS += $(ASM_OBJS-yes)
11 CPP_OBJS += $(CPP_OBJS-yes)
13 CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
14 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
15 -I$(SRC_PATH)/libavutil $(OPTFLAGS)
17 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
18 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
19 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
20 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
22 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
24 $(LIB): $(STATIC_OBJS)
26 $(AR) rc $@ $^ $(EXTRAOBJS)
29 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
32 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
33 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
37 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
40 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
43 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
46 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
48 ALLHEADERS = $(subst $(VPATH)/,,$(wildcard $(VPATH)/*.h))
49 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
52 $(CC) -MM $(CFLAGS) $^ 1>.depend
55 rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
56 *.def *.dll.a *.exp *.ho
61 ifeq ($(BUILD_SHARED),yes)
62 INSTLIBTARGETS += install-lib-shared
64 ifeq ($(BUILD_STATIC),yes)
65 INSTLIBTARGETS += install-lib-static
68 install: install-libs install-headers
70 install-libs: $(INSTLIBTARGETS)
72 install-lib-shared: $(SLIBNAME)
73 install -d "$(shlibdir)"
74 install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
75 $(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
77 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
79 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
80 $(SLIB_INSTALL_EXTRA_CMD)
82 install-lib-static: $(LIB)
83 install -d "$(libdir)"
84 install -m 644 $(LIB) "$(libdir)"
85 $(LIB_INSTALL_EXTRA_CMD)
88 install -d "$(incdir)"
89 install -d "$(libdir)/pkgconfig"
90 install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
91 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
93 uninstall: uninstall-libs uninstall-headers
96 -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
97 "$(shlibdir)/$(SLIBNAME)" \
98 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
99 -rm -f "$(libdir)/$(LIB)"
102 rm -f $(addprefix "$(incdir)/",$(HEADERS))
103 rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
105 .PHONY: all depend dep clean distclean install* uninstall*