Commit | Line | Data |
---|---|---|
8b2121e3 MR |
1 | # |
2 | # common bits used by all libraries | |
3 | # | |
4 | ||
42225a30 | 5 | SRC_DIR = $(SRC_PATH)/lib$(NAME) |
8b2121e3 MR |
6 | VPATH = $(SRC_DIR) |
7 | ||
1540cfdc | 8 | SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp) |
8b2121e3 MR |
9 | OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS) |
10 | STATIC_OBJS := $(OBJS) $(STATIC_OBJS) | |
11 | SHARED_OBJS := $(OBJS) $(SHARED_OBJS) | |
12 | ||
3aba4289 | 13 | EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS) |
0533322e | 14 | |
06aa32ff | 15 | all: $(EXTRADEPS) $(LIB) $(SLIBNAME) |
8b2121e3 MR |
16 | |
17 | $(LIB): $(STATIC_OBJS) | |
18 | rm -f $@ | |
19 | $(AR) rc $@ $^ $(EXTRAOBJS) | |
20 | $(RANLIB) $@ | |
21 | ||
baa3a937 MR |
22 | $(SLIBNAME): $(SLIBNAME_WITH_MAJOR) |
23 | ln -sf $^ $@ | |
24 | ||
25 | $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS) | |
8b2121e3 | 26 | $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS) |
5cb854e1 | 27 | $(SLIB_EXTRA_CMD) |
8b2121e3 MR |
28 | |
29 | %.o: %.c | |
30 | $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< | |
31 | ||
32 | %.o: %.S | |
33 | $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< | |
34 | ||
35 | # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings | |
36 | %.o: %.cpp | |
37 | g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< | |
38 | ||
c6c46511 DB |
39 | %: %.o $(LIB) |
40 | $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) | |
41 | ||
9d0199f4 | 42 | depend dep: $(SRCS) |
8b2121e3 MR |
43 | $(CC) -MM $(CFLAGS) $^ 1>.depend |
44 | ||
8b2121e3 | 45 | clean:: |
b8635ec6 | 46 | rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \ |
8b2121e3 MR |
47 | *.lib *.def *.dll.a *.exp |
48 | ||
49 | distclean: clean | |
50 | rm -f .depend | |
51 | ||
52 | ifeq ($(BUILD_SHARED),yes) | |
53 | INSTLIBTARGETS += install-lib-shared | |
54 | endif | |
55 | ifeq ($(BUILD_STATIC),yes) | |
56 | INSTLIBTARGETS += install-lib-static | |
57 | endif | |
58 | ||
59 | install: install-libs install-headers | |
60 | ||
61 | install-libs: $(INSTLIBTARGETS) | |
62 | ||
63 | install-lib-shared: $(SLIBNAME) | |
b8e10478 | 64 | install -d "$(shlibdir)" |
8b2121e3 | 65 | install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \ |
afa61532 | 66 | "$(shlibdir)/$(SLIBNAME_WITH_VERSION)" |
e35a3b7d DB |
67 | cd "$(shlibdir)" && \ |
68 | ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR) | |
69 | cd "$(shlibdir)" && \ | |
70 | ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME) | |
8b2121e3 MR |
71 | |
72 | install-lib-static: $(LIB) | |
c7bb67c4 | 73 | install -d "$(libdir)" |
8b2121e3 | 74 | install -m 644 $(LIB) "$(libdir)" |
d7e27559 | 75 | $(LIB_INSTALL_EXTRA_CMD) |
8b2121e3 MR |
76 | |
77 | install-headers: | |
c7bb67c4 MR |
78 | install -d "$(incdir)" |
79 | install -d "$(libdir)/pkgconfig" | |
8b2121e3 MR |
80 | install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)" |
81 | install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig" | |
82 | ||
f9edb717 DB |
83 | uninstall: uninstall-libs uninstall-headers |
84 | ||
85 | uninstall-libs: | |
afa61532 DB |
86 | -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \ |
87 | "$(shlibdir)/$(SLIBNAME)" \ | |
88 | "$(shlibdir)/$(SLIBNAME_WITH_VERSION)" | |
afa61532 | 89 | -rm -f "$(libdir)/$(LIB)" |
f9edb717 DB |
90 | |
91 | uninstall-headers: | |
afa61532 DB |
92 | rm -f "$(addprefix $(incdir)/,$(HEADERS))" |
93 | rm -f "$(libdir)/pkgconfig/lib$(NAME).pc" | |
f9edb717 | 94 | |
3263626f DB |
95 | .PHONY: all depend dep clean distclean install* uninstall* |
96 | ||
8b2121e3 MR |
97 | # |
98 | # include dependency files if they exist | |
99 | # | |
100 | ifneq ($(wildcard .depend),) | |
101 | include .depend | |
102 | endif |