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