Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #! gmake |
michael@0 | 2 | # |
michael@0 | 3 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | |
michael@0 | 7 | ####################################################################### |
michael@0 | 8 | # (1) Include initial platform-independent assignments (MANDATORY). # |
michael@0 | 9 | ####################################################################### |
michael@0 | 10 | |
michael@0 | 11 | include manifest.mn |
michael@0 | 12 | |
michael@0 | 13 | ####################################################################### |
michael@0 | 14 | # (2) Include "global" configuration information. (OPTIONAL) # |
michael@0 | 15 | ####################################################################### |
michael@0 | 16 | |
michael@0 | 17 | include $(CORE_DEPTH)/coreconf/config.mk |
michael@0 | 18 | |
michael@0 | 19 | ####################################################################### |
michael@0 | 20 | # (3) Include "component" configuration information. (OPTIONAL) # |
michael@0 | 21 | ####################################################################### |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | |
michael@0 | 25 | ####################################################################### |
michael@0 | 26 | # (4) Include "local" platform-dependent assignments (OPTIONAL). # |
michael@0 | 27 | ####################################################################### |
michael@0 | 28 | |
michael@0 | 29 | include config.mk |
michael@0 | 30 | |
michael@0 | 31 | # default for all platforms |
michael@0 | 32 | # unset this on those that have multiple freebl libraries |
michael@0 | 33 | FREEBL_BUILD_SINGLE_SHLIB = 1 |
michael@0 | 34 | |
michael@0 | 35 | ifdef USE_64 |
michael@0 | 36 | DEFINES += -DNSS_USE_64 |
michael@0 | 37 | endif |
michael@0 | 38 | |
michael@0 | 39 | ifdef USE_ABI32_FPU |
michael@0 | 40 | DEFINES += -DNSS_USE_ABI32_FPU |
michael@0 | 41 | endif |
michael@0 | 42 | |
michael@0 | 43 | ifeq ($(FREEBL_NO_DEPEND),1) |
michael@0 | 44 | DEFINES += -DFREEBL_NO_DEPEND |
michael@0 | 45 | STUBS_SRCS = stubs.c |
michael@0 | 46 | endif |
michael@0 | 47 | |
michael@0 | 48 | ifeq ($(FREEBL_LOWHASH),1) |
michael@0 | 49 | LOWHASH_SRCS = nsslowhash.c |
michael@0 | 50 | LOWHASH_EXPORTS = nsslowhash.h |
michael@0 | 51 | MAPFILE_SOURCE = freebl_hash.def |
michael@0 | 52 | else |
michael@0 | 53 | MAPFILE_SOURCE = freebl.def |
michael@0 | 54 | endif |
michael@0 | 55 | |
michael@0 | 56 | # FREEBL_USE_PRELINK |
michael@0 | 57 | # |
michael@0 | 58 | # Most modern version of Linux support a speed optimization scheme where an |
michael@0 | 59 | # application called prelink modifies programs and shared libraries to quickly |
michael@0 | 60 | # load if they fit into an already designed address space. In short, prelink |
michael@0 | 61 | # scans the list of programs and libraries on your system, assigns them a |
michael@0 | 62 | # predefined space in the the address space, then provides the fixups to the |
michael@0 | 63 | # library. |
michael@0 | 64 | # |
michael@0 | 65 | # The modification of the shared library is correctly detected by the freebl |
michael@0 | 66 | # FIPS checksum scheme where we check a signed hash of the library against the |
michael@0 | 67 | # library itself. |
michael@0 | 68 | # |
michael@0 | 69 | # The prelink command itself can reverse the process of modification and output |
michael@0 | 70 | # the prestine shared library as it was before prelink made it's changes. |
michael@0 | 71 | # This option tells Freebl could use prelink to output the original copy of |
michael@0 | 72 | # the shared library before prelink modified it. |
michael@0 | 73 | # |
michael@0 | 74 | # FREEBL_PRELINK_COMMAND |
michael@0 | 75 | # |
michael@0 | 76 | # This is an optional environment variable which can override the default |
michael@0 | 77 | # prelink command. It could be used on systems that did something similiar to |
michael@0 | 78 | # prelink but used a different command and syntax. The only requirement is the |
michael@0 | 79 | # program must take the library as the last argument, the program must output |
michael@0 | 80 | # the original library to standard out, and the program does not need to take |
michael@0 | 81 | # any quoted or imbedded spaces in its arguments (except the path to the |
michael@0 | 82 | # library itself, which can have imbedded spaces or special characters). |
michael@0 | 83 | # |
michael@0 | 84 | ifdef FREEBL_USE_PRELINK |
michael@0 | 85 | DEFINES += -DFREEBL_USE_PRELINK |
michael@0 | 86 | ifdef LINUX |
michael@0 | 87 | DEFINES += -D__GNU_SOURCE=1 |
michael@0 | 88 | endif |
michael@0 | 89 | endif |
michael@0 | 90 | ifdef FREEBL_PRELINK_COMMAND |
michael@0 | 91 | DEFINES +=-DFREEBL_PRELINK_COMMAND=\"$(FREEBL_PRELINK_COMMAND)\" |
michael@0 | 92 | endif |
michael@0 | 93 | # NSS_X86 means the target is a 32-bits x86 CPU architecture |
michael@0 | 94 | # NSS_X64 means the target is a 64-bits 64 CPU architecture |
michael@0 | 95 | # NSS_X86_OR_X64 means the target is either x86 or x64 |
michael@0 | 96 | ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH))) |
michael@0 | 97 | DEFINES += -DNSS_X86_OR_X64 |
michael@0 | 98 | ifneq (,$(USE_64)$(USE_X32)) |
michael@0 | 99 | DEFINES += -DNSS_X64 |
michael@0 | 100 | else |
michael@0 | 101 | DEFINES += -DNSS_X86 |
michael@0 | 102 | endif |
michael@0 | 103 | endif |
michael@0 | 104 | |
michael@0 | 105 | ifeq ($(OS_TARGET),OSF1) |
michael@0 | 106 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD |
michael@0 | 107 | MPI_SRCS += mpvalpha.c |
michael@0 | 108 | endif |
michael@0 | 109 | |
michael@0 | 110 | ifeq (OS2,$(OS_TARGET)) |
michael@0 | 111 | ASFILES = mpi_x86_os2.s |
michael@0 | 112 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 113 | DEFINES += -DMP_ASSEMBLY_DIV_2DX1D |
michael@0 | 114 | DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD |
michael@0 | 115 | DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN |
michael@0 | 116 | endif |
michael@0 | 117 | |
michael@0 | 118 | ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) |
michael@0 | 119 | ifndef USE_64 |
michael@0 | 120 | # 32-bit Windows |
michael@0 | 121 | ifdef NS_USE_GCC |
michael@0 | 122 | # Ideally, we want to use assembler |
michael@0 | 123 | # ASFILES = mpi_x86.s |
michael@0 | 124 | # DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \ |
michael@0 | 125 | # -DMP_ASSEMBLY_DIV_2DX1D |
michael@0 | 126 | # but we haven't figured out how to make it work, so we are not |
michael@0 | 127 | # using assembler right now. |
michael@0 | 128 | ASFILES = |
michael@0 | 129 | DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT |
michael@0 | 130 | else |
michael@0 | 131 | # MSVC |
michael@0 | 132 | MPI_SRCS += mpi_x86_asm.c |
michael@0 | 133 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 134 | DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD |
michael@0 | 135 | ifdef BUILD_OPT |
michael@0 | 136 | OPTIMIZER += -Ox # maximum optimization for freebl |
michael@0 | 137 | endif |
michael@0 | 138 | # The Intel AES assembly code requires Visual C++ 2010. |
michael@0 | 139 | # if $(_MSC_VER) >= 1600 (Visual C++ 2010) |
michael@0 | 140 | ifeq ($(firstword $(sort $(_MSC_VER) 1600)),1600) |
michael@0 | 141 | DEFINES += -DUSE_HW_AES -DINTEL_GCM |
michael@0 | 142 | ASFILES += intel-aes-x86-masm.asm intel-gcm-x86-masm.asm |
michael@0 | 143 | EXTRA_SRCS += intel-gcm-wrap.c |
michael@0 | 144 | endif |
michael@0 | 145 | endif |
michael@0 | 146 | else |
michael@0 | 147 | # -DMP_NO_MP_WORD |
michael@0 | 148 | DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN |
michael@0 | 149 | ifdef NS_USE_GCC |
michael@0 | 150 | # Ideally, we should use amd64 assembly code, but it's not yet mingw-w64 |
michael@0 | 151 | # compatible. |
michael@0 | 152 | else |
michael@0 | 153 | # MSVC |
michael@0 | 154 | ifdef BUILD_OPT |
michael@0 | 155 | OPTIMIZER += -Ox # maximum optimization for freebl |
michael@0 | 156 | endif |
michael@0 | 157 | ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm |
michael@0 | 158 | DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY |
michael@0 | 159 | DEFINES += -DNSS_USE_COMBA |
michael@0 | 160 | # The Intel AES assembly code requires Visual C++ 2010 (10.0). The _xgetbv |
michael@0 | 161 | # compiler intrinsic function requires Visual C++ 2010 (10.0) SP1. |
michael@0 | 162 | ifeq ($(_MSC_VER_GE_10SP1),1) |
michael@0 | 163 | DEFINES += -DUSE_HW_AES -DINTEL_GCM |
michael@0 | 164 | ASFILES += intel-aes-x64-masm.asm intel-gcm-x64-masm.asm |
michael@0 | 165 | EXTRA_SRCS += intel-gcm-wrap.c |
michael@0 | 166 | endif |
michael@0 | 167 | MPI_SRCS += mpi_amd64.c |
michael@0 | 168 | endif |
michael@0 | 169 | endif |
michael@0 | 170 | endif |
michael@0 | 171 | |
michael@0 | 172 | ifeq ($(OS_TARGET),IRIX) |
michael@0 | 173 | ifeq ($(USE_N32),1) |
michael@0 | 174 | ASFILES = mpi_mips.s |
michael@0 | 175 | ifeq ($(NS_USE_GCC),1) |
michael@0 | 176 | ASFLAGS = -Wp,-P -Wp,-traditional -O -mips3 |
michael@0 | 177 | else |
michael@0 | 178 | ASFLAGS = -O -OPT:Olimit=4000 -dollar -fullwarn -xansi -n32 -mips3 |
michael@0 | 179 | endif |
michael@0 | 180 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 181 | DEFINES += -DMP_USE_UINT_DIGIT |
michael@0 | 182 | endif |
michael@0 | 183 | endif |
michael@0 | 184 | |
michael@0 | 185 | ifeq ($(OS_TARGET),Darwin) |
michael@0 | 186 | ifeq ($(CPU_ARCH),x86) |
michael@0 | 187 | ASFILES = mpi_sse2.s |
michael@0 | 188 | DEFINES += -DMP_USE_UINT_DIGIT |
michael@0 | 189 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 190 | DEFINES += -DMP_ASSEMBLY_DIV_2DX1D |
michael@0 | 191 | endif |
michael@0 | 192 | endif # Darwin |
michael@0 | 193 | |
michael@0 | 194 | ifeq ($(OS_TARGET),Linux) |
michael@0 | 195 | ifeq ($(CPU_ARCH),x86_64) |
michael@0 | 196 | ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s |
michael@0 | 197 | ASFLAGS += -fPIC -Wa,--noexecstack |
michael@0 | 198 | DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY |
michael@0 | 199 | DEFINES += -DNSS_USE_COMBA |
michael@0 | 200 | DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN |
michael@0 | 201 | # DEFINES += -DMPI_AMD64_ADD |
michael@0 | 202 | # comment the next four lines to turn off Intel HW acceleration. |
michael@0 | 203 | DEFINES += -DUSE_HW_AES -DINTEL_GCM |
michael@0 | 204 | ASFILES += intel-aes.s intel-gcm.s |
michael@0 | 205 | EXTRA_SRCS += intel-gcm-wrap.c |
michael@0 | 206 | INTEL_GCM = 1 |
michael@0 | 207 | MPI_SRCS += mpi_amd64.c mp_comba.c |
michael@0 | 208 | endif |
michael@0 | 209 | ifeq ($(CPU_ARCH),x86) |
michael@0 | 210 | ASFILES = mpi_x86.s |
michael@0 | 211 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 212 | DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT |
michael@0 | 213 | DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN |
michael@0 | 214 | # The floating point ECC code doesn't work on Linux x86 (bug 311432). |
michael@0 | 215 | #ECL_USE_FP = 1 |
michael@0 | 216 | endif |
michael@0 | 217 | ifeq ($(CPU_ARCH),arm) |
michael@0 | 218 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 219 | DEFINES += -DMP_USE_UINT_DIGIT |
michael@0 | 220 | DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 |
michael@0 | 221 | MPI_SRCS += mpi_arm.c |
michael@0 | 222 | endif |
michael@0 | 223 | endif # Linux |
michael@0 | 224 | |
michael@0 | 225 | ifeq ($(OS_TARGET),AIX) |
michael@0 | 226 | DEFINES += -DMP_USE_UINT_DIGIT |
michael@0 | 227 | ifndef USE_64 |
michael@0 | 228 | DEFINES += -DMP_NO_DIV_WORD -DMP_NO_ADD_WORD -DMP_NO_SUB_WORD |
michael@0 | 229 | endif |
michael@0 | 230 | endif # AIX |
michael@0 | 231 | |
michael@0 | 232 | ifeq ($(OS_TARGET), HP-UX) |
michael@0 | 233 | ifneq ($(OS_TEST), ia64) |
michael@0 | 234 | # PA-RISC |
michael@0 | 235 | ASFILES += ret_cr16.s |
michael@0 | 236 | ifndef USE_64 |
michael@0 | 237 | FREEBL_BUILD_SINGLE_SHLIB = |
michael@0 | 238 | HAVE_ABI32_INT32 = 1 |
michael@0 | 239 | HAVE_ABI32_FPU = 1 |
michael@0 | 240 | endif |
michael@0 | 241 | ifdef FREEBL_CHILD_BUILD |
michael@0 | 242 | ifdef USE_ABI32_INT32 |
michael@0 | 243 | # build for DA1.1 (HP PA 1.1) 32-bit ABI build with 32-bit arithmetic |
michael@0 | 244 | DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD |
michael@0 | 245 | DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 |
michael@0 | 246 | else |
michael@0 | 247 | ifdef USE_64 |
michael@0 | 248 | # this builds for DA2.0W (HP PA 2.0 Wide), the LP64 ABI, using 64-bit digits |
michael@0 | 249 | MPI_SRCS += mpi_hp.c |
michael@0 | 250 | ASFILES += hpma512.s hppa20.s |
michael@0 | 251 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 252 | else |
michael@0 | 253 | # this builds for DA2.0 (HP PA 2.0 Narrow) ABI32_FPU model |
michael@0 | 254 | # (the 32-bit ABI with 64-bit registers) using 64-bit digits |
michael@0 | 255 | MPI_SRCS += mpi_hp.c |
michael@0 | 256 | ASFILES += hpma512.s hppa20.s |
michael@0 | 257 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 258 | ifndef NS_USE_GCC |
michael@0 | 259 | ARCHFLAG = -Aa +e +DA2.0 +DS2.0 |
michael@0 | 260 | endif |
michael@0 | 261 | endif |
michael@0 | 262 | endif |
michael@0 | 263 | endif |
michael@0 | 264 | endif |
michael@0 | 265 | endif |
michael@0 | 266 | |
michael@0 | 267 | # The blapi functions are defined not only in the freebl shared |
michael@0 | 268 | # libraries but also in the shared libraries linked with loader.c |
michael@0 | 269 | # (libsoftokn3.so and libssl3.so). We need to use GNU ld's |
michael@0 | 270 | # -Bsymbolic option or the equivalent option for other linkers |
michael@0 | 271 | # to bind the blapi function references in FREEBLVector vector |
michael@0 | 272 | # (ldvector.c) to the blapi functions defined in the freebl |
michael@0 | 273 | # shared libraries. |
michael@0 | 274 | ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) |
michael@0 | 275 | MKSHLIB += -Wl,-Bsymbolic |
michael@0 | 276 | endif |
michael@0 | 277 | |
michael@0 | 278 | ifeq ($(OS_TARGET),SunOS) |
michael@0 | 279 | |
michael@0 | 280 | ifdef NS_USE_GCC |
michael@0 | 281 | ifdef GCC_USE_GNU_LD |
michael@0 | 282 | MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text |
michael@0 | 283 | else |
michael@0 | 284 | MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text |
michael@0 | 285 | endif # GCC_USE_GNU_LD |
michael@0 | 286 | else |
michael@0 | 287 | MKSHLIB += -B symbolic -z now -z text |
michael@0 | 288 | endif # NS_USE_GCC |
michael@0 | 289 | |
michael@0 | 290 | # Sun's WorkShop defines v8, v8plus and v9 architectures. |
michael@0 | 291 | # gcc on Solaris defines v8 and v9 "cpus". |
michael@0 | 292 | # gcc's v9 is equivalent to Workshop's v8plus. |
michael@0 | 293 | # gcc's -m64 is equivalent to Workshop's v9 |
michael@0 | 294 | # We always use Sun's assembler, which uses Sun's naming convention. |
michael@0 | 295 | ifeq ($(CPU_ARCH),sparc) |
michael@0 | 296 | FREEBL_BUILD_SINGLE_SHLIB= |
michael@0 | 297 | ifdef USE_64 |
michael@0 | 298 | HAVE_ABI64_INT = 1 |
michael@0 | 299 | HAVE_ABI64_FPU = 1 |
michael@0 | 300 | else |
michael@0 | 301 | HAVE_ABI32_FPU = 1 |
michael@0 | 302 | HAVE_ABI32_INT64 = 1 |
michael@0 | 303 | endif |
michael@0 | 304 | SYSV_SPARC = 1 |
michael@0 | 305 | SOLARIS_AS = /usr/ccs/bin/as |
michael@0 | 306 | #### set arch, asm, c flags |
michael@0 | 307 | ifdef NS_USE_GCC |
michael@0 | 308 | ifdef USE_ABI32_INT64 |
michael@0 | 309 | ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus |
michael@0 | 310 | SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC |
michael@0 | 311 | endif |
michael@0 | 312 | ifdef USE_ABI32_FPU |
michael@0 | 313 | ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plusa |
michael@0 | 314 | SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC |
michael@0 | 315 | endif # USE_ABI32_FPU |
michael@0 | 316 | ifdef USE_ABI64_INT |
michael@0 | 317 | # this builds for Sparc v9a pure 64-bit architecture |
michael@0 | 318 | ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9 |
michael@0 | 319 | SOLARIS_AS_FLAGS = -xarch=v9 -K PIC |
michael@0 | 320 | endif |
michael@0 | 321 | ifdef USE_ABI64_FPU |
michael@0 | 322 | # this builds for Sparc v9a pure 64-bit architecture |
michael@0 | 323 | # It uses floating point, and 32-bit word size |
michael@0 | 324 | ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9a |
michael@0 | 325 | SOLARIS_AS_FLAGS = -xarch=v9a -K PIC |
michael@0 | 326 | endif |
michael@0 | 327 | else # NS_USE_GCC |
michael@0 | 328 | # FPU_TARGET_OPTIMIZER specifies the target processor and cache |
michael@0 | 329 | # properties of the ABI32_FPU and ABI64_FPU architectures for use |
michael@0 | 330 | # by the optimizer. |
michael@0 | 331 | ifeq (,$(findstring Sun WorkShop 6,$(shell $(CC) -V 2>&1))) |
michael@0 | 332 | # if the compiler is not Forte 6 |
michael@0 | 333 | FPU_TARGET_OPTIMIZER = -xcache=64/32/4:1024/64/4 -xchip=ultra3 |
michael@0 | 334 | else |
michael@0 | 335 | # Forte 6 C compiler generates incorrect code for rijndael.c |
michael@0 | 336 | # if -xchip=ultra3 is used (Bugzilla bug 333925). So we revert |
michael@0 | 337 | # to what we used in NSS 3.10. |
michael@0 | 338 | FPU_TARGET_OPTIMIZER = -xchip=ultra2 |
michael@0 | 339 | endif |
michael@0 | 340 | ifdef USE_ABI32_INT64 |
michael@0 | 341 | # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, |
michael@0 | 342 | # 32-bit ABI, it uses 64-bit words, integer arithmetic, |
michael@0 | 343 | # no FPU (non-VIS cpus). |
michael@0 | 344 | # These flags were suggested by the compiler group for building |
michael@0 | 345 | # with SunStudio 10. |
michael@0 | 346 | ifdef BUILD_OPT |
michael@0 | 347 | SOL_CFLAGS += -xO4 |
michael@0 | 348 | endif |
michael@0 | 349 | SOL_CFLAGS += -xtarget=generic |
michael@0 | 350 | ARCHFLAG = -xarch=v8plus |
michael@0 | 351 | SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC |
michael@0 | 352 | endif |
michael@0 | 353 | ifdef USE_ABI32_FPU |
michael@0 | 354 | # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, |
michael@0 | 355 | # 32-bit ABI, it uses FPU code, and 32-bit word size. |
michael@0 | 356 | # these flags were determined by running cc -### -fast and copying |
michael@0 | 357 | # the generated flag settings |
michael@0 | 358 | SOL_CFLAGS += -fsingle -xmemalign=8s |
michael@0 | 359 | ifdef BUILD_OPT |
michael@0 | 360 | SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 |
michael@0 | 361 | SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all |
michael@0 | 362 | SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend |
michael@0 | 363 | SOL_CFLAGS += -xlibmil -xO5 |
michael@0 | 364 | endif |
michael@0 | 365 | ARCHFLAG = -xarch=v8plusa |
michael@0 | 366 | SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC |
michael@0 | 367 | endif |
michael@0 | 368 | ifdef USE_ABI64_INT |
michael@0 | 369 | # this builds for Sparc v9a pure 64-bit architecture, |
michael@0 | 370 | # no FPU (non-VIS cpus). For building with SunStudio 10. |
michael@0 | 371 | ifdef BUILD_OPT |
michael@0 | 372 | SOL_CFLAGS += -xO4 |
michael@0 | 373 | endif |
michael@0 | 374 | SOL_CFLAGS += -xtarget=generic |
michael@0 | 375 | ARCHFLAG = -xarch=v9 |
michael@0 | 376 | SOLARIS_AS_FLAGS = -xarch=v9 -K PIC |
michael@0 | 377 | endif |
michael@0 | 378 | ifdef USE_ABI64_FPU |
michael@0 | 379 | # this builds for Sparc v9a pure 64-bit architecture |
michael@0 | 380 | # It uses floating point, and 32-bit word size. |
michael@0 | 381 | # See comment for USE_ABI32_FPU. |
michael@0 | 382 | SOL_CFLAGS += -fsingle -xmemalign=8s |
michael@0 | 383 | ifdef BUILD_OPT |
michael@0 | 384 | SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 |
michael@0 | 385 | SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all |
michael@0 | 386 | SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend |
michael@0 | 387 | SOL_CFLAGS += -xlibmil -xO5 |
michael@0 | 388 | endif |
michael@0 | 389 | ARCHFLAG = -xarch=v9a |
michael@0 | 390 | SOLARIS_AS_FLAGS = -xarch=v9a -K PIC |
michael@0 | 391 | endif |
michael@0 | 392 | endif # NS_USE_GCC |
michael@0 | 393 | |
michael@0 | 394 | ### set flags for both GCC and Sun cc |
michael@0 | 395 | ifdef USE_ABI32_INT64 |
michael@0 | 396 | # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, |
michael@0 | 397 | # 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU |
michael@0 | 398 | # best times are with no MP_ flags specified |
michael@0 | 399 | endif |
michael@0 | 400 | ifdef USE_ABI32_FPU |
michael@0 | 401 | # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, |
michael@0 | 402 | # 32-bit ABI, it uses FPU code, and 32-bit word size |
michael@0 | 403 | MPI_SRCS += mpi_sparc.c |
michael@0 | 404 | ASFILES = mpv_sparcv8.s montmulfv8.s |
michael@0 | 405 | DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY |
michael@0 | 406 | DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL |
michael@0 | 407 | ECL_USE_FP = 1 |
michael@0 | 408 | endif |
michael@0 | 409 | ifdef USE_ABI64_INT |
michael@0 | 410 | # this builds for Sparc v9a pure 64-bit architecture |
michael@0 | 411 | # best times are with no MP_ flags specified |
michael@0 | 412 | endif |
michael@0 | 413 | ifdef USE_ABI64_FPU |
michael@0 | 414 | # this builds for Sparc v9a pure 64-bit architecture |
michael@0 | 415 | # It uses floating point, and 32-bit word size |
michael@0 | 416 | MPI_SRCS += mpi_sparc.c |
michael@0 | 417 | ASFILES = mpv_sparcv9.s montmulfv9.s |
michael@0 | 418 | DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY |
michael@0 | 419 | DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL |
michael@0 | 420 | ECL_USE_FP = 1 |
michael@0 | 421 | endif |
michael@0 | 422 | |
michael@0 | 423 | else |
michael@0 | 424 | # Solaris for non-sparc family CPUs |
michael@0 | 425 | ifdef NS_USE_GCC |
michael@0 | 426 | LD = gcc |
michael@0 | 427 | AS = gcc |
michael@0 | 428 | ASFLAGS = -x assembler-with-cpp |
michael@0 | 429 | endif |
michael@0 | 430 | ifeq ($(USE_64),1) |
michael@0 | 431 | # Solaris for AMD64 |
michael@0 | 432 | ifdef NS_USE_GCC |
michael@0 | 433 | ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s |
michael@0 | 434 | ASFLAGS += -march=opteron -m64 -fPIC |
michael@0 | 435 | MPI_SRCS += mp_comba.c |
michael@0 | 436 | # comment the next four lines to turn off Intel HW acceleration |
michael@0 | 437 | ASFILES += intel-gcm.s |
michael@0 | 438 | EXTRA_SRCS += intel-gcm-wrap.c |
michael@0 | 439 | INTEL_GCM = 1 |
michael@0 | 440 | DEFINES += -DINTEL_GCM |
michael@0 | 441 | else |
michael@0 | 442 | ASFILES = arcfour-amd64-sun.s mpi_amd64_sun.s sha-fast-amd64-sun.s |
michael@0 | 443 | ASFILES += mp_comba_amd64_sun.s mpcpucache_amd64.s |
michael@0 | 444 | ASFLAGS += -xarch=generic64 -K PIC |
michael@0 | 445 | SOL_CFLAGS += -xprefetch=no |
michael@0 | 446 | SHA_SRCS = |
michael@0 | 447 | MPCPU_SRCS = |
michael@0 | 448 | # Intel acceleration for GCM does not build currently with Studio |
michael@0 | 449 | endif |
michael@0 | 450 | DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY |
michael@0 | 451 | DEFINES += -DNSS_USE_COMBA -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN |
michael@0 | 452 | # comment the next two lines to turn off Intel HW acceleration |
michael@0 | 453 | DEFINES += -DUSE_HW_AES |
michael@0 | 454 | ASFILES += intel-aes.s |
michael@0 | 455 | MPI_SRCS += mpi_amd64.c |
michael@0 | 456 | else |
michael@0 | 457 | # Solaris x86 |
michael@0 | 458 | DEFINES += -DMP_USE_UINT_DIGIT |
michael@0 | 459 | DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE |
michael@0 | 460 | DEFINES += -DMP_ASSEMBLY_DIV_2DX1D |
michael@0 | 461 | ASFILES = mpi_i86pc.s |
michael@0 | 462 | ifndef NS_USE_GCC |
michael@0 | 463 | MPCPU_SRCS = |
michael@0 | 464 | ASFILES += mpcpucache_x86.s |
michael@0 | 465 | endif |
michael@0 | 466 | endif |
michael@0 | 467 | endif # Solaris for non-sparc family CPUs |
michael@0 | 468 | endif # target == SunOS |
michael@0 | 469 | |
michael@0 | 470 | ifndef NSS_DISABLE_ECC |
michael@0 | 471 | ifdef ECL_USE_FP |
michael@0 | 472 | #enable floating point ECC code |
michael@0 | 473 | DEFINES += -DECL_USE_FP |
michael@0 | 474 | ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c |
michael@0 | 475 | ECL_HDRS += ecp_fp.h |
michael@0 | 476 | endif |
michael@0 | 477 | endif |
michael@0 | 478 | |
michael@0 | 479 | ####################################################################### |
michael@0 | 480 | # (5) Execute "global" rules. (OPTIONAL) # |
michael@0 | 481 | ####################################################################### |
michael@0 | 482 | |
michael@0 | 483 | include $(CORE_DEPTH)/coreconf/rules.mk |
michael@0 | 484 | |
michael@0 | 485 | ####################################################################### |
michael@0 | 486 | # (6) Execute "component" rules. (OPTIONAL) # |
michael@0 | 487 | ####################################################################### |
michael@0 | 488 | |
michael@0 | 489 | |
michael@0 | 490 | |
michael@0 | 491 | ####################################################################### |
michael@0 | 492 | # (7) Execute "local" rules. (OPTIONAL). # |
michael@0 | 493 | ####################################################################### |
michael@0 | 494 | |
michael@0 | 495 | export:: private_export |
michael@0 | 496 | |
michael@0 | 497 | rijndael_tables: |
michael@0 | 498 | $(CC) -o $(OBJDIR)/make_rijndael_tab rijndael_tables.c \ |
michael@0 | 499 | $(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a |
michael@0 | 500 | $(OBJDIR)/make_rijndael_tab |
michael@0 | 501 | |
michael@0 | 502 | vpath %.h mpi ecl |
michael@0 | 503 | vpath %.c mpi ecl |
michael@0 | 504 | vpath %.S mpi ecl |
michael@0 | 505 | vpath %.s mpi ecl |
michael@0 | 506 | vpath %.asm mpi ecl |
michael@0 | 507 | INCLUDES += -Impi -Iecl |
michael@0 | 508 | |
michael@0 | 509 | |
michael@0 | 510 | DEFINES += -DMP_API_COMPATIBLE |
michael@0 | 511 | |
michael@0 | 512 | MPI_USERS = dh.c pqg.c dsa.c rsa.c ec.c |
michael@0 | 513 | |
michael@0 | 514 | MPI_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_SRCS:.c=$(OBJ_SUFFIX))) |
michael@0 | 515 | MPI_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_USERS:.c=$(OBJ_SUFFIX))) |
michael@0 | 516 | |
michael@0 | 517 | $(MPI_OBJS): $(MPI_HDRS) |
michael@0 | 518 | |
michael@0 | 519 | ECL_USERS = ec.c |
michael@0 | 520 | |
michael@0 | 521 | ECL_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_SRCS:.c=$(OBJ_SUFFIX)) $(ECL_ASM_SRCS:$(ASM_SUFFIX)=$(OBJ_SUFFIX))) |
michael@0 | 522 | ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX))) |
michael@0 | 523 | |
michael@0 | 524 | $(ECL_OBJS): $(ECL_HDRS) |
michael@0 | 525 | |
michael@0 | 526 | |
michael@0 | 527 | |
michael@0 | 528 | $(OBJDIR)/sysrand$(OBJ_SUFFIX): sysrand.c unix_rand.c win_rand.c os2_rand.c |
michael@0 | 529 | |
michael@0 | 530 | $(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c |
michael@0 | 531 | |
michael@0 | 532 | $(OBJDIR)/ldvector$(OBJ_SUFFIX) $(OBJDIR)/loader$(OBJ_SUFFIX) : loader.h |
michael@0 | 533 | |
michael@0 | 534 | ifeq ($(SYSV_SPARC),1) |
michael@0 | 535 | |
michael@0 | 536 | $(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/mpv_sparcv8x.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s |
michael@0 | 537 | @$(MAKE_OBJDIR) |
michael@0 | 538 | $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< |
michael@0 | 539 | |
michael@0 | 540 | $(OBJDIR)/mpv_sparcv9.o $(OBJDIR)/montmulfv9.o : $(OBJDIR)/%.o : %.s |
michael@0 | 541 | @$(MAKE_OBJDIR) |
michael@0 | 542 | $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< |
michael@0 | 543 | |
michael@0 | 544 | $(OBJDIR)/mpmontg.o: mpmontg.c montmulf.h |
michael@0 | 545 | |
michael@0 | 546 | endif |
michael@0 | 547 | |
michael@0 | 548 | ifndef FREEBL_CHILD_BUILD |
michael@0 | 549 | |
michael@0 | 550 | # Parent build. This is where we decide which shared libraries to build |
michael@0 | 551 | |
michael@0 | 552 | ifdef FREEBL_BUILD_SINGLE_SHLIB |
michael@0 | 553 | |
michael@0 | 554 | ################### Single shared lib stuff ######################### |
michael@0 | 555 | SINGLE_SHLIB_DIR = $(OBJDIR)/$(OS_TARGET)_SINGLE_SHLIB |
michael@0 | 556 | ALL_TRASH += $(SINGLE_SHLIB_DIR) |
michael@0 | 557 | |
michael@0 | 558 | $(SINGLE_SHLIB_DIR): |
michael@0 | 559 | -mkdir $(SINGLE_SHLIB_DIR) |
michael@0 | 560 | |
michael@0 | 561 | release_md libs:: $(SINGLE_SHLIB_DIR) |
michael@0 | 562 | $(MAKE) FREEBL_CHILD_BUILD=1 \ |
michael@0 | 563 | OBJDIR=$(SINGLE_SHLIB_DIR) $@ |
michael@0 | 564 | ######################## common stuff ######################### |
michael@0 | 565 | |
michael@0 | 566 | endif |
michael@0 | 567 | |
michael@0 | 568 | # multiple shared libraries |
michael@0 | 569 | |
michael@0 | 570 | ######################## ABI32_FPU stuff ######################### |
michael@0 | 571 | ifdef HAVE_ABI32_FPU |
michael@0 | 572 | ABI32_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_FPU |
michael@0 | 573 | ALL_TRASH += $(ABI32_FPU_DIR) |
michael@0 | 574 | |
michael@0 | 575 | $(ABI32_FPU_DIR): |
michael@0 | 576 | -mkdir $(ABI32_FPU_DIR) |
michael@0 | 577 | |
michael@0 | 578 | release_md libs:: $(ABI32_FPU_DIR) |
michael@0 | 579 | $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_FPU=1 \ |
michael@0 | 580 | OBJDIR=$(ABI32_FPU_DIR) $@ |
michael@0 | 581 | endif |
michael@0 | 582 | |
michael@0 | 583 | ######################## ABI32_INT32 stuff ######################### |
michael@0 | 584 | ifdef HAVE_ABI32_INT32 |
michael@0 | 585 | ABI32_INT32_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT32 |
michael@0 | 586 | ALL_TRASH += $(ABI32_INT32_DIR) |
michael@0 | 587 | |
michael@0 | 588 | $(ABI32_INT32_DIR): |
michael@0 | 589 | -mkdir $(ABI32_INT32_DIR) |
michael@0 | 590 | |
michael@0 | 591 | release_md libs:: $(ABI32_INT32_DIR) |
michael@0 | 592 | $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT32=1 \ |
michael@0 | 593 | OBJDIR=$(ABI32_INT32_DIR) $@ |
michael@0 | 594 | endif |
michael@0 | 595 | |
michael@0 | 596 | ######################## ABI32_INT64 stuff ######################### |
michael@0 | 597 | ifdef HAVE_ABI32_INT64 |
michael@0 | 598 | ABI32_INT64_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT64 |
michael@0 | 599 | ALL_TRASH += $(ABI32_INT64_DIR) |
michael@0 | 600 | |
michael@0 | 601 | $(ABI32_INT64_DIR): |
michael@0 | 602 | -mkdir $(ABI32_INT64_DIR) |
michael@0 | 603 | |
michael@0 | 604 | release_md libs:: $(ABI32_INT64_DIR) |
michael@0 | 605 | $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT64=1\ |
michael@0 | 606 | OBJDIR=$(ABI32_INT64_DIR) $@ |
michael@0 | 607 | endif |
michael@0 | 608 | |
michael@0 | 609 | ######################## END of 32-bit stuff ######################### |
michael@0 | 610 | |
michael@0 | 611 | # above is 32-bit builds, below is 64-bit builds |
michael@0 | 612 | |
michael@0 | 613 | ######################## ABI64_FPU stuff ######################### |
michael@0 | 614 | ifdef HAVE_ABI64_FPU |
michael@0 | 615 | ABI64_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_FPU |
michael@0 | 616 | ALL_TRASH += $(ABI64_FPU_DIR) |
michael@0 | 617 | |
michael@0 | 618 | $(ABI64_FPU_DIR): |
michael@0 | 619 | -mkdir $(ABI64_FPU_DIR) |
michael@0 | 620 | |
michael@0 | 621 | release_md libs:: $(ABI64_FPU_DIR) |
michael@0 | 622 | $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_FPU=1 \ |
michael@0 | 623 | OBJDIR=$(ABI64_FPU_DIR) $@ |
michael@0 | 624 | endif |
michael@0 | 625 | |
michael@0 | 626 | ######################## ABI64_INT stuff ######################### |
michael@0 | 627 | ifdef HAVE_ABI64_INT |
michael@0 | 628 | ABI64_INT_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_INT |
michael@0 | 629 | ALL_TRASH += $(ABI64_INT_DIR) |
michael@0 | 630 | |
michael@0 | 631 | $(ABI64_INT_DIR): |
michael@0 | 632 | -mkdir $(ABI64_INT_DIR) |
michael@0 | 633 | |
michael@0 | 634 | release_md libs:: $(ABI64_INT_DIR) |
michael@0 | 635 | $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_INT=1 \ |
michael@0 | 636 | OBJDIR=$(ABI64_INT_DIR) $@ |
michael@0 | 637 | endif |
michael@0 | 638 | |
michael@0 | 639 | endif # FREEBL_CHILD_BUILD |
michael@0 | 640 | |
michael@0 | 641 | |
michael@0 | 642 | # Bugzilla Bug 333917: the non-x86 code in desblapi.c seems to violate |
michael@0 | 643 | # ANSI C's strict aliasing rules. |
michael@0 | 644 | ifeq ($(OS_TARGET),Linux) |
michael@0 | 645 | ifneq ($(CPU_ARCH),x86) |
michael@0 | 646 | $(OBJDIR)/$(PROG_PREFIX)desblapi$(OBJ_SUFFIX): desblapi.c |
michael@0 | 647 | @$(MAKE_OBJDIR) |
michael@0 | 648 | ifdef NEED_ABSOLUTE_PATH |
michael@0 | 649 | $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $(call core_abspath,$<) |
michael@0 | 650 | else |
michael@0 | 651 | $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $< |
michael@0 | 652 | endif |
michael@0 | 653 | endif |
michael@0 | 654 | endif |
michael@0 | 655 | |
michael@0 | 656 | ifdef INTEL_GCM |
michael@0 | 657 | # |
michael@0 | 658 | # GCM binary needs -mssse3 |
michael@0 | 659 | # |
michael@0 | 660 | $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 |
michael@0 | 661 | |
michael@0 | 662 | # The integrated assembler in Clang 3.2 does not support % in the |
michael@0 | 663 | # expression of a .set directive. intel-gcm.s uses .set to give |
michael@0 | 664 | # symbolic names to registers, for example, |
michael@0 | 665 | # .set Htbl, %rdi |
michael@0 | 666 | # So we can't use Clang's integrated assembler with intel-gcm.s. |
michael@0 | 667 | ifneq (,$(findstring clang,$(shell $(AS) --version))) |
michael@0 | 668 | $(OBJDIR)/$(PROG_PREFIX)intel-gcm$(OBJ_SUFFIX): ASFLAGS += -no-integrated-as |
michael@0 | 669 | endif |
michael@0 | 670 | endif |