natsuki.mplayerhq.hu -> rsync.mplayerhq.hu
[mplayer/glamo.git] / common.mak
blob24ccaedb8236eb4ee113316de0353d9c84cd3628
2 # common bits used by all libraries
5 SRC_DIR = $(SRC_PATH)/$(SUBDIR)
6 VPATH = $(SRC_DIR)
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)
11 endif
13 ifeq ($(TARGET_GPROF),yes)
14 CFLAGS+=-p
15 LDFLAGS+=-p
16 endif
18 ifeq ($(TARGET_ARCH_SPARC64),yes)
19 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
20 endif
22 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
23 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
24 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
25 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
27 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
29 $(LIB): $(STATIC_OBJS)
30 rm -f $@
31 $(AR) rc $@ $^ $(EXTRAOBJS)
32 $(RANLIB) $@
34 $(SLIBNAME): $(SHARED_OBJS)
35 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
36 ifeq ($(CONFIG_WIN32),yes)
37 -lib /machine:i386 /def:$(@:.dll=.def)
38 endif
40 %.o: %.c
41 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
43 %.o: %.S
44 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
46 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
47 %.o: %.cpp
48 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
50 depend: $(SRCS)
51 $(CC) -MM $(CFLAGS) $^ 1>.depend
53 dep: depend
55 clean::
56 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
57 *.lib *.def *.dll.a *.exp
59 distclean: clean
60 rm -f .depend
62 ifeq ($(BUILD_SHARED),yes)
63 INSTLIBTARGETS += install-lib-shared
64 endif
65 ifeq ($(BUILD_STATIC),yes)
66 INSTLIBTARGETS += install-lib-static
67 endif
69 install: install-libs install-headers
71 install-libs: $(INSTLIBTARGETS)
73 install-lib-shared: $(SLIBNAME)
74 install -d "$(libdir)"
75 ifeq ($(CONFIG_WIN32),yes)
76 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
77 else
78 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
79 $(libdir)/$(SLIBNAME_WITH_VERSION)
80 ln -sf $(SLIBNAME_WITH_VERSION) \
81 $(libdir)/$(SLIBNAME_WITH_MAJOR)
82 ln -sf $(SLIBNAME_WITH_VERSION) \
83 $(libdir)/$(SLIBNAME)
84 endif
86 install-lib-static: $(LIB)
87 install -d "$(libdir)"
88 install -m 644 $(LIB) "$(libdir)"
90 install-headers:
91 install -d "$(incdir)"
92 install -d "$(libdir)/pkgconfig"
93 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
94 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
97 # include dependency files if they exist
99 ifneq ($(wildcard .depend),)
100 include .depend
101 endif