1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/coreconf/Linux.mk Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,203 @@ 1.4 +# 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +include $(CORE_DEPTH)/coreconf/UNIX.mk 1.10 + 1.11 +# 1.12 +# The default implementation strategy for Linux is now pthreads 1.13 +# 1.14 +ifneq ($(OS_TARGET),Android) 1.15 + USE_PTHREADS = 1 1.16 +endif 1.17 + 1.18 +ifeq ($(USE_PTHREADS),1) 1.19 + IMPL_STRATEGY = _PTH 1.20 +endif 1.21 + 1.22 +CC = gcc 1.23 +CCC = g++ 1.24 +RANLIB = ranlib 1.25 + 1.26 +DEFAULT_COMPILER = gcc 1.27 + 1.28 +ifeq ($(OS_TARGET),Android) 1.29 +ifndef ANDROID_NDK 1.30 + $(error Must set ANDROID_NDK to the path to the android NDK first) 1.31 +endif 1.32 + ANDROID_PREFIX=$(OS_TEST)-linux-androideabi 1.33 + ANDROID_TARGET=$(ANDROID_PREFIX)-4.4.3 1.34 + # should autodetect which linux we are on, currently android only 1.35 + # supports linux-x86 prebuilts 1.36 + ANDROID_TOOLCHAIN=$(ANDROID_NDK)/toolchains/$(ANDROID_TARGET)/prebuilt/linux-x86 1.37 + ANDROID_SYSROOT=$(ANDROID_NDK)/platforms/android-$(OS_TARGET_RELEASE)/arch-$(OS_TEST) 1.38 + ANDROID_CC=$(ANDROID_TOOLCHAIN)/bin/$(ANDROID_PREFIX)-gcc 1.39 +# internal tools need to be built with the native compiler 1.40 +ifndef INTERNAL_TOOLS 1.41 + CC = $(ANDROID_CC) --sysroot=$(ANDROID_SYSROOT) 1.42 + DEFAULT_COMPILER=$(ANDROID_PREFIX)-gcc 1.43 + ARCHFLAG = --sysroot=$(ANDROID_SYSROOT) 1.44 + DEFINES += -DNO_SYSINFO -DNO_FORK_CHECK -DANDROID 1.45 + CROSS_COMPILE = 1 1.46 +endif 1.47 +endif 1.48 +ifeq ($(OS_TEST),ppc64) 1.49 + CPU_ARCH = ppc 1.50 +ifeq ($(USE_64),1) 1.51 + ARCHFLAG = -m64 1.52 +endif 1.53 +else 1.54 +ifeq ($(OS_TEST),alpha) 1.55 + OS_REL_CFLAGS = -D_ALPHA_ 1.56 + CPU_ARCH = alpha 1.57 +else 1.58 +ifeq ($(OS_TEST),x86_64) 1.59 +ifeq ($(USE_64),1) 1.60 + CPU_ARCH = x86_64 1.61 + ARCHFLAG = -m64 1.62 +else 1.63 +ifeq ($(USE_X32),1) 1.64 + CPU_ARCH = x86_64 1.65 + ARCHFLAG = -mx32 1.66 + 64BIT_TAG = _x32 1.67 +else 1.68 + OS_REL_CFLAGS = -Di386 1.69 + CPU_ARCH = x86 1.70 + ARCHFLAG = -m32 1.71 +endif 1.72 +endif 1.73 +else 1.74 +ifeq ($(OS_TEST),sparc64) 1.75 + CPU_ARCH = sparc 1.76 +else 1.77 +ifeq (,$(filter-out arm% sa110,$(OS_TEST))) 1.78 + CPU_ARCH = arm 1.79 +else 1.80 +ifeq (,$(filter-out parisc%,$(OS_TEST))) 1.81 + CPU_ARCH = hppa 1.82 +else 1.83 +ifeq (,$(filter-out i%86,$(OS_TEST))) 1.84 + OS_REL_CFLAGS = -Di386 1.85 + CPU_ARCH = x86 1.86 +else 1.87 +ifeq ($(OS_TEST),sh4a) 1.88 + CPU_ARCH = sh4 1.89 +else 1.90 +# $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4 1.91 + CPU_ARCH = $(OS_TEST) 1.92 +endif 1.93 +endif 1.94 +endif 1.95 +endif 1.96 +endif 1.97 +endif 1.98 +endif 1.99 +endif 1.100 + 1.101 + 1.102 +ifneq ($(OS_TARGET),Android) 1.103 +LIBC_TAG = _glibc 1.104 +endif 1.105 + 1.106 +ifeq ($(OS_RELEASE),2.0) 1.107 + OS_REL_CFLAGS += -DLINUX2_0 1.108 + MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) 1.109 + ifdef MAPFILE 1.110 + MKSHLIB += -Wl,--version-script,$(MAPFILE) 1.111 + endif 1.112 + PROCESS_MAP_FILE = grep -v ';-' $< | \ 1.113 + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ 1.114 +endif 1.115 + 1.116 +ifdef BUILD_OPT 1.117 +ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) 1.118 + OPTIMIZER = -Os 1.119 +else 1.120 + OPTIMIZER = -O2 1.121 +endif 1.122 +ifdef MOZ_DEBUG_SYMBOLS 1.123 + ifdef MOZ_DEBUG_FLAGS 1.124 + OPTIMIZER += $(MOZ_DEBUG_FLAGS) 1.125 + else 1.126 + OPTIMIZER += -gdwarf-2 1.127 + endif 1.128 +endif 1.129 +endif 1.130 + 1.131 + 1.132 +ifeq ($(USE_PTHREADS),1) 1.133 +OS_PTHREAD = -lpthread 1.134 +endif 1.135 + 1.136 +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR 1.137 +OS_LIBS = $(OS_PTHREAD) -ldl -lc 1.138 + 1.139 +ifdef USE_PTHREADS 1.140 + DEFINES += -D_REENTRANT 1.141 +endif 1.142 + 1.143 +ARCH = linux 1.144 + 1.145 +DSO_CFLAGS = -fPIC 1.146 +DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,--gc-sections 1.147 +# The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8) 1.148 +# incorrectly reports undefined references in the libraries we link with, so 1.149 +# we don't use -z defs there. 1.150 +ZDEFS_FLAG = -Wl,-z,defs 1.151 +DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) 1.152 +LDFLAGS += $(ARCHFLAG) 1.153 + 1.154 +# On Maemo, we need to use the -rpath-link flag for even the standard system 1.155 +# library directories. 1.156 +ifdef _SBOX_DIR 1.157 +LDFLAGS += -Wl,-rpath-link,/usr/lib:/lib 1.158 +endif 1.159 + 1.160 +# INCLUDES += -I/usr/include -Y/usr/include/linux 1.161 +G++INCLUDES = -I/usr/include/g++ 1.162 + 1.163 +# 1.164 +# Always set CPU_TAG on Linux. 1.165 +# 1.166 +CPU_TAG = _$(CPU_ARCH) 1.167 + 1.168 +# 1.169 +# On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so 1.170 +# dependencies by default. Set FREEBL_NO_DEPEND to 0 in the environment to 1.171 +# override this. 1.172 +# 1.173 +ifneq ($(OS_TARGET),Android) 1.174 +ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE)))) 1.175 +ifndef FREEBL_NO_DEPEND 1.176 +FREEBL_NO_DEPEND = 1 1.177 +FREEBL_LOWHASH = 1 1.178 +endif 1.179 +endif 1.180 +endif 1.181 + 1.182 +USE_SYSTEM_ZLIB = 1 1.183 +ZLIB_LIBS = -lz 1.184 + 1.185 +# The -rpath '$$ORIGIN' linker option instructs this library to search for its 1.186 +# dependencies in the same directory where it resides. 1.187 +ifeq ($(BUILD_SUN_PKG), 1) 1.188 +ifeq ($(USE_64), 1) 1.189 +RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib' 1.190 +else 1.191 +RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib' 1.192 +endif 1.193 +endif 1.194 + 1.195 +OS_REL_CFLAGS += -DLINUX2_1 1.196 +MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) 1.197 + 1.198 +ifdef MAPFILE 1.199 + MKSHLIB += -Wl,--version-script,$(MAPFILE) 1.200 +endif 1.201 +PROCESS_MAP_FILE = grep -v ';-' $< | \ 1.202 + sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ 1.203 + 1.204 +ifeq ($(OS_RELEASE),2.4) 1.205 +DEFINES += -DNO_FORK_CHECK 1.206 +endif