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.

98 lines
2.2KB

  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. install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
  46. "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
  47. cd "$(shlibdir)" && \
  48. ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
  49. cd "$(shlibdir)" && \
  50. ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
  51. install-lib-static: $(LIB)
  52. install -d "$(libdir)"
  53. install -m 644 $(LIB) "$(libdir)"
  54. $(LIB_INSTALL_EXTRA_CMD)
  55. install-headers:
  56. install -d "$(incdir)"
  57. install -d "$(libdir)/pkgconfig"
  58. install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
  59. install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
  60. uninstall: uninstall-libs uninstall-headers
  61. uninstall-libs:
  62. -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
  63. "$(shlibdir)/$(SLIBNAME)" \
  64. "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
  65. -rm -f "$(libdir)/$(LIB)"
  66. uninstall-headers:
  67. rm -f "$(addprefix $(incdir)/,$(HEADERS))"
  68. rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
  69. #
  70. # include dependency files if they exist
  71. #
  72. ifneq ($(wildcard .depend),)
  73. include .depend
  74. endif