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.

102 lines
2.2KB

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