2 # common bits used by all libraries
5 SRC_DIR = $(SRC_PATH)/lib$(NAME)
8 #FIXME: This should be in configure/config.mak
9 ifeq ($(CONFIG_WIN32),yes)
10 LDFLAGS = -Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
13 ifeq ($(TARGET_GPROF),yes)
18 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
19 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
20 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
21 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
23 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
25 $(LIB): $(STATIC_OBJS)
27 $(AR) rc $@ $^ $(EXTRAOBJS)
30 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
33 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
34 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
35 ifeq ($(CONFIG_WIN32),yes)
36 -lib /machine:i386 /def:$(@:.dll=.def)
40 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
43 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
45 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
47 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
50 $(CC) -MM $(CFLAGS) $^ 1>.depend
55 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
56 *.lib *.def *.dll.a *.exp
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 "$(libdir)"
74 ifeq ($(CONFIG_WIN32),yes)
75 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
77 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
78 $(libdir)/$(SLIBNAME_WITH_VERSION)
79 ln -sf $(SLIBNAME_WITH_VERSION) \
80 $(libdir)/$(SLIBNAME_WITH_MAJOR)
81 ln -sf $(SLIBNAME_WITH_VERSION) \
85 install-lib-static: $(LIB)
86 install -d "$(libdir)"
87 install -m 644 $(LIB) "$(libdir)"
90 install -d "$(incdir)"
91 install -d "$(libdir)/pkgconfig"
92 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
93 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
95 uninstall: uninstall-libs uninstall-headers
98 ifeq ($(CONFIG_WIN32),yes)
99 -rm -f $(prefix)/$(SLIBNAME)
101 -rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
102 $(libdir)/$(SLIBNAME) \
103 $(libdir)/$(SLIBNAME_WITH_VERSION)
105 -rm -f $(libdir)/$(LIB)
108 rm -f $(addprefix $(incdir)/,$(HEADERS))
109 rm -f $(libdir)/pkgconfig/lib$(NAME).pc
112 # include dependency files if they exist
114 ifneq ($(wildcard .depend),)