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