You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.4KB

  1. #
  2. # common bits used by all libraries
  3. #
  4. VPATH = $(SRC_PATH_BARE)/lib$(NAME)
  5. SRC_DIR = "$(VPATH)"
  6. CFLAGS += $(CFLAGS-yes)
  7. OBJS += $(OBJS-yes)
  8. ASM_OBJS += $(ASM_OBJS-yes)
  9. CPP_OBJS += $(CPP_OBJS-yes)
  10. CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
  11. -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
  12. -I$(SRC_PATH)/libavutil $(OPTFLAGS)
  13. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
  14. OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
  15. STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
  16. SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
  17. all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
  18. $(LIB): $(STATIC_OBJS)
  19. rm -f $@
  20. $(AR) rc $@ $^ $(EXTRAOBJS)
  21. $(RANLIB) $@
  22. $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
  23. ln -sf $^ $@
  24. $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
  25. $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
  26. $(SLIB_EXTRA_CMD)
  27. %.o: %.c
  28. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  29. %.o: %.S
  30. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  31. %: %.o $(LIB)
  32. $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
  33. depend dep: $(SRCS)
  34. $(CC) -MM $(CFLAGS) $^ 1>.depend
  35. clean::
  36. rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
  37. *.def *.dll.a *.exp
  38. distclean: clean
  39. rm -f .depend
  40. ifeq ($(BUILD_SHARED),yes)
  41. INSTLIBTARGETS += install-lib-shared
  42. endif
  43. ifeq ($(BUILD_STATIC),yes)
  44. INSTLIBTARGETS += install-lib-static
  45. endif
  46. install: install-libs install-headers
  47. install-libs: $(INSTLIBTARGETS)
  48. install-lib-shared: $(SLIBNAME)
  49. install -d "$(shlibdir)"
  50. install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
  51. $(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
  52. cd "$(shlibdir)" && \
  53. ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
  54. cd "$(shlibdir)" && \
  55. ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
  56. $(SLIB_INSTALL_EXTRA_CMD)
  57. install-lib-static: $(LIB)
  58. install -d "$(libdir)"
  59. install -m 644 $(LIB) "$(libdir)"
  60. $(LIB_INSTALL_EXTRA_CMD)
  61. install-headers:
  62. install -d "$(incdir)"
  63. install -d "$(libdir)/pkgconfig"
  64. install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
  65. install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
  66. uninstall: uninstall-libs uninstall-headers
  67. uninstall-libs:
  68. -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
  69. "$(shlibdir)/$(SLIBNAME)" \
  70. "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
  71. -rm -f "$(libdir)/$(LIB)"
  72. uninstall-headers:
  73. rm -f $(addprefix "$(incdir)/",$(HEADERS))
  74. rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
  75. .PHONY: all depend dep clean distclean install* uninstall*
  76. -include .depend