Add a @todo with a comment from Kostya so we don't forget to optimize that at
[libav.git] / subdir.mak
CommitLineData
71c61f62
MR
1SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
2
3include $(SUBDIR)../common.mak
4
5LIBVERSION := $(lib$(NAME)_VERSION)
6LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
7
8ifeq ($(BUILD_STATIC),yes)
9all: $(SUBDIR)$(LIBNAME)
10
11install-libs: install-lib$(NAME)-static
12
13$(SUBDIR)$(LIBNAME): $(OBJS)
14 rm -f $@
15 $(AR) rc $@ $^ $(EXTRAOBJS)
16 $(RANLIB) $@
17endif
18
19INCINSTDIR := $(INCDIR)/lib$(NAME)
20
21define RULES
8e255b8b 22ifdef BUILD_SHARED
71c61f62
MR
23all: $(SUBDIR)$(SLIBNAME)
24
25install-libs: install-lib$(NAME)-shared
26
27$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
28 cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
29
0147b92e 30$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
71c61f62 31 $(SLIB_CREATE_DEF_CMD)
93c021a2 32 $(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter-out $(DEP_LIBS),$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
71c61f62
MR
33 $(SLIB_EXTRA_CMD)
34
8e255b8b 35ifdef SUBDIR
76ca42a8 36$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
71c61f62
MR
37endif
38endif
39
40install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
41 install -d "$(SHLIBDIR)"
42 install -m 755 $(SUBDIR)$(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
43 $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
44 cd "$(SHLIBDIR)" && \
45 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
46 cd "$(SHLIBDIR)" && \
47 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
48 $(SLIB_INSTALL_EXTRA_CMD)
49
50install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
51 install -d "$(LIBDIR)"
52 install -m 644 $(SUBDIR)$(LIBNAME) "$(LIBDIR)"
53 $(LIB_INSTALL_EXTRA_CMD)
54
55install-headers::
56 install -d "$(INCINSTDIR)"
57 install -d "$(LIBDIR)/pkgconfig"
58 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
25cd5cb3 59 install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
71c61f62
MR
60
61uninstall-libs::
62 -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
63 "$(SHLIBDIR)/$(SLIBNAME)" \
64 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
65 -$(SLIB_UNINSTALL_EXTRA_CMD)
66 -rm -f "$(LIBDIR)/$(LIBNAME)"
67
68uninstall-headers::
69 rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
70 rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
71 -rmdir "$(INCDIR)"
72endef
73
74$(eval $(RULES))