michael@0: #! gmake michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ####################################################################### michael@0: # (1) Include initial platform-independent assignments (MANDATORY). # michael@0: ####################################################################### michael@0: michael@0: include manifest.mn michael@0: michael@0: ####################################################################### michael@0: # (2) Include "global" configuration information. (OPTIONAL) # michael@0: ####################################################################### michael@0: michael@0: include $(CORE_DEPTH)/coreconf/config.mk michael@0: michael@0: ####################################################################### michael@0: # (3) Include "component" configuration information. (OPTIONAL) # michael@0: ####################################################################### michael@0: michael@0: michael@0: michael@0: ####################################################################### michael@0: # (4) Include "local" platform-dependent assignments (OPTIONAL). # michael@0: ####################################################################### michael@0: michael@0: include config.mk michael@0: michael@0: # default for all platforms michael@0: # unset this on those that have multiple freebl libraries michael@0: FREEBL_BUILD_SINGLE_SHLIB = 1 michael@0: michael@0: ifdef USE_64 michael@0: DEFINES += -DNSS_USE_64 michael@0: endif michael@0: michael@0: ifdef USE_ABI32_FPU michael@0: DEFINES += -DNSS_USE_ABI32_FPU michael@0: endif michael@0: michael@0: ifeq ($(FREEBL_NO_DEPEND),1) michael@0: DEFINES += -DFREEBL_NO_DEPEND michael@0: STUBS_SRCS = stubs.c michael@0: endif michael@0: michael@0: ifeq ($(FREEBL_LOWHASH),1) michael@0: LOWHASH_SRCS = nsslowhash.c michael@0: LOWHASH_EXPORTS = nsslowhash.h michael@0: MAPFILE_SOURCE = freebl_hash.def michael@0: else michael@0: MAPFILE_SOURCE = freebl.def michael@0: endif michael@0: michael@0: # FREEBL_USE_PRELINK michael@0: # michael@0: # Most modern version of Linux support a speed optimization scheme where an michael@0: # application called prelink modifies programs and shared libraries to quickly michael@0: # load if they fit into an already designed address space. In short, prelink michael@0: # scans the list of programs and libraries on your system, assigns them a michael@0: # predefined space in the the address space, then provides the fixups to the michael@0: # library. michael@0: # michael@0: # The modification of the shared library is correctly detected by the freebl michael@0: # FIPS checksum scheme where we check a signed hash of the library against the michael@0: # library itself. michael@0: # michael@0: # The prelink command itself can reverse the process of modification and output michael@0: # the prestine shared library as it was before prelink made it's changes. michael@0: # This option tells Freebl could use prelink to output the original copy of michael@0: # the shared library before prelink modified it. michael@0: # michael@0: # FREEBL_PRELINK_COMMAND michael@0: # michael@0: # This is an optional environment variable which can override the default michael@0: # prelink command. It could be used on systems that did something similiar to michael@0: # prelink but used a different command and syntax. The only requirement is the michael@0: # program must take the library as the last argument, the program must output michael@0: # the original library to standard out, and the program does not need to take michael@0: # any quoted or imbedded spaces in its arguments (except the path to the michael@0: # library itself, which can have imbedded spaces or special characters). michael@0: # michael@0: ifdef FREEBL_USE_PRELINK michael@0: DEFINES += -DFREEBL_USE_PRELINK michael@0: ifdef LINUX michael@0: DEFINES += -D__GNU_SOURCE=1 michael@0: endif michael@0: endif michael@0: ifdef FREEBL_PRELINK_COMMAND michael@0: DEFINES +=-DFREEBL_PRELINK_COMMAND=\"$(FREEBL_PRELINK_COMMAND)\" michael@0: endif michael@0: # NSS_X86 means the target is a 32-bits x86 CPU architecture michael@0: # NSS_X64 means the target is a 64-bits 64 CPU architecture michael@0: # NSS_X86_OR_X64 means the target is either x86 or x64 michael@0: ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH))) michael@0: DEFINES += -DNSS_X86_OR_X64 michael@0: ifneq (,$(USE_64)$(USE_X32)) michael@0: DEFINES += -DNSS_X64 michael@0: else michael@0: DEFINES += -DNSS_X86 michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET),OSF1) michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD michael@0: MPI_SRCS += mpvalpha.c michael@0: endif michael@0: michael@0: ifeq (OS2,$(OS_TARGET)) michael@0: ASFILES = mpi_x86_os2.s michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_ASSEMBLY_DIV_2DX1D michael@0: DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD michael@0: DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN michael@0: endif michael@0: michael@0: ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) michael@0: ifndef USE_64 michael@0: # 32-bit Windows michael@0: ifdef NS_USE_GCC michael@0: # Ideally, we want to use assembler michael@0: # ASFILES = mpi_x86.s michael@0: # DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \ michael@0: # -DMP_ASSEMBLY_DIV_2DX1D michael@0: # but we haven't figured out how to make it work, so we are not michael@0: # using assembler right now. michael@0: ASFILES = michael@0: DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT michael@0: else michael@0: # MSVC michael@0: MPI_SRCS += mpi_x86_asm.c michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD michael@0: ifdef BUILD_OPT michael@0: OPTIMIZER += -Ox # maximum optimization for freebl michael@0: endif michael@0: # The Intel AES assembly code requires Visual C++ 2010. michael@0: # if $(_MSC_VER) >= 1600 (Visual C++ 2010) michael@0: ifeq ($(firstword $(sort $(_MSC_VER) 1600)),1600) michael@0: DEFINES += -DUSE_HW_AES -DINTEL_GCM michael@0: ASFILES += intel-aes-x86-masm.asm intel-gcm-x86-masm.asm michael@0: EXTRA_SRCS += intel-gcm-wrap.c michael@0: endif michael@0: endif michael@0: else michael@0: # -DMP_NO_MP_WORD michael@0: DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN michael@0: ifdef NS_USE_GCC michael@0: # Ideally, we should use amd64 assembly code, but it's not yet mingw-w64 michael@0: # compatible. michael@0: else michael@0: # MSVC michael@0: ifdef BUILD_OPT michael@0: OPTIMIZER += -Ox # maximum optimization for freebl michael@0: endif michael@0: ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm michael@0: DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY michael@0: DEFINES += -DNSS_USE_COMBA michael@0: # The Intel AES assembly code requires Visual C++ 2010 (10.0). The _xgetbv michael@0: # compiler intrinsic function requires Visual C++ 2010 (10.0) SP1. michael@0: ifeq ($(_MSC_VER_GE_10SP1),1) michael@0: DEFINES += -DUSE_HW_AES -DINTEL_GCM michael@0: ASFILES += intel-aes-x64-masm.asm intel-gcm-x64-masm.asm michael@0: EXTRA_SRCS += intel-gcm-wrap.c michael@0: endif michael@0: MPI_SRCS += mpi_amd64.c michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET),IRIX) michael@0: ifeq ($(USE_N32),1) michael@0: ASFILES = mpi_mips.s michael@0: ifeq ($(NS_USE_GCC),1) michael@0: ASFLAGS = -Wp,-P -Wp,-traditional -O -mips3 michael@0: else michael@0: ASFLAGS = -O -OPT:Olimit=4000 -dollar -fullwarn -xansi -n32 -mips3 michael@0: endif michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_USE_UINT_DIGIT michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET),Darwin) michael@0: ifeq ($(CPU_ARCH),x86) michael@0: ASFILES = mpi_sse2.s michael@0: DEFINES += -DMP_USE_UINT_DIGIT michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_ASSEMBLY_DIV_2DX1D michael@0: endif michael@0: endif # Darwin michael@0: michael@0: ifeq ($(OS_TARGET),Linux) michael@0: ifeq ($(CPU_ARCH),x86_64) michael@0: ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s michael@0: ASFLAGS += -fPIC -Wa,--noexecstack michael@0: DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY michael@0: DEFINES += -DNSS_USE_COMBA michael@0: DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN michael@0: # DEFINES += -DMPI_AMD64_ADD michael@0: # comment the next four lines to turn off Intel HW acceleration. michael@0: DEFINES += -DUSE_HW_AES -DINTEL_GCM michael@0: ASFILES += intel-aes.s intel-gcm.s michael@0: EXTRA_SRCS += intel-gcm-wrap.c michael@0: INTEL_GCM = 1 michael@0: MPI_SRCS += mpi_amd64.c mp_comba.c michael@0: endif michael@0: ifeq ($(CPU_ARCH),x86) michael@0: ASFILES = mpi_x86.s michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT michael@0: DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN michael@0: # The floating point ECC code doesn't work on Linux x86 (bug 311432). michael@0: #ECL_USE_FP = 1 michael@0: endif michael@0: ifeq ($(CPU_ARCH),arm) michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_USE_UINT_DIGIT michael@0: DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 michael@0: MPI_SRCS += mpi_arm.c michael@0: endif michael@0: endif # Linux michael@0: michael@0: ifeq ($(OS_TARGET),AIX) michael@0: DEFINES += -DMP_USE_UINT_DIGIT michael@0: ifndef USE_64 michael@0: DEFINES += -DMP_NO_DIV_WORD -DMP_NO_ADD_WORD -DMP_NO_SUB_WORD michael@0: endif michael@0: endif # AIX michael@0: michael@0: ifeq ($(OS_TARGET), HP-UX) michael@0: ifneq ($(OS_TEST), ia64) michael@0: # PA-RISC michael@0: ASFILES += ret_cr16.s michael@0: ifndef USE_64 michael@0: FREEBL_BUILD_SINGLE_SHLIB = michael@0: HAVE_ABI32_INT32 = 1 michael@0: HAVE_ABI32_FPU = 1 michael@0: endif michael@0: ifdef FREEBL_CHILD_BUILD michael@0: ifdef USE_ABI32_INT32 michael@0: # build for DA1.1 (HP PA 1.1) 32-bit ABI build with 32-bit arithmetic michael@0: DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD michael@0: DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 michael@0: else michael@0: ifdef USE_64 michael@0: # this builds for DA2.0W (HP PA 2.0 Wide), the LP64 ABI, using 64-bit digits michael@0: MPI_SRCS += mpi_hp.c michael@0: ASFILES += hpma512.s hppa20.s michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: else michael@0: # this builds for DA2.0 (HP PA 2.0 Narrow) ABI32_FPU model michael@0: # (the 32-bit ABI with 64-bit registers) using 64-bit digits michael@0: MPI_SRCS += mpi_hp.c michael@0: ASFILES += hpma512.s hppa20.s michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: ifndef NS_USE_GCC michael@0: ARCHFLAG = -Aa +e +DA2.0 +DS2.0 michael@0: endif michael@0: endif michael@0: endif michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: # The blapi functions are defined not only in the freebl shared michael@0: # libraries but also in the shared libraries linked with loader.c michael@0: # (libsoftokn3.so and libssl3.so). We need to use GNU ld's michael@0: # -Bsymbolic option or the equivalent option for other linkers michael@0: # to bind the blapi function references in FREEBLVector vector michael@0: # (ldvector.c) to the blapi functions defined in the freebl michael@0: # shared libraries. michael@0: ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) michael@0: MKSHLIB += -Wl,-Bsymbolic michael@0: endif michael@0: michael@0: ifeq ($(OS_TARGET),SunOS) michael@0: michael@0: ifdef NS_USE_GCC michael@0: ifdef GCC_USE_GNU_LD michael@0: MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text michael@0: else michael@0: MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text michael@0: endif # GCC_USE_GNU_LD michael@0: else michael@0: MKSHLIB += -B symbolic -z now -z text michael@0: endif # NS_USE_GCC michael@0: michael@0: # Sun's WorkShop defines v8, v8plus and v9 architectures. michael@0: # gcc on Solaris defines v8 and v9 "cpus". michael@0: # gcc's v9 is equivalent to Workshop's v8plus. michael@0: # gcc's -m64 is equivalent to Workshop's v9 michael@0: # We always use Sun's assembler, which uses Sun's naming convention. michael@0: ifeq ($(CPU_ARCH),sparc) michael@0: FREEBL_BUILD_SINGLE_SHLIB= michael@0: ifdef USE_64 michael@0: HAVE_ABI64_INT = 1 michael@0: HAVE_ABI64_FPU = 1 michael@0: else michael@0: HAVE_ABI32_FPU = 1 michael@0: HAVE_ABI32_INT64 = 1 michael@0: endif michael@0: SYSV_SPARC = 1 michael@0: SOLARIS_AS = /usr/ccs/bin/as michael@0: #### set arch, asm, c flags michael@0: ifdef NS_USE_GCC michael@0: ifdef USE_ABI32_INT64 michael@0: ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus michael@0: SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC michael@0: endif michael@0: ifdef USE_ABI32_FPU michael@0: ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plusa michael@0: SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC michael@0: endif # USE_ABI32_FPU michael@0: ifdef USE_ABI64_INT michael@0: # this builds for Sparc v9a pure 64-bit architecture michael@0: ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9 michael@0: SOLARIS_AS_FLAGS = -xarch=v9 -K PIC michael@0: endif michael@0: ifdef USE_ABI64_FPU michael@0: # this builds for Sparc v9a pure 64-bit architecture michael@0: # It uses floating point, and 32-bit word size michael@0: ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9a michael@0: SOLARIS_AS_FLAGS = -xarch=v9a -K PIC michael@0: endif michael@0: else # NS_USE_GCC michael@0: # FPU_TARGET_OPTIMIZER specifies the target processor and cache michael@0: # properties of the ABI32_FPU and ABI64_FPU architectures for use michael@0: # by the optimizer. michael@0: ifeq (,$(findstring Sun WorkShop 6,$(shell $(CC) -V 2>&1))) michael@0: # if the compiler is not Forte 6 michael@0: FPU_TARGET_OPTIMIZER = -xcache=64/32/4:1024/64/4 -xchip=ultra3 michael@0: else michael@0: # Forte 6 C compiler generates incorrect code for rijndael.c michael@0: # if -xchip=ultra3 is used (Bugzilla bug 333925). So we revert michael@0: # to what we used in NSS 3.10. michael@0: FPU_TARGET_OPTIMIZER = -xchip=ultra2 michael@0: endif michael@0: ifdef USE_ABI32_INT64 michael@0: # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, michael@0: # 32-bit ABI, it uses 64-bit words, integer arithmetic, michael@0: # no FPU (non-VIS cpus). michael@0: # These flags were suggested by the compiler group for building michael@0: # with SunStudio 10. michael@0: ifdef BUILD_OPT michael@0: SOL_CFLAGS += -xO4 michael@0: endif michael@0: SOL_CFLAGS += -xtarget=generic michael@0: ARCHFLAG = -xarch=v8plus michael@0: SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC michael@0: endif michael@0: ifdef USE_ABI32_FPU michael@0: # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, michael@0: # 32-bit ABI, it uses FPU code, and 32-bit word size. michael@0: # these flags were determined by running cc -### -fast and copying michael@0: # the generated flag settings michael@0: SOL_CFLAGS += -fsingle -xmemalign=8s michael@0: ifdef BUILD_OPT michael@0: SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 michael@0: SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all michael@0: SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend michael@0: SOL_CFLAGS += -xlibmil -xO5 michael@0: endif michael@0: ARCHFLAG = -xarch=v8plusa michael@0: SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC michael@0: endif michael@0: ifdef USE_ABI64_INT michael@0: # this builds for Sparc v9a pure 64-bit architecture, michael@0: # no FPU (non-VIS cpus). For building with SunStudio 10. michael@0: ifdef BUILD_OPT michael@0: SOL_CFLAGS += -xO4 michael@0: endif michael@0: SOL_CFLAGS += -xtarget=generic michael@0: ARCHFLAG = -xarch=v9 michael@0: SOLARIS_AS_FLAGS = -xarch=v9 -K PIC michael@0: endif michael@0: ifdef USE_ABI64_FPU michael@0: # this builds for Sparc v9a pure 64-bit architecture michael@0: # It uses floating point, and 32-bit word size. michael@0: # See comment for USE_ABI32_FPU. michael@0: SOL_CFLAGS += -fsingle -xmemalign=8s michael@0: ifdef BUILD_OPT michael@0: SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 michael@0: SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all michael@0: SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend michael@0: SOL_CFLAGS += -xlibmil -xO5 michael@0: endif michael@0: ARCHFLAG = -xarch=v9a michael@0: SOLARIS_AS_FLAGS = -xarch=v9a -K PIC michael@0: endif michael@0: endif # NS_USE_GCC michael@0: michael@0: ### set flags for both GCC and Sun cc michael@0: ifdef USE_ABI32_INT64 michael@0: # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, michael@0: # 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU michael@0: # best times are with no MP_ flags specified michael@0: endif michael@0: ifdef USE_ABI32_FPU michael@0: # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, michael@0: # 32-bit ABI, it uses FPU code, and 32-bit word size michael@0: MPI_SRCS += mpi_sparc.c michael@0: ASFILES = mpv_sparcv8.s montmulfv8.s michael@0: DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY michael@0: DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL michael@0: ECL_USE_FP = 1 michael@0: endif michael@0: ifdef USE_ABI64_INT michael@0: # this builds for Sparc v9a pure 64-bit architecture michael@0: # best times are with no MP_ flags specified michael@0: endif michael@0: ifdef USE_ABI64_FPU michael@0: # this builds for Sparc v9a pure 64-bit architecture michael@0: # It uses floating point, and 32-bit word size michael@0: MPI_SRCS += mpi_sparc.c michael@0: ASFILES = mpv_sparcv9.s montmulfv9.s michael@0: DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY michael@0: DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL michael@0: ECL_USE_FP = 1 michael@0: endif michael@0: michael@0: else michael@0: # Solaris for non-sparc family CPUs michael@0: ifdef NS_USE_GCC michael@0: LD = gcc michael@0: AS = gcc michael@0: ASFLAGS = -x assembler-with-cpp michael@0: endif michael@0: ifeq ($(USE_64),1) michael@0: # Solaris for AMD64 michael@0: ifdef NS_USE_GCC michael@0: ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s michael@0: ASFLAGS += -march=opteron -m64 -fPIC michael@0: MPI_SRCS += mp_comba.c michael@0: # comment the next four lines to turn off Intel HW acceleration michael@0: ASFILES += intel-gcm.s michael@0: EXTRA_SRCS += intel-gcm-wrap.c michael@0: INTEL_GCM = 1 michael@0: DEFINES += -DINTEL_GCM michael@0: else michael@0: ASFILES = arcfour-amd64-sun.s mpi_amd64_sun.s sha-fast-amd64-sun.s michael@0: ASFILES += mp_comba_amd64_sun.s mpcpucache_amd64.s michael@0: ASFLAGS += -xarch=generic64 -K PIC michael@0: SOL_CFLAGS += -xprefetch=no michael@0: SHA_SRCS = michael@0: MPCPU_SRCS = michael@0: # Intel acceleration for GCM does not build currently with Studio michael@0: endif michael@0: DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY michael@0: DEFINES += -DNSS_USE_COMBA -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN michael@0: # comment the next two lines to turn off Intel HW acceleration michael@0: DEFINES += -DUSE_HW_AES michael@0: ASFILES += intel-aes.s michael@0: MPI_SRCS += mpi_amd64.c michael@0: else michael@0: # Solaris x86 michael@0: DEFINES += -DMP_USE_UINT_DIGIT michael@0: DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE michael@0: DEFINES += -DMP_ASSEMBLY_DIV_2DX1D michael@0: ASFILES = mpi_i86pc.s michael@0: ifndef NS_USE_GCC michael@0: MPCPU_SRCS = michael@0: ASFILES += mpcpucache_x86.s michael@0: endif michael@0: endif michael@0: endif # Solaris for non-sparc family CPUs michael@0: endif # target == SunOS michael@0: michael@0: ifndef NSS_DISABLE_ECC michael@0: ifdef ECL_USE_FP michael@0: #enable floating point ECC code michael@0: DEFINES += -DECL_USE_FP michael@0: ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c michael@0: ECL_HDRS += ecp_fp.h michael@0: endif michael@0: endif michael@0: michael@0: ####################################################################### michael@0: # (5) Execute "global" rules. (OPTIONAL) # michael@0: ####################################################################### michael@0: michael@0: include $(CORE_DEPTH)/coreconf/rules.mk michael@0: michael@0: ####################################################################### michael@0: # (6) Execute "component" rules. (OPTIONAL) # michael@0: ####################################################################### michael@0: michael@0: michael@0: michael@0: ####################################################################### michael@0: # (7) Execute "local" rules. (OPTIONAL). # michael@0: ####################################################################### michael@0: michael@0: export:: private_export michael@0: michael@0: rijndael_tables: michael@0: $(CC) -o $(OBJDIR)/make_rijndael_tab rijndael_tables.c \ michael@0: $(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a michael@0: $(OBJDIR)/make_rijndael_tab michael@0: michael@0: vpath %.h mpi ecl michael@0: vpath %.c mpi ecl michael@0: vpath %.S mpi ecl michael@0: vpath %.s mpi ecl michael@0: vpath %.asm mpi ecl michael@0: INCLUDES += -Impi -Iecl michael@0: michael@0: michael@0: DEFINES += -DMP_API_COMPATIBLE michael@0: michael@0: MPI_USERS = dh.c pqg.c dsa.c rsa.c ec.c michael@0: michael@0: MPI_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_SRCS:.c=$(OBJ_SUFFIX))) michael@0: MPI_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_USERS:.c=$(OBJ_SUFFIX))) michael@0: michael@0: $(MPI_OBJS): $(MPI_HDRS) michael@0: michael@0: ECL_USERS = ec.c michael@0: michael@0: ECL_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_SRCS:.c=$(OBJ_SUFFIX)) $(ECL_ASM_SRCS:$(ASM_SUFFIX)=$(OBJ_SUFFIX))) michael@0: ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX))) michael@0: michael@0: $(ECL_OBJS): $(ECL_HDRS) michael@0: michael@0: michael@0: michael@0: $(OBJDIR)/sysrand$(OBJ_SUFFIX): sysrand.c unix_rand.c win_rand.c os2_rand.c michael@0: michael@0: $(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c michael@0: michael@0: $(OBJDIR)/ldvector$(OBJ_SUFFIX) $(OBJDIR)/loader$(OBJ_SUFFIX) : loader.h michael@0: michael@0: ifeq ($(SYSV_SPARC),1) michael@0: michael@0: $(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/mpv_sparcv8x.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s michael@0: @$(MAKE_OBJDIR) michael@0: $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< michael@0: michael@0: $(OBJDIR)/mpv_sparcv9.o $(OBJDIR)/montmulfv9.o : $(OBJDIR)/%.o : %.s michael@0: @$(MAKE_OBJDIR) michael@0: $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< michael@0: michael@0: $(OBJDIR)/mpmontg.o: mpmontg.c montmulf.h michael@0: michael@0: endif michael@0: michael@0: ifndef FREEBL_CHILD_BUILD michael@0: michael@0: # Parent build. This is where we decide which shared libraries to build michael@0: michael@0: ifdef FREEBL_BUILD_SINGLE_SHLIB michael@0: michael@0: ################### Single shared lib stuff ######################### michael@0: SINGLE_SHLIB_DIR = $(OBJDIR)/$(OS_TARGET)_SINGLE_SHLIB michael@0: ALL_TRASH += $(SINGLE_SHLIB_DIR) michael@0: michael@0: $(SINGLE_SHLIB_DIR): michael@0: -mkdir $(SINGLE_SHLIB_DIR) michael@0: michael@0: release_md libs:: $(SINGLE_SHLIB_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 \ michael@0: OBJDIR=$(SINGLE_SHLIB_DIR) $@ michael@0: ######################## common stuff ######################### michael@0: michael@0: endif michael@0: michael@0: # multiple shared libraries michael@0: michael@0: ######################## ABI32_FPU stuff ######################### michael@0: ifdef HAVE_ABI32_FPU michael@0: ABI32_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_FPU michael@0: ALL_TRASH += $(ABI32_FPU_DIR) michael@0: michael@0: $(ABI32_FPU_DIR): michael@0: -mkdir $(ABI32_FPU_DIR) michael@0: michael@0: release_md libs:: $(ABI32_FPU_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_FPU=1 \ michael@0: OBJDIR=$(ABI32_FPU_DIR) $@ michael@0: endif michael@0: michael@0: ######################## ABI32_INT32 stuff ######################### michael@0: ifdef HAVE_ABI32_INT32 michael@0: ABI32_INT32_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT32 michael@0: ALL_TRASH += $(ABI32_INT32_DIR) michael@0: michael@0: $(ABI32_INT32_DIR): michael@0: -mkdir $(ABI32_INT32_DIR) michael@0: michael@0: release_md libs:: $(ABI32_INT32_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT32=1 \ michael@0: OBJDIR=$(ABI32_INT32_DIR) $@ michael@0: endif michael@0: michael@0: ######################## ABI32_INT64 stuff ######################### michael@0: ifdef HAVE_ABI32_INT64 michael@0: ABI32_INT64_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT64 michael@0: ALL_TRASH += $(ABI32_INT64_DIR) michael@0: michael@0: $(ABI32_INT64_DIR): michael@0: -mkdir $(ABI32_INT64_DIR) michael@0: michael@0: release_md libs:: $(ABI32_INT64_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT64=1\ michael@0: OBJDIR=$(ABI32_INT64_DIR) $@ michael@0: endif michael@0: michael@0: ######################## END of 32-bit stuff ######################### michael@0: michael@0: # above is 32-bit builds, below is 64-bit builds michael@0: michael@0: ######################## ABI64_FPU stuff ######################### michael@0: ifdef HAVE_ABI64_FPU michael@0: ABI64_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_FPU michael@0: ALL_TRASH += $(ABI64_FPU_DIR) michael@0: michael@0: $(ABI64_FPU_DIR): michael@0: -mkdir $(ABI64_FPU_DIR) michael@0: michael@0: release_md libs:: $(ABI64_FPU_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_FPU=1 \ michael@0: OBJDIR=$(ABI64_FPU_DIR) $@ michael@0: endif michael@0: michael@0: ######################## ABI64_INT stuff ######################### michael@0: ifdef HAVE_ABI64_INT michael@0: ABI64_INT_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_INT michael@0: ALL_TRASH += $(ABI64_INT_DIR) michael@0: michael@0: $(ABI64_INT_DIR): michael@0: -mkdir $(ABI64_INT_DIR) michael@0: michael@0: release_md libs:: $(ABI64_INT_DIR) michael@0: $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_INT=1 \ michael@0: OBJDIR=$(ABI64_INT_DIR) $@ michael@0: endif michael@0: michael@0: endif # FREEBL_CHILD_BUILD michael@0: michael@0: michael@0: # Bugzilla Bug 333917: the non-x86 code in desblapi.c seems to violate michael@0: # ANSI C's strict aliasing rules. michael@0: ifeq ($(OS_TARGET),Linux) michael@0: ifneq ($(CPU_ARCH),x86) michael@0: $(OBJDIR)/$(PROG_PREFIX)desblapi$(OBJ_SUFFIX): desblapi.c michael@0: @$(MAKE_OBJDIR) michael@0: ifdef NEED_ABSOLUTE_PATH michael@0: $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $(call core_abspath,$<) michael@0: else michael@0: $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $< michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: ifdef INTEL_GCM michael@0: # michael@0: # GCM binary needs -mssse3 michael@0: # michael@0: $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 michael@0: michael@0: # The integrated assembler in Clang 3.2 does not support % in the michael@0: # expression of a .set directive. intel-gcm.s uses .set to give michael@0: # symbolic names to registers, for example, michael@0: # .set Htbl, %rdi michael@0: # So we can't use Clang's integrated assembler with intel-gcm.s. michael@0: ifneq (,$(findstring clang,$(shell $(AS) --version))) michael@0: $(OBJDIR)/$(PROG_PREFIX)intel-gcm$(OBJ_SUFFIX): ASFLAGS += -no-integrated-as michael@0: endif michael@0: endif