Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #! gmake
  2. #
  3. # This Source Code Form is subject to the terms of the Mozilla Public
  4. # License, v. 2.0. If a copy of the MPL was not distributed with this
  5. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. #######################################################################
  7. # (1) Include initial platform-independent assignments (MANDATORY). #
  8. #######################################################################
  9. include manifest.mn
  10. #######################################################################
  11. # (2) Include "global" configuration information. (OPTIONAL) #
  12. #######################################################################
  13. include $(CORE_DEPTH)/coreconf/config.mk
  14. #######################################################################
  15. # (3) Include "component" configuration information. (OPTIONAL) #
  16. #######################################################################
  17. #######################################################################
  18. # (4) Include "local" platform-dependent assignments (OPTIONAL). #
  19. #######################################################################
  20. ifdef NSS_DISABLE_GTESTS
  21. DIRS := $(filter-out gtests,$(DIRS))
  22. DIRS := $(filter-out cpputil,$(DIRS))
  23. endif
  24. #######################################################################
  25. # (5) Execute "global" rules. (OPTIONAL) #
  26. #######################################################################
  27. include $(CORE_DEPTH)/coreconf/rules.mk
  28. #######################################################################
  29. # (6) Execute "component" rules. (OPTIONAL) #
  30. #######################################################################
  31. #######################################################################
  32. # (7) Execute "local" rules. (OPTIONAL). #
  33. #######################################################################
  34. nss_build_all: build_nspr all latest
  35. nss_clean_all: clobber_nspr clobber
  36. NSPR_CONFIG_STATUS = $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/config.status
  37. NSPR_CONFIGURE = $(CORE_DEPTH)/../nspr/configure
  38. #
  39. # Translate coreconf build options to NSPR configure options.
  40. #
  41. ifeq ($(OS_TARGET),Android)
  42. NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) \
  43. --target=$(ANDROID_PREFIX) \
  44. --with-android-version=$(OS_TARGET_RELEASE) \
  45. --with-android-toolchain=$(ANDROID_TOOLCHAIN) \
  46. --with-android-platform=$(ANDROID_SYSROOT)
  47. endif
  48. ifdef BUILD_OPT
  49. NSPR_CONFIGURE_OPTS += --disable-debug --enable-optimize
  50. endif
  51. ifdef USE_X32
  52. NSPR_CONFIGURE_OPTS += --enable-x32
  53. endif
  54. ifdef USE_64
  55. NSPR_CONFIGURE_OPTS += --enable-64bit
  56. endif
  57. ifeq ($(OS_TARGET),WIN95)
  58. NSPR_CONFIGURE_OPTS += --enable-win32-target=WIN95
  59. endif
  60. ifdef USE_DEBUG_RTL
  61. NSPR_CONFIGURE_OPTS += --enable-debug-rtl
  62. endif
  63. ifdef USE_STATIC_RTL
  64. NSPR_CONFIGURE_OPTS += --enable-static-rtl
  65. endif
  66. ifdef NS_USE_GCC
  67. NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
  68. endif
  69. # Make sure to remove -arch arguments. NSPR can't handle that.
  70. remove_arch = $(filter-out __REMOVEME%,$(subst $(NULL) -arch , __REMOVEME,$(1)))
  71. ifdef CC
  72. NSPR_CONFIGURE_ENV = CC="$(call remove_arch,$(CC))"
  73. endif
  74. ifdef CCC
  75. NSPR_CONFIGURE_ENV += CXX="$(call remove_arch,$(CCC))"
  76. endif
  77. #
  78. # Some pwd commands on Windows (for example, the pwd
  79. # command in Cygwin) return a pathname that begins
  80. # with a (forward) slash. When such a pathname is
  81. # passed to Windows build tools (for example, cl), it
  82. # is mistaken as a command-line option. If that is the case,
  83. # we use a relative pathname as NSPR's prefix on Windows.
  84. #
  85. USEABSPATH="YES"
  86. ifeq (,$(filter-out WIN%,$(OS_TARGET)))
  87. ifeq (,$(findstring :,$(shell pwd)))
  88. USEABSPATH="NO"
  89. endif
  90. endif
  91. ifeq ($(USEABSPATH),"YES")
  92. NSPR_PREFIX = $(shell pwd)/../dist/$(OBJDIR_NAME)
  93. else
  94. NSPR_PREFIX = $$(topsrcdir)/../dist/$(OBJDIR_NAME)
  95. endif
  96. ifndef NSS_GYP_PREFIX
  97. $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE)
  98. mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
  99. cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \
  100. $(NSPR_CONFIGURE_ENV) sh ../configure \
  101. $(NSPR_CONFIGURE_OPTS) \
  102. --with-dist-prefix='$(NSPR_PREFIX)' \
  103. --with-dist-includedir='$(NSPR_PREFIX)/include'
  104. else
  105. $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE)
  106. mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
  107. cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \
  108. $(NSPR_CONFIGURE_ENV) sh ../configure \
  109. $(NSPR_CONFIGURE_OPTS) \
  110. --prefix='$(NSS_GYP_PREFIX)'
  111. endif
  112. build_nspr: $(NSPR_CONFIG_STATUS)
  113. $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
  114. $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests
  115. install_nspr: build_nspr
  116. $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
  117. clobber_nspr: $(NSPR_CONFIG_STATUS)
  118. $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) clobber
  119. build_docs:
  120. $(MAKE) -C $(CORE_DEPTH)/doc
  121. clean_docs:
  122. $(MAKE) -C $(CORE_DEPTH)/doc clean
  123. nss_RelEng_bld: import all
  124. package:
  125. $(MAKE) -C pkg publish
  126. latest:
  127. echo $(OBJDIR_NAME) > $(CORE_DEPTH)/../dist/latest