config.mk 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. # Configuration information for building in the NSPR source module
  7. # Define an include-at-most-once-flag
  8. NSPR_CONFIG_MK = 1
  9. #
  10. # The variable definitions in this file are inputs to NSPR's
  11. # build system. This file, if present, is included at the
  12. # beginning of config.mk.
  13. #
  14. # For example:
  15. #
  16. # MOZ_OPTIMIZE=1
  17. # USE_PTHREADS=1
  18. # NS_USE_GCC=
  19. #
  20. ifndef topsrcdir
  21. topsrcdir=$(MOD_DEPTH)
  22. endif
  23. ifndef srcdir
  24. srcdir=.
  25. endif
  26. NFSPWD = $(MOD_DEPTH)/config/nfspwd
  27. CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\
  28. $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
  29. CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\
  30. $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
  31. # For purify
  32. NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
  33. $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
  34. NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
  35. $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
  36. LDFLAGS = $(OS_LDFLAGS)
  37. # Enable profile-guided optimization
  38. ifndef NO_PROFILE_GUIDED_OPTIMIZE
  39. ifdef MOZ_PROFILE_GENERATE
  40. CFLAGS += $(PROFILE_GEN_CFLAGS)
  41. LDFLAGS += $(PROFILE_GEN_LDFLAGS)
  42. DLLFLAGS += $(PROFILE_GEN_LDFLAGS)
  43. ifeq (WINNT,$(OS_ARCH))
  44. AR_FLAGS += -LTCG
  45. endif
  46. endif # MOZ_PROFILE_GENERATE
  47. ifdef MOZ_PROFILE_USE
  48. CFLAGS += $(PROFILE_USE_CFLAGS)
  49. LDFLAGS += $(PROFILE_USE_LDFLAGS)
  50. DLLFLAGS += $(PROFILE_USE_LDFLAGS)
  51. ifeq (WINNT,$(OS_ARCH))
  52. AR_FLAGS += -LTCG
  53. endif
  54. endif # MOZ_PROFILE_USE
  55. endif # NO_PROFILE_GUIDED_OPTIMIZE
  56. define MAKE_OBJDIR
  57. if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
  58. endef
  59. LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS)
  60. ifeq ($(OS_ARCH),Darwin)
  61. PWD := $(shell pwd)
  62. endif
  63. ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
  64. INSTALL = $(NSINSTALL)
  65. else
  66. ifeq ($(NSDISTMODE),copy)
  67. # copy files, but preserve source mtime
  68. INSTALL = $(NSINSTALL) -t
  69. else
  70. ifeq ($(NSDISTMODE),absolute_symlink)
  71. # install using absolute symbolic links
  72. ifeq ($(OS_ARCH),Darwin)
  73. INSTALL = $(NSINSTALL) -L $(PWD)
  74. else
  75. INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
  76. endif
  77. else
  78. # install using relative symbolic links
  79. INSTALL = $(NSINSTALL) -R
  80. endif
  81. endif
  82. endif # (WINNT || OS2) && !CROSS_COMPILE
  83. DEPENDENCIES = $(OBJDIR)/.md
  84. ifdef BUILD_DEBUG_GC
  85. DEFINES += -DDEBUG_GC
  86. endif
  87. GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
  88. DIST_GARBAGE += Makefile
  89. ####################################################################
  90. #
  91. # The NSPR-specific configuration
  92. #
  93. ####################################################################
  94. DEFINES += -DFORCE_PR_LOG
  95. ifeq ($(_PR_NO_CLOCK_TIMER),1)
  96. DEFINES += -D_PR_NO_CLOCK_TIMER
  97. endif
  98. ifeq ($(USE_PTHREADS), 1)
  99. DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
  100. endif
  101. ifeq ($(PTHREADS_USER), 1)
  102. DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
  103. endif
  104. ifeq ($(USE_IPV6),1)
  105. DEFINES += -D_PR_INET6
  106. endif
  107. ifeq ($(MOZ_UNICODE),1)
  108. DEFINES += -DMOZ_UNICODE
  109. endif
  110. ####################################################################
  111. #
  112. # Configuration for the release process
  113. #
  114. ####################################################################
  115. MDIST = /m/dist
  116. ifeq ($(OS_ARCH),WINNT)
  117. MDIST = //helium/dist
  118. MDIST_DOS = $(subst /,\\,$(MDIST))
  119. endif
  120. # RELEASE_DIR is ns/dist/<module name>
  121. RELEASE_DIR = $(MOD_DEPTH)/dist/release/$(MOD_NAME)
  122. RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include
  123. RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin
  124. RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib
  125. # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
  126. # this file
  127. OBJ_SUFFIX := $(_OBJ_SUFFIX)
  128. # PGO builds with GCC build objects with instrumentation in a first pass,
  129. # then objects optimized, without instrumentation, in a second pass. If
  130. # we overwrite the ojects from the first pass with those from the second,
  131. # we end up not getting instrumentation data for better optimization on
  132. # incremental builds. As a consequence, we use a different object suffix
  133. # for the first pass.
  134. ifdef MOZ_PROFILE_GENERATE
  135. ifdef NS_USE_GCC
  136. OBJ_SUFFIX := i_o
  137. endif
  138. endif