2017-05-03 12:51:48 +02:00
|
|
|
include $(SRC_PATH)/ffbuild/common.mak
|
2008-04-08 00:16:31 +03:00
|
|
|
|
2017-02-28 23:12:00 +02:00
|
|
|
ifeq (,$(filter %clean,$(MAKECMDGOALS)))
|
2016-12-17 21:01:07 +02:00
|
|
|
-include $(SUBDIR)lib$(NAME).version
|
2017-02-28 23:12:00 +02:00
|
|
|
endif
|
2016-12-17 21:01:07 +02:00
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
LIBVERSION := $(lib$(NAME)_VERSION)
|
|
|
|
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
|
2013-02-03 17:03:08 +03:00
|
|
|
LIBMINOR := $(lib$(NAME)_VERSION_MINOR)
|
2010-03-09 16:58:11 +02:00
|
|
|
INCINSTDIR := $(INCDIR)/lib$(NAME)
|
2008-04-08 00:16:31 +03:00
|
|
|
|
2012-10-29 18:26:59 +03:00
|
|
|
INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
|
|
|
|
|
2017-05-05 05:16:06 +02:00
|
|
|
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(FULLNAME).pc
|
|
|
|
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
|
2010-03-09 16:58:18 +02:00
|
|
|
|
2012-10-03 15:48:27 +03:00
|
|
|
LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
|
2012-11-23 15:30:51 +03:00
|
|
|
$(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
|
2010-03-08 00:18:33 +02:00
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
$(SUBDIR)$(LIBNAME): $(OBJS)
|
2010-03-06 16:25:10 +02:00
|
|
|
$(RM) $@
|
2012-10-11 00:36:54 +03:00
|
|
|
$(AR) $(ARFLAGS) $(AR_O) $^
|
2008-04-08 00:16:31 +03:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
2010-03-07 17:46:22 +02:00
|
|
|
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
|
|
|
|
|
2010-03-09 16:58:18 +02:00
|
|
|
install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
|
|
|
|
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
|
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
define RULES
|
2014-02-15 17:50:29 +03:00
|
|
|
$(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
|
|
|
|
$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
|
2012-10-10 05:24:50 +03:00
|
|
|
|
2016-11-29 16:09:35 +02:00
|
|
|
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
|
2014-07-16 18:00:11 +03:00
|
|
|
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
|
2009-04-01 03:53:22 +03:00
|
|
|
|
2016-12-17 21:01:07 +02:00
|
|
|
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
|
2017-05-06 23:50:09 +02:00
|
|
|
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$< > $$@
|
2016-12-17 21:01:07 +02:00
|
|
|
|
2017-05-05 00:59:30 +02:00
|
|
|
$(SUBDIR)lib$(FULLNAME).pc: $(SUBDIR)version.h | $(SUBDIR)
|
|
|
|
$$(M) $$(SRC_PATH)/ffbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
|
2016-12-20 15:27:19 +02:00
|
|
|
|
2016-05-27 11:38:38 +02:00
|
|
|
$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
|
|
|
|
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
|
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
2010-03-06 19:14:19 +02:00
|
|
|
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
2008-04-08 00:16:31 +03:00
|
|
|
|
2013-12-05 23:50:14 +03:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver
|
2008-04-08 00:16:31 +03:00
|
|
|
$(SLIB_CREATE_DEF_CMD)
|
2015-06-27 18:27:59 +02:00
|
|
|
$$(LD) $(SHFLAGS) $(LDFLAGS) $(LDLIBFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
|
2008-04-08 00:16:31 +03:00
|
|
|
$(SLIB_EXTRA_CMD)
|
|
|
|
|
2011-06-26 10:42:42 +03:00
|
|
|
ifdef SUBDIR
|
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
|
|
|
|
endif
|
|
|
|
|
2010-03-09 16:58:29 +02:00
|
|
|
clean::
|
2016-04-20 11:40:40 +02:00
|
|
|
$(RM) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
|
|
|
$(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(CLEANSUFFIXES:%=$(SUBDIR)tests/%)
|
2017-05-05 05:16:06 +02:00
|
|
|
|
2010-03-09 16:58:29 +02:00
|
|
|
distclean:: clean
|
2016-04-20 11:40:40 +02:00
|
|
|
$(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) \
|
|
|
|
$(DISTCLEANSUFFIXES:%=$(SUBDIR)tests/%)
|
2010-03-09 16:58:29 +02:00
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
|
2010-03-06 19:14:19 +02:00
|
|
|
$(Q)mkdir -p "$(SHLIBDIR)"
|
2011-07-07 17:25:30 +03:00
|
|
|
$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
|
2011-07-08 02:05:28 +03:00
|
|
|
$$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
|
2013-02-12 19:23:31 +03:00
|
|
|
$(Q)$(foreach F,$(SLIB_INSTALL_LINKS),(cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F));)
|
2011-07-07 17:25:30 +03:00
|
|
|
$(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
|
|
|
|
$(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
|
|
|
|
$(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
|
2010-03-06 19:14:19 +02:00
|
|
|
|
2008-04-08 00:16:31 +03:00
|
|
|
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
|
2010-03-06 19:14:19 +02:00
|
|
|
$(Q)mkdir -p "$(LIBDIR)"
|
2010-03-06 19:14:13 +02:00
|
|
|
$$(INSTALL) -m 644 $$< "$(LIBDIR)"
|
2010-03-06 19:44:18 +02:00
|
|
|
$(LIB_INSTALL_EXTRA_CMD)
|
2008-04-08 00:16:31 +03:00
|
|
|
|
2010-03-06 19:14:16 +02:00
|
|
|
install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
|
2010-03-06 19:14:19 +02:00
|
|
|
$(Q)mkdir -p "$(INCINSTDIR)"
|
2010-03-06 19:14:16 +02:00
|
|
|
$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
|
|
|
|
|
2013-02-03 05:32:56 +03:00
|
|
|
install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(FULLNAME).pc
|
2015-05-29 16:08:36 +02:00
|
|
|
$(Q)mkdir -p "$(PKGCONFIGDIR)"
|
|
|
|
$$(INSTALL) -m 644 $$^ "$(PKGCONFIGDIR)"
|
2010-01-27 00:23:12 +02:00
|
|
|
|
|
|
|
uninstall-libs::
|
2010-03-06 16:25:10 +02:00
|
|
|
-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
|
2010-01-27 00:23:12 +02:00
|
|
|
"$(SHLIBDIR)/$(SLIBNAME)" \
|
|
|
|
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
2012-08-03 23:13:27 +03:00
|
|
|
-$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)/%")
|
|
|
|
-$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)/%")
|
2010-03-06 16:25:10 +02:00
|
|
|
-$(RM) "$(LIBDIR)/$(LIBNAME)"
|
2010-01-27 00:23:12 +02:00
|
|
|
|
|
|
|
uninstall-headers::
|
2012-08-07 18:05:34 +03:00
|
|
|
$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
|
2015-05-29 16:08:36 +02:00
|
|
|
$(RM) "$(PKGCONFIGDIR)/lib$(FULLNAME).pc"
|
2011-05-24 11:08:55 +03:00
|
|
|
-rmdir "$(INCINSTDIR)"
|
2008-04-08 00:16:31 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(RULES))
|
2009-04-01 03:53:22 +03:00
|
|
|
|
2014-02-15 17:50:29 +03:00
|
|
|
$(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
|
|
|
|
$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
|
2009-04-01 03:53:31 +03:00
|
|
|
|
2009-04-01 03:53:22 +03:00
|
|
|
testprogs: $(TESTPROGS)
|