non-recursive makefiles
[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
22ifeq ($(BUILD_SHARED),yes)
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
30$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
31 $(SLIB_CREATE_DEF_CMD)
32 $(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) $(EXTRAOBJS)
33 $(SLIB_EXTRA_CMD)
34
35ifneq ($(SUBDIR),)
36$(SUBDIR)$(SLIBNAME_WITH_MAJOR): \
37 $(foreach L,$(FFLIBS),lib$(L)/$(SLIBPREF)$(L)$(SLIBSUF))
38endif
39endif
40
41install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
42 install -d "$(SHLIBDIR)"
43 install -m 755 $(SUBDIR)$(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
44 $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
45 cd "$(SHLIBDIR)" && \
46 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
47 cd "$(SHLIBDIR)" && \
48 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
49 $(SLIB_INSTALL_EXTRA_CMD)
50
51install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
52 install -d "$(LIBDIR)"
53 install -m 644 $(SUBDIR)$(LIBNAME) "$(LIBDIR)"
54 $(LIB_INSTALL_EXTRA_CMD)
55
56install-headers::
57 install -d "$(INCINSTDIR)"
58 install -d "$(LIBDIR)/pkgconfig"
59 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
60 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
61
62uninstall-libs::
63 -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
64 "$(SHLIBDIR)/$(SLIBNAME)" \
65 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
66 -$(SLIB_UNINSTALL_EXTRA_CMD)
67 -rm -f "$(LIBDIR)/$(LIBNAME)"
68
69uninstall-headers::
70 rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
71 rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
72 -rmdir "$(INCDIR)"
73endef
74
75$(eval $(RULES))