floorf() is not used, and causes warnings on Solaris
[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
8#FIXME: This should be in configure/config.mak
9ifeq ($(CONFIG_WIN32),yes)
10LDFLAGS = -Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
11endif
12
13ifeq ($(TARGET_GPROF),yes)
14CFLAGS+=-p
15LDFLAGS+=-p
16endif
17
2afc0c12 18#FIXME: This should be in configure/config.mak
8b2121e3
MR
19ifeq ($(TARGET_ARCH_SPARC64),yes)
20CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
21endif
22
1540cfdc 23SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
8b2121e3
MR
24OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
25STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
26SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
27
06aa32ff 28all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
8b2121e3
MR
29
30$(LIB): $(STATIC_OBJS)
31 rm -f $@
32 $(AR) rc $@ $^ $(EXTRAOBJS)
33 $(RANLIB) $@
34
baa3a937
MR
35$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
36 ln -sf $^ $@
37
38$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
8b2121e3
MR
39 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
40ifeq ($(CONFIG_WIN32),yes)
41 -lib /machine:i386 /def:$(@:.dll=.def)
42endif
43
44%.o: %.c
45 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
46
47%.o: %.S
48 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
49
50# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
51%.o: %.cpp
52 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
53
54depend: $(SRCS)
55 $(CC) -MM $(CFLAGS) $^ 1>.depend
56
57dep: depend
58
59clean::
60 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
61 *.lib *.def *.dll.a *.exp
62
63distclean: clean
64 rm -f .depend
65
66ifeq ($(BUILD_SHARED),yes)
67INSTLIBTARGETS += install-lib-shared
68endif
69ifeq ($(BUILD_STATIC),yes)
70INSTLIBTARGETS += install-lib-static
71endif
72
73install: install-libs install-headers
74
75install-libs: $(INSTLIBTARGETS)
76
77install-lib-shared: $(SLIBNAME)
c7bb67c4 78 install -d "$(libdir)"
8b2121e3
MR
79ifeq ($(CONFIG_WIN32),yes)
80 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
81else
82 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
83 $(libdir)/$(SLIBNAME_WITH_VERSION)
84 ln -sf $(SLIBNAME_WITH_VERSION) \
85 $(libdir)/$(SLIBNAME_WITH_MAJOR)
86 ln -sf $(SLIBNAME_WITH_VERSION) \
87 $(libdir)/$(SLIBNAME)
88endif
89
90install-lib-static: $(LIB)
c7bb67c4 91 install -d "$(libdir)"
8b2121e3
MR
92 install -m 644 $(LIB) "$(libdir)"
93
94install-headers:
c7bb67c4
MR
95 install -d "$(incdir)"
96 install -d "$(libdir)/pkgconfig"
8b2121e3
MR
97 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
98 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
99
f9edb717
DB
100uninstall: uninstall-libs uninstall-headers
101
102uninstall-libs:
103ifeq ($(CONFIG_WIN32),yes)
104 -rm -f $(prefix)/$(SLIBNAME)
105else
106 -rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
107 $(libdir)/$(SLIBNAME) \
108 $(libdir)/$(SLIBNAME_WITH_VERSION)
109endif
110 -rm -f $(libdir)/$(LIB)
111
112uninstall-headers:
113 rm -f $(addprefix $(incdir)/,$(HEADERS))
114 rm -f $(libdir)/pkgconfig/lib$(NAME).pc
115
8b2121e3
MR
116#
117# include dependency files if they exist
118#
119ifneq ($(wildcard .depend),)
120include .depend
121endif