cosmetics remove struct name with typedef
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
997baf01
MR
5VPATH = $(SRC_PATH_BARE)/lib$(NAME)
6SRC_DIR = "$(VPATH)"
8b2121e3 7
722dabcc
DB
8CFLAGS += $(CFLAGS-yes)
9OBJS += $(OBJS-yes)
10ASM_OBJS += $(ASM_OBJS-yes)
2d93bcc7 11CPP_OBJS += $(CPP_OBJS-yes)
722dabcc 12
dadb850a
DB
13CFLAGS += -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)
1540cfdc 16SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
8b2121e3
MR
17OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
18STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
19SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
20
06aa32ff 21all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
8b2121e3
MR
22
23$(LIB): $(STATIC_OBJS)
24 rm -f $@
25 $(AR) rc $@ $^ $(EXTRAOBJS)
26 $(RANLIB) $@
27
baa3a937
MR
28$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
29 ln -sf $^ $@
30
31$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
8b2121e3 32 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
5cb854e1 33 $(SLIB_EXTRA_CMD)
8b2121e3
MR
34
35%.o: %.c
36 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
37
38%.o: %.S
39 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
40
c6c46511
DB
41%: %.o $(LIB)
42 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
43
9d0199f4 44depend dep: $(SRCS)
8b2121e3
MR
45 $(CC) -MM $(CFLAGS) $^ 1>.depend
46
8b2121e3 47clean::
b8635ec6 48 rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
009618ea 49 *.def *.dll.a *.exp
8b2121e3
MR
50
51distclean: clean
52 rm -f .depend
53
54ifeq ($(BUILD_SHARED),yes)
55INSTLIBTARGETS += install-lib-shared
56endif
57ifeq ($(BUILD_STATIC),yes)
58INSTLIBTARGETS += install-lib-static
59endif
60
61install: install-libs install-headers
62
63install-libs: $(INSTLIBTARGETS)
64
65install-lib-shared: $(SLIBNAME)
b8e10478 66 install -d "$(shlibdir)"
ca3798dc
RP
67 install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
68 $(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
e35a3b7d
DB
69 cd "$(shlibdir)" && \
70 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
71 cd "$(shlibdir)" && \
72 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
8fbec4f4 73 $(SLIB_INSTALL_EXTRA_CMD)
8b2121e3
MR
74
75install-lib-static: $(LIB)
c7bb67c4 76 install -d "$(libdir)"
8b2121e3 77 install -m 644 $(LIB) "$(libdir)"
d7e27559 78 $(LIB_INSTALL_EXTRA_CMD)
8b2121e3
MR
79
80install-headers:
c7bb67c4
MR
81 install -d "$(incdir)"
82 install -d "$(libdir)/pkgconfig"
997baf01 83 install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
8b2121e3
MR
84 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
85
f9edb717
DB
86uninstall: uninstall-libs uninstall-headers
87
88uninstall-libs:
afa61532
DB
89 -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
90 "$(shlibdir)/$(SLIBNAME)" \
91 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
afa61532 92 -rm -f "$(libdir)/$(LIB)"
f9edb717
DB
93
94uninstall-headers:
76808d6e 95 rm -f $(addprefix "$(incdir)/",$(HEADERS))
afa61532 96 rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
f9edb717 97
3263626f
DB
98.PHONY: all depend dep clean distclean install* uninstall*
99
6ca0c110 100-include .depend