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.

105 lines
2.3KB

  1. #
  2. # common bits used by all libraries
  3. #
  4. SRC_DIR = $(SRC_PATH)/lib$(NAME)
  5. VPATH = $(SRC_DIR)
  6. SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
  7. OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
  8. STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
  9. SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
  10. all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
  11. $(LIB): $(STATIC_OBJS)
  12. rm -f $@
  13. $(AR) rc $@ $^ $(EXTRAOBJS)
  14. $(RANLIB) $@
  15. $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
  16. ln -sf $^ $@
  17. $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
  18. $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
  19. $(SLIB_EXTRA_CMD)
  20. %.o: %.c
  21. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  22. %.o: %.S
  23. $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
  24. # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
  25. %.o: %.cpp
  26. g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
  27. depend: $(SRCS)
  28. $(CC) -MM $(CFLAGS) $^ 1>.depend
  29. dep: depend
  30. clean::
  31. rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
  32. *.lib *.def *.dll.a *.exp
  33. distclean: clean
  34. rm -f .depend
  35. ifeq ($(BUILD_SHARED),yes)
  36. INSTLIBTARGETS += install-lib-shared
  37. endif
  38. ifeq ($(BUILD_STATIC),yes)
  39. INSTLIBTARGETS += install-lib-static
  40. endif
  41. install: install-libs install-headers
  42. install-libs: $(INSTLIBTARGETS)
  43. install-lib-shared: $(SLIBNAME)
  44. install -d "$(shlibdir)"
  45. ifeq ($(CONFIG_MINGW),yes)
  46. install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
  47. else
  48. install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
  49. $(shlibdir)/$(SLIBNAME_WITH_VERSION)
  50. ln -sf $(SLIBNAME_WITH_VERSION) \
  51. $(shlibdir)/$(SLIBNAME_WITH_MAJOR)
  52. ln -sf $(SLIBNAME_WITH_VERSION) \
  53. $(shlibdir)/$(SLIBNAME)
  54. endif
  55. install-lib-static: $(LIB)
  56. install -d "$(libdir)"
  57. install -m 644 $(LIB) "$(libdir)"
  58. install-headers:
  59. install -d "$(incdir)"
  60. install -d "$(libdir)/pkgconfig"
  61. install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
  62. install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
  63. uninstall: uninstall-libs uninstall-headers
  64. uninstall-libs:
  65. ifeq ($(CONFIG_MINGW),yes)
  66. -rm -f $(prefix)/$(SLIBNAME)
  67. else
  68. -rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
  69. $(libdir)/$(SLIBNAME) \
  70. $(libdir)/$(SLIBNAME_WITH_VERSION)
  71. endif
  72. -rm -f $(libdir)/$(LIB)
  73. uninstall-headers:
  74. rm -f $(addprefix $(incdir)/,$(HEADERS))
  75. rm -f $(libdir)/pkgconfig/lib$(NAME).pc
  76. #
  77. # include dependency files if they exist
  78. #
  79. ifneq ($(wildcard .depend),)
  80. include .depend
  81. endif