build: Change structure of the linker version script templates
[libav.git] / library.mak
CommitLineData
57b4a3dd 1include $(SRC_PATH)/common.mak
71c61f62
MR
2
3LIBVERSION := $(lib$(NAME)_VERSION)
4LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
304b806c 5LIBMINOR := $(lib$(NAME)_VERSION_MINOR)
477b3382 6INCINSTDIR := $(INCDIR)/lib$(NAME)
71c61f62 7
b3fab1f2
JG
8INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
9
451db983
MR
10all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
11all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
12
8c5239b3 13$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
755834e9 14 $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
8c5239b3 15 $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
0673ede9 16 -$(STRIP) $(STRIPFLAGS) $@
8c5239b3 17
c2626492
MR
18LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
19$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
72c2bdeb 20
71c61f62 21$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 22 $(RM) $@
4436f25a 23 $(AR) $(ARFLAGS) $(AR_O) $^
71c61f62 24 $(RANLIB) $@
71c61f62 25
56540673
MR
26install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
27
451db983
MR
28install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
29install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
30
71c61f62 31define RULES
b339182e
DB
32$(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
33$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
4b895cb2 34
b339182e 35$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
bb0babd7 36 $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
3fd422ff 37
71c61f62 38$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 39 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 40
729f953f 41$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
71c61f62 42 $(SLIB_CREATE_DEF_CMD)
4436f25a 43 $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
71c61f62
MR
44 $(SLIB_EXTRA_CMD)
45
0c8cc2c4 46clean::
a6a750c7
DB
47 $(RM) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
48 $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(CLEANSUFFIXES:%=$(SUBDIR)tests/%)
0c8cc2c4
MR
49
50distclean:: clean
a6a750c7
DB
51 $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) \
52 $(DISTCLEANSUFFIXES:%=$(SUBDIR)tests/%)
0c8cc2c4 53
71c61f62 54install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 55 $(Q)mkdir -p "$(SHLIBDIR)"
2f138f0b
MR
56 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
57 $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
58 $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
59 $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
60 $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
63611f31 61
71c61f62 62install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 63 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 64 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
6cfac0e9 65 $(LIB_INSTALL_EXTRA_CMD)
71c61f62 66
34512bca 67install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 68 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
69 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
70
71install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 72 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 73 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
74
75uninstall-libs::
50e10cbd 76 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
77 "$(SHLIBDIR)/$(SLIBNAME)" \
78 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
2f138f0b
MR
79 -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
80 -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
50e10cbd 81 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
82
83uninstall-headers::
a2b4d1df 84 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
50e10cbd 85 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
a2b4d1df 86 -rmdir "$(INCINSTDIR)"
71c61f62
MR
87endef
88
89$(eval $(RULES))
3fd422ff 90
b339182e
DB
91$(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
92$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
bbba084b 93
3fd422ff 94testprogs: $(TESTPROGS)