Fixes
[mplayer/glamo.git] / common.mak
blob7ef4693b127b49e222f128f22108adeb4d1ea2c4
2 # common bits used by all libraries
5 SRC_DIR = $(SRC_PATH)/lib$(NAME)
6 VPATH = $(SRC_DIR)
8 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
9 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
10 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
11 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
13 EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
15 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
17 $(LIB): $(STATIC_OBJS)
18 rm -f $@
19 $(AR) rc $@ $^ $(EXTRAOBJS)
20 $(RANLIB) $@
22 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
23 ln -sf $^ $@
25 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
26 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
27 $(SLIB_EXTRA_CMD)
29 %.o: %.c
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
32 %.o: %.S
33 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
35 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
36 %.o: %.cpp
37 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
39 %: %.o $(LIB)
40 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
42 depend dep: $(SRCS)
43 $(CC) -MM $(CFLAGS) $^ 1>.depend
45 clean::
46 rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
47 *.lib *.def *.dll.a *.exp
49 distclean: clean
50 rm -f .depend
52 ifeq ($(BUILD_SHARED),yes)
53 INSTLIBTARGETS += install-lib-shared
54 endif
55 ifeq ($(BUILD_STATIC),yes)
56 INSTLIBTARGETS += install-lib-static
57 endif
59 install: install-libs install-headers
61 install-libs: $(INSTLIBTARGETS)
63 install-lib-shared: $(SLIBNAME)
64 install -d "$(shlibdir)"
65 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
66 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
67 cd "$(shlibdir)" && \
68 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
69 cd "$(shlibdir)" && \
70 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
72 install-lib-static: $(LIB)
73 install -d "$(libdir)"
74 install -m 644 $(LIB) "$(libdir)"
75 $(LIB_INSTALL_EXTRA_CMD)
77 install-headers:
78 install -d "$(incdir)"
79 install -d "$(libdir)/pkgconfig"
80 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
81 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
83 uninstall: uninstall-libs uninstall-headers
85 uninstall-libs:
86 -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
87 "$(shlibdir)/$(SLIBNAME)" \
88 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
89 -rm -f "$(libdir)/$(LIB)"
91 uninstall-headers:
92 rm -f "$(addprefix $(incdir)/,$(HEADERS))"
93 rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
95 .PHONY: all depend dep clean distclean install* uninstall*
98 # include dependency files if they exist
100 ifneq ($(wildcard .depend),)
101 include .depend
102 endif