Add Haivision SRT protocol
[libav.git] / avbuild / library.mak
CommitLineData
11a9320d 1include $(SRC_PATH)/avbuild/common.mak
71c61f62 2
f960fd2f 3ifeq (,$(filter %clean config,$(MAKECMDGOALS)))
edb43487 4-include $(SUBDIR)lib$(NAME).version
4d1f7e8b 5endif
edb43487 6
71c61f62
MR
7LIBVERSION := $(lib$(NAME)_VERSION)
8LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
304b806c 9LIBMINOR := $(lib$(NAME)_VERSION_MINOR)
477b3382 10INCINSTDIR := $(INCDIR)/lib$(NAME)
71c61f62 11
b3fab1f2
JG
12INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
13
92db5083
DB
14all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(NAME).pc
15all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(NAME).pc
451db983 16
c2626492
MR
17LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
18$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
72c2bdeb 19
71c61f62 20$(SUBDIR)$(LIBNAME): $(OBJS)
50e10cbd 21 $(RM) $@
4436f25a 22 $(AR) $(ARFLAGS) $(AR_O) $^
71c61f62 23 $(RANLIB) $@
71c61f62 24
56540673
MR
25install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
26
451db983
MR
27install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
28install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
29
71c61f62 30define RULES
14bba44f 31$(TOOLS): THISLIB = $(NAME:%=$(LD_LIB))
b339182e 32$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
4b895cb2 33
abf1c058
MS
34$(LIBOBJS): CPPFLAGS += -DBUILDING_$(NAME)
35
3794062a 36$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
7cb1d9e2 37 $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS)
3fd422ff 38
edb43487
DB
39$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
40 $$(M) $$(SRC_PATH)/avbuild/libversion.sh $(NAME) $$< > $$@
41
17b6c7ef 42$(SUBDIR)lib$(NAME).pc: $(SUBDIR)version.h avbuild/config.sh | $(SUBDIR)
92db5083
DB
43 $$(M) $$(SRC_PATH)/avbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
44
c5fd4b50
DB
45$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
46 $$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
47
71c61f62 48$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
63611f31 49 $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
71c61f62 50
729f953f 51$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
71c61f62 52 $(SLIB_CREATE_DEF_CMD)
857e26b6 53 $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
71c61f62
MR
54 $(SLIB_EXTRA_CMD)
55
0c8cc2c4 56clean::
a6a750c7
DB
57 $(RM) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
58 $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(CLEANSUFFIXES:%=$(SUBDIR)tests/%)
0c8cc2c4 59
71c61f62 60install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
63611f31 61 $(Q)mkdir -p "$(SHLIBDIR)"
2f138f0b
MR
62 $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
63 $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
64 $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
65 $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
66 $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
63611f31 67
71c61f62 68install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
63611f31 69 $(Q)mkdir -p "$(LIBDIR)"
fd676deb 70 $$(INSTALL) -m 644 $$< "$(LIBDIR)"
6cfac0e9 71 $(LIB_INSTALL_EXTRA_CMD)
71c61f62 72
34512bca 73install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
63611f31 74 $(Q)mkdir -p "$(INCINSTDIR)"
34512bca
MR
75 $$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
76
77install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
63611f31 78 $(Q)mkdir -p "$(LIBDIR)/pkgconfig"
34512bca 79 $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
d3cb93b3
RP
80
81uninstall-libs::
50e10cbd 82 -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
d3cb93b3
RP
83 "$(SHLIBDIR)/$(SLIBNAME)" \
84 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
2f138f0b
MR
85 -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
86 -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
50e10cbd 87 -$(RM) "$(LIBDIR)/$(LIBNAME)"
d3cb93b3
RP
88
89uninstall-headers::
a2b4d1df 90 $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
a2b4d1df 91 -rmdir "$(INCINSTDIR)"
fbf77b5a
DB
92
93uninstall-pkgconfig::
94 $(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
71c61f62
MR
95endef
96
97$(eval $(RULES))
3fd422ff 98
b339182e
DB
99$(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
100$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
bbba084b 101
3fd422ff 102testprogs: $(TESTPROGS)