home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Makefiles / pb_makefiles / library.make < prev    next >
Text File  |  1996-12-05  |  3KB  |  108 lines

  1. #
  2. # library.make
  3. #
  4. # Variable definitions and rules for building library projects.  An
  5. # application is a directory which contains an executable and any resources
  6. # that executable requires.  See wrapped.make for more information about
  7. # projects whose product is a directory.
  8. #
  9. # PUBLIC TARGETS
  10. #    library: synonymous with all
  11. #
  12. # IMPORTED VARIABLES
  13. #    PUBLIC_HEADER_DIR:  Determines where public exported header files
  14. #    should be installed.  Do not include $(DSTROOT) in this value --
  15. #    it is prefixed automatically.
  16. #    PRIVATE_HEADER_DIR:  Determines where private exported header files
  17. #      should be installed.  Do not include $(DSTROOT) in this value --
  18. #    it is prefixed automatically.
  19. #    LIBRARY_STYLE:  This may be either STATIC or DYNAMIC, and determines
  20. #      whether the libraries produces are statically linked when they
  21. #    are used or if they are dynamically loadable.
  22. #    LIBRARY_DLL_INSTALLDIR:  On Windows platforms, this variable indicates
  23. #    where to put the library's DLL.  This variable defaults to 
  24. #    $(INSTALLDIR)/../Executables
  25. #
  26. # OVERRIDABLE VARIABLES
  27. #    INSTALL_NAME_DIRECTIVE:  This directive ensures that executables linked
  28. #    against the shlib will run against the correct version even if
  29. #    the current version of the shlib changes.  You may override this
  30. #    to "" as an alternative to using the DYLD_LIBRARY_PATH during your
  31. #    development cycle, but be sure to restore it before installing.
  32. #
  33. # EXPORTED VARIABLES
  34. #    none
  35. #
  36.  
  37. .PHONY: library all
  38. library: all
  39. PROJTYPE = LIBRARY
  40.  
  41. PRODUCT = $(PRODUCT_DIR)/$(LIBRARY_PREFIX)$(NAME)$(LIBRARY_EXT)
  42. PRODUCTS = $(PRODUCT)
  43. STRIPPED_PRODUCTS = $(PRODUCT)
  44.  
  45. ifndef LIBRARY_DLL_INSTALLDIR
  46. LIBRARY_DLL_INSTALLDIR = $(INSTALLDIR)/../Executables
  47. endif
  48.  
  49. DYLIB_INSTALL_DIR = $(INSTALLDIR)
  50. DYLIB_INSTALL_NAME = $(LIBRARY_PREFIX)$(NAME)$(LIBRARY_EXT)
  51. INSTALL_NAME_DIRECTIVE = -install_name $(DYLIB_INSTALL_DIR)/$(DYLIB_INSTALL_NAME)
  52.  
  53. ifneq "STATIC" "$(LIBRARY_STYLE)"
  54. PROJTYPE_LDFLAGS = -dynamic -compatibility_version $(COMPATIBILITY_PROJECT_VERSION) -current_version $(CURRENT_PROJECT_VERSION) $(INSTALL_NAME_DIRECTIVE)
  55. else
  56. PROJTYPE_LDFLAGS = -static
  57. endif
  58.  
  59. BEFORE_INSTALL += verify-install-name-directive
  60.  
  61. ifeq "WINDOWS" "$(OS)"
  62. ifneq "STATIC" "$(LIBRARY_STYLE)"
  63.  
  64. AFTER_INSTALL += install-dll
  65. OS_LDFLAGS += -def $(WINDOWS_DEF_FILE)
  66.  
  67. endif
  68. endif
  69.  
  70. include $(MAKEFILEDIR)/common.make
  71. -include $(LOCAL_MAKEFILEDIR)/library.make.preamble
  72.  
  73. ifeq "STATIC" "$(LIBRARY_STYLE)"
  74.  
  75. $(PRODUCT): $(DEPENDENCIES)
  76. ifeq "$(USE_AR)" "YES"
  77.     $(AR) ru $(PRODUCT) $(LOADABLES)
  78.     $(RANLIB) $(PRODUCT)
  79. else
  80.     $(LIBTOOL) $(ALL_LIBTOOL_FLAGS) -o $(PRODUCT) $(LOADABLES)
  81. endif
  82.  
  83. else
  84.  
  85. $(PRODUCT): $(DEPENDENCIES) $(WINDOWS_DEF_FILE)
  86.     $(LIBTOOL) $(filter-out -g, $(ALL_LDFLAGS)) -o $(PRODUCT) $(LOADABLES)
  87. endif
  88.  
  89. verify-install-name-directive:
  90. ifeq "" "$(INSTALL_NAME_DIRECTIVE)"
  91.     $(SILENT) $(ECHO) You must restore the INSTALL_NAME_DIRECTIVE variable
  92.     $(SILENT) $(ECHO) before installing a framework.
  93.     $(SILENT) exit 1
  94. endif
  95.  
  96. install-dll: $(DSTROOT)$(LIBRARY_DLL_INSTALLDIR)
  97.     $(RM) -f $(DSTROOT)$(LIBRARY_DLL_INSTALLDIR)/$(NAME)$(DLL_EXT)
  98.     $(MV) $(DSTROOT)$(INSTALLDIR)/$(NAME)$(DLL_EXT) $(DSTROOT)$(LIBRARY_DLL_INSTALLDIR)
  99.  
  100. #
  101. # creating directories
  102. #
  103.  
  104. $(DSTROOT)$(LIBRARY_DLL_INSTALLDIR):
  105.     $(MKDIRS) $@
  106.  
  107. -include $(LOCAL_MAKEFILEDIR)/library.make.postamble
  108.