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.

106 lines
2.5KB

  1. #
  2. # common bits used by all libraries
  3. #
  4. SRC_DIR = $(SRC_PATH)/lib$(NAME)
  5. VPATH = $(SRC_DIR)
  6. CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
  7. -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
  8. -I$(SRC_PATH)/libavutil $(OPTFLAGS)
  9. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
  10. OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
  11. STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
  12. SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
  13. EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
  14. all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
  15. $(LIB): $(STATIC_OBJS)
  16. rm -f $@
  17. $(AR) rc $@ $^ $(EXTRAOBJS)
  18. $(RANLIB) $@
  19. $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
  20. ln -sf $^ $@
  21. $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
  22. $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
  23. $(SLIB_EXTRA_CMD)
  24. %.o: %.c
  25. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  26. %.o: %.S
  27. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  28. # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
  29. %.o: %.cpp
  30. g++ $(subst -Wall,,$(CFLAGS)) -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. *.lib *.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 $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
  51. "$(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. 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. #
  76. # include dependency files if they exist
  77. #
  78. ifneq ($(wildcard .depend),)
  79. include .depend
  80. endif