2008-04-07 21:16:31 +00:00
|
|
|
SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
|
|
|
|
|
|
|
|
include $(SUBDIR)../common.mak
|
|
|
|
|
|
|
|
LIBVERSION := $(lib$(NAME)_VERSION)
|
|
|
|
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
|
|
|
|
|
2010-03-08 18:43:35 +00:00
|
|
|
$(OBJS) $(SUBDIR)%.ho $(SUBDIR)%-test.o: CPPFLAGS += -DHAVE_AV_CONFIG_H
|
2010-03-07 22:18:33 +00:00
|
|
|
|
2009-10-28 20:46:21 +00:00
|
|
|
ifdef CONFIG_STATIC
|
2008-04-07 21:16:31 +00:00
|
|
|
all: $(SUBDIR)$(LIBNAME)
|
|
|
|
|
|
|
|
install-libs: install-lib$(NAME)-static
|
|
|
|
|
|
|
|
$(SUBDIR)$(LIBNAME): $(OBJS)
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $@
|
2008-04-07 21:16:31 +00:00
|
|
|
$(AR) rc $@ $^ $(EXTRAOBJS)
|
|
|
|
$(RANLIB) $@
|
|
|
|
endif
|
|
|
|
|
2010-03-07 15:46:22 +00:00
|
|
|
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
|
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
INCINSTDIR := $(INCDIR)/lib$(NAME)
|
|
|
|
|
2009-07-28 08:58:48 +00:00
|
|
|
THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
|
2009-04-01 00:53:31 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
define RULES
|
2009-04-01 00:53:22 +00:00
|
|
|
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
|
2010-03-06 17:14:19 +00:00
|
|
|
$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%.c
|
2010-03-08 18:43:29 +00:00
|
|
|
$$(CC) $$(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
|
2010-03-08 18:43:29 +00:00
|
|
|
$$(CC) $$(CPPFLAGS) $(CFLAGS) -DTEST -c $$(CC_O) $$^
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
|
2010-03-06 17:14:19 +00:00
|
|
|
$$(YASMDEP) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
|
|
|
|
$$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
clean::
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
2009-10-29 00:55:35 +00:00
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
|
|
|
|
$(HOSTOBJS) $(HOSTPROGS)
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
distclean:: clean
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
|
2009-04-01 00:53:22 +00:00
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
|
|
|
|
2009-07-28 08:58:48 +00:00
|
|
|
ifdef CONFIG_SHARED
|
2008-04-07 21:16:31 +00:00
|
|
|
all: $(SUBDIR)$(SLIBNAME)
|
|
|
|
|
|
|
|
install-libs: install-lib$(NAME)-shared
|
|
|
|
|
|
|
|
$(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
|
|
|
|
2010-01-16 04:49:02 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_CREATE_DEF_CMD)
|
2010-03-06 17:14:19 +00:00
|
|
|
$$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_EXTRA_CMD)
|
|
|
|
|
2008-04-07 22:17:47 +00:00
|
|
|
ifdef SUBDIR
|
2008-04-09 21:11:39 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
|
2008-04-07 21:16:31 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)mkdir -p "$(SHLIBDIR)"
|
2010-03-06 17:14:13 +00:00
|
|
|
$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
2010-03-06 17:14:19 +00:00
|
|
|
$$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
|
|
|
$(Q)cd "$(SHLIBDIR)" && \
|
2008-04-07 21:16:31 +00:00
|
|
|
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
|
2010-03-06 17:14:19 +00:00
|
|
|
$(Q)cd "$(SHLIBDIR)" && \
|
2008-04-07 21:16:31 +00:00
|
|
|
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
|
2010-03-06 17:45:38 +00:00
|
|
|
$(SLIB_INSTALL_EXTRA_CMD)
|
2010-03-06 17:14:19 +00:00
|
|
|
|
|
|
|
install-lib$(NAME)-static: MSG = $(LIBDIR)/$(LIBNAME)
|
|
|
|
install-lib$(NAME)-shared: MSG = $(LIBDIR)/$(SLIBNAME)
|
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)"
|
|
|
|
-$(SLIB_UNINSTALL_EXTRA_CMD)
|
2010-03-06 14:25:10 +00:00
|
|
|
-$(RM) "$(LIBDIR)/$(LIBNAME)"
|
2010-01-26 22:23:12 +00:00
|
|
|
|
|
|
|
uninstall-headers::
|
2010-03-06 14:25:10 +00:00
|
|
|
$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
|
|
|
|
$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
|
2010-01-26 22:23:12 +00:00
|
|
|
-rmdir "$(INCDIR)"
|
2008-04-07 21:16:31 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(RULES))
|
2009-04-01 00:53:22 +00:00
|
|
|
|
2009-04-01 00:53:31 +00:00
|
|
|
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
|
|
|
|
|
2009-04-01 00:53:22 +00:00
|
|
|
examples: $(EXAMPLES)
|
|
|
|
testprogs: $(TESTPROGS)
|