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.

112 lines
2.4KB

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