2011-06-06 21:38:38 +00:00
|
|
|
SRC_DIR := $(SRC_PATH)/lib$(NAME)
|
2008-04-07 21:16:31 +00:00
|
|
|
|
2011-06-28 16:08:00 +00:00
|
|
|
include $(SRC_PATH)/common.mak
|
2008-04-07 21:16:31 +00:00
|
|
|
|
|
|
|
LIBVERSION := $(lib$(NAME)_VERSION)
|
|
|
|
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
|
2010-03-09 14:58:11 +00:00
|
|
|
INCINSTDIR := $(INCDIR)/lib$(NAME)
|
|
|
|
THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
|
2008-04-07 21:16:31 +00:00
|
|
|
|
2010-03-09 14:58:18 +00:00
|
|
|
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
|
|
|
|
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
|
|
|
|
|
2010-12-07 16:42:25 +00:00
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
|
2011-06-25 10:51:09 +00:00
|
|
|
$(COMPILE_C)
|
2010-03-09 14:58:15 +00:00
|
|
|
|
2010-12-07 16:42:25 +00:00
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%.c
|
2011-06-25 10:51:09 +00:00
|
|
|
$(COMPILE_C)
|
2010-03-09 14:58:15 +00:00
|
|
|
|
|
|
|
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
|
2012-07-25 11:25:58 +00:00
|
|
|
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
|
2010-03-09 14:58:15 +00:00
|
|
|
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
|
|
|
|
|
2011-03-04 19:41:33 +00:00
|
|
|
$(OBJS) $(OBJS:.o=.s) $(SUBDIR)%.ho $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
|
2011-06-25 10:51:09 +00:00
|
|
|
$(TESTOBJS): CPPFLAGS += -DTEST
|
2010-03-07 22:18:33 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SUBDIR)$(LIBNAME): $(OBJS)
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $@
|
2008-04-07 21:16:31 +00:00
|
|
|
$(AR) rc $@ $^ $(EXTRAOBJS)
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
2010-03-07 15:46:22 +00:00
|
|
|
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
|
|
|
|
|
2010-03-09 14:58:18 +00:00
|
|
|
install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
|
|
|
|
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
|
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
define RULES
|
2011-07-30 09:01:17 +00:00
|
|
|
$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
|
2011-07-10 21:01:41 +00:00
|
|
|
$$(LD) $(LDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
|
2009-04-01 00:53:22 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
2008-04-07 21:16:31 +00:00
|
|
|
|
2011-06-26 07:42:42 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_CREATE_DEF_CMD)
|
2011-07-10 21:01:41 +00:00
|
|
|
$$(LD) $(SHFLAGS) $(LDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_EXTRA_CMD)
|
|
|
|
|
2011-06-26 07:42:42 +00:00
|
|
|
ifdef SUBDIR
|
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
|
|
|
|
endif
|
|
|
|
|
2010-03-09 14:58:29 +00:00
|
|
|
clean::
|
|
|
|
$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
2012-02-06 18:31:18 +00:00
|
|
|
$(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(HOSTOBJS) $(HOSTPROGS)
|
2010-03-09 14:58:29 +00:00
|
|
|
|
|
|
|
distclean:: clean
|
2012-02-06 18:31:18 +00:00
|
|
|
$(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
|
2010-03-09 14:58:29 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)mkdir -p "$(SHLIBDIR)"
|
2011-07-07 14:25:30 +00:00
|
|
|
$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
|
2011-07-07 23:05:28 +00:00
|
|
|
$$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
|
2011-07-07 14:25:30 +00:00
|
|
|
$(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
|
|
|
|
$(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 17:14:19 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)mkdir -p "$(LIBDIR)"
|
2010-03-06 17:14:13 +00:00
|
|
|
$$(INSTALL) -m 644 $$< "$(LIBDIR)"
|
2010-03-06 17:44:18 +00:00
|
|
|
$(LIB_INSTALL_EXTRA_CMD)
|
2008-04-07 21:16:31 +00:00
|
|
|
|
2010-03-06 17:14:16 +00:00
|
|
|
install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)mkdir -p "$(INCINSTDIR)"
|
2010-03-06 17:14:16 +00:00
|
|
|
$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
|
|
|
|
|
|
|
|
install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)mkdir -p "$(LIBDIR)/pkgconfig"
|
2010-03-06 17:14:16 +00:00
|
|
|
$$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
|
2010-01-26 22:23:12 +00:00
|
|
|
|
|
|
|
uninstall-libs::
|
2010-03-06 14:25:10 +00:00
|
|
|
-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
|
2010-01-26 22:23:12 +00:00
|
|
|
"$(SHLIBDIR)/$(SLIBNAME)" \
|
|
|
|
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
2011-07-07 14:25:30 +00:00
|
|
|
-$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
|
|
|
|
-$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
|
2010-03-06 14:25:10 +00:00
|
|
|
-$(RM) "$(LIBDIR)/$(LIBNAME)"
|
2010-01-26 22:23:12 +00:00
|
|
|
|
|
|
|
uninstall-headers::
|
2011-05-24 08:08:55 +00:00
|
|
|
$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS)) $(addprefix "$(INCINSTDIR)/",$(BUILT_HEADERS))
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
|
2011-05-24 08:08:55 +00:00
|
|
|
-rmdir "$(INCINSTDIR)"
|
2008-04-07 21:16:31 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(RULES))
|
2009-04-01 00:53:22 +00:00
|
|
|
|
2011-07-10 19:26:25 +00:00
|
|
|
$(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS)
|
2011-12-17 15:05:24 +00:00
|
|
|
$(TESTPROGS): $(SUBDIR)$(LIBNAME)
|
2009-04-01 00:53:31 +00:00
|
|
|
|
2009-04-01 00:53:22 +00:00
|
|
|
examples: $(EXAMPLES)
|
|
|
|
testprogs: $(TESTPROGS)
|