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