Makefile (5082B)
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 ####################################################################### 8 # (1) Include initial platform-independent assignments (MANDATORY). # 9 ####################################################################### 10 11 include manifest.mn 12 13 ####################################################################### 14 # (2) Include "global" configuration information. (OPTIONAL) # 15 ####################################################################### 16 17 include $(CORE_DEPTH)/coreconf/config.mk 18 19 ####################################################################### 20 # (3) Include "component" configuration information. (OPTIONAL) # 21 ####################################################################### 22 23 24 25 ####################################################################### 26 # (4) Include "local" platform-dependent assignments (OPTIONAL). # 27 ####################################################################### 28 29 ifdef NSS_DISABLE_GTESTS 30 DIRS := $(filter-out gtests,$(DIRS)) 31 DIRS := $(filter-out cpputil,$(DIRS)) 32 endif 33 34 ####################################################################### 35 # (5) Execute "global" rules. (OPTIONAL) # 36 ####################################################################### 37 38 include $(CORE_DEPTH)/coreconf/rules.mk 39 40 ####################################################################### 41 # (6) Execute "component" rules. (OPTIONAL) # 42 ####################################################################### 43 44 45 46 ####################################################################### 47 # (7) Execute "local" rules. (OPTIONAL). # 48 ####################################################################### 49 50 nss_build_all: 51 $(MAKE) build_nspr 52 $(MAKE) all 53 $(MAKE) latest 54 55 nss_clean_all: 56 $(MAKE) clobber_nspr 57 $(MAKE) clobber 58 59 NSPR_CONFIG_STATUS = $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/config.status 60 NSPR_CONFIGURE = $(CORE_DEPTH)/../nspr/configure 61 62 # 63 # Translate coreconf build options to NSPR configure options. 64 # 65 66 ifeq ($(OS_TARGET),Android) 67 NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) \ 68 --target=$(ANDROID_PREFIX) \ 69 --with-android-version=$(OS_TARGET_RELEASE) \ 70 --with-android-toolchain=$(ANDROID_TOOLCHAIN) \ 71 --with-android-platform=$(ANDROID_SYSROOT) 72 endif 73 ifdef BUILD_OPT 74 NSPR_CONFIGURE_OPTS += --disable-debug --enable-optimize 75 endif 76 ifdef USE_X32 77 NSPR_CONFIGURE_OPTS += --enable-x32 78 endif 79 ifdef USE_64 80 NSPR_CONFIGURE_OPTS += --enable-64bit 81 endif 82 ifdef USE_DEBUG_RTL 83 NSPR_CONFIGURE_OPTS += --enable-debug-rtl 84 endif 85 ifdef USE_STATIC_RTL 86 NSPR_CONFIGURE_OPTS += --enable-static-rtl 87 endif 88 ifdef NS_USE_GCC 89 NSPR_CONFIGURE_ENV = CC=gcc CXX=g++ 90 endif 91 # Make sure to remove -arch arguments. NSPR can't handle that. 92 remove_arch = $(filter-out __REMOVEME%,$(subst $(NULL) -arch , __REMOVEME,$(1))) 93 ifdef CC 94 NSPR_CONFIGURE_ENV = CC="$(call remove_arch,$(CC))" 95 endif 96 ifdef CCC 97 NSPR_CONFIGURE_ENV += CXX="$(call remove_arch,$(CCC))" 98 endif 99 100 # 101 # Some pwd commands on Windows (for example, the pwd 102 # command in Cygwin) return a pathname that begins 103 # with a (forward) slash. When such a pathname is 104 # passed to Windows build tools (for example, cl), it 105 # is mistaken as a command-line option. If that is the case, 106 # we use a relative pathname as NSPR's prefix on Windows. 107 # 108 109 USEABSPATH="YES" 110 ifeq (,$(filter-out WIN%,$(OS_TARGET))) 111 ifeq (,$(findstring :,$(shell pwd))) 112 USEABSPATH="NO" 113 endif 114 endif 115 ifeq ($(USEABSPATH),"YES") 116 NSPR_PREFIX = $(shell pwd)/../dist/$(OBJDIR_NAME) 117 else 118 NSPR_PREFIX = $$(topsrcdir)/../dist/$(OBJDIR_NAME) 119 endif 120 121 ifndef NSS_GYP_PREFIX 122 $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE) 123 mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) 124 cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \ 125 $(NSPR_CONFIGURE_ENV) sh ../configure \ 126 $(NSPR_CONFIGURE_OPTS) \ 127 --with-dist-prefix='$(NSPR_PREFIX)' \ 128 --with-dist-includedir='$(NSPR_PREFIX)/include' 129 else 130 $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE) 131 mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) 132 cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \ 133 $(NSPR_CONFIGURE_ENV) sh ../configure \ 134 $(NSPR_CONFIGURE_OPTS) \ 135 --prefix='$(NSS_GYP_PREFIX)' 136 endif 137 138 ifndef NSS_DISABLE_NSPR_TESTS 139 build_nspr: $(NSPR_CONFIG_STATUS) 140 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) 141 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests 142 else 143 build_nspr: $(NSPR_CONFIG_STATUS) 144 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) 145 endif 146 147 install_nspr: build_nspr 148 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install 149 150 clobber_nspr: $(NSPR_CONFIG_STATUS) 151 $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) clobber 152 153 build_docs: 154 $(MAKE) -C $(CORE_DEPTH)/doc 155 156 clean_docs: 157 $(MAKE) -C $(CORE_DEPTH)/doc clean 158 159 nss_RelEng_bld: import all 160 161 package: 162 $(MAKE) -C pkg publish 163 164 latest: 165 echo $(OBJDIR_NAME) > $(CORE_DEPTH)/../dist/latest