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