security/nss/lib/freebl/Makefile

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial