xref: /illumos-gate/usr/src/uts/intel/bignum/Makefile (revision d17be682a2c70b4505d43c830bbd2603da11918d)
1b60f2a0bSfr41279#
2b60f2a0bSfr41279# CDDL HEADER START
3b60f2a0bSfr41279#
4b60f2a0bSfr41279# The contents of this file are subject to the terms of the
5b60f2a0bSfr41279# Common Development and Distribution License (the "License").
6b60f2a0bSfr41279# You may not use this file except in compliance with the License.
7b60f2a0bSfr41279#
8b60f2a0bSfr41279# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9b60f2a0bSfr41279# or http://www.opensolaris.org/os/licensing.
10b60f2a0bSfr41279# See the License for the specific language governing permissions
11b60f2a0bSfr41279# and limitations under the License.
12b60f2a0bSfr41279#
13b60f2a0bSfr41279# When distributing Covered Code, include this CDDL HEADER in each
14b60f2a0bSfr41279# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15b60f2a0bSfr41279# If applicable, add the following below this CDDL HEADER, with the
16b60f2a0bSfr41279# fields enclosed by brackets "[]" replaced with your own identifying
17b60f2a0bSfr41279# information: Portions Copyright [yyyy] [name of copyright owner]
18b60f2a0bSfr41279#
19b60f2a0bSfr41279# CDDL HEADER END
20b60f2a0bSfr41279#
213eca6103SJohn Levon# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
223eca6103SJohn Levon# Use is subject to license terms.
23b60f2a0bSfr41279#
2432e0ab73SMisaki Miyashita# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25b60f2a0bSfr41279#
263eca6103SJohn Levon# Copyright (c) 2019, Joyent, Inc.
27b60f2a0bSfr41279#
28b60f2a0bSfr41279
29b60f2a0bSfr41279#
30b60f2a0bSfr41279#	Path to the base of the uts directory tree (usually /usr/src/uts).
31b60f2a0bSfr41279#
32b60f2a0bSfr41279UTSBASE	= ../..
33b60f2a0bSfr41279BIGNUMDIR = $(COMMONBASE)/bignum
3432e0ab73SMisaki MiyashitaCRYPTODIR = $(COMMONBASE)/crypto
35b60f2a0bSfr41279
36b60f2a0bSfr41279#
37b60f2a0bSfr41279#	Define the module and object file sets.
38b60f2a0bSfr41279#
39b60f2a0bSfr41279MODULE		= bignum
40b60f2a0bSfr41279OBJECTS		= $(BIGNUM_OBJS:%=$(OBJS_DIR)/%)
41b60f2a0bSfr41279ROOTMODULE	= $(ROOT_MISC_DIR)/$(MODULE)
42b60f2a0bSfr41279
433eca6103SJohn LevonBIGNUM_PSR_OBJS = bignum_amd64.o bignum_amd64_asm.o
44b60f2a0bSfr41279
45b60f2a0bSfr41279#
46b60f2a0bSfr41279#	Include common rules.
47b60f2a0bSfr41279#
48b60f2a0bSfr41279include $(UTSBASE)/intel/Makefile.intel
49b60f2a0bSfr41279
50b60f2a0bSfr41279#
51b60f2a0bSfr41279#	Define targets
52b60f2a0bSfr41279#
53b60f2a0bSfr41279ALL_TARGET	= $(BINARY)
54b60f2a0bSfr41279INSTALL_TARGET	= $(BINARY) $(ROOTMODULE)
55b60f2a0bSfr41279
56b60f2a0bSfr41279#
57b60f2a0bSfr41279# Linkage dependencies
58b60f2a0bSfr41279#
5982d0151aSRichard LoweLDFLAGS += -Nmisc/kcf
60b60f2a0bSfr41279
6132e0ab73SMisaki MiyashitaCPPFLAGS	+= -I$(BIGNUMDIR) -I$(CRYPTODIR)
62b60f2a0bSfr41279
63b60f2a0bSfr41279#
64b60f2a0bSfr41279#	Default build targets.
65b60f2a0bSfr41279#
66b60f2a0bSfr41279.KEEP_STATE:
67b60f2a0bSfr41279
68b60f2a0bSfr41279def:		$(DEF_DEPS)
69b60f2a0bSfr41279
70b60f2a0bSfr41279all:		$(ALL_DEPS)
71b60f2a0bSfr41279
72b60f2a0bSfr41279clean:		$(CLEAN_DEPS)
73b60f2a0bSfr41279
74b60f2a0bSfr41279clobber:	$(CLOBBER_DEPS)
75b60f2a0bSfr41279
76b60f2a0bSfr41279install:	$(INSTALL_DEPS)
77b60f2a0bSfr41279
78b60f2a0bSfr41279#
79b60f2a0bSfr41279#	Include common targets.
80b60f2a0bSfr41279#
81b60f2a0bSfr41279include $(UTSBASE)/intel/Makefile.targ
82b60f2a0bSfr41279
833eca6103SJohn Levon# Bignum configuration (BIGNUM_CFG):
843eca6103SJohn Levon#   PSR_MUL:
853eca6103SJohn Levon#       There is a processor-specific implementation bignum multiply functions
863eca6103SJohn Levon#   HWCAP:
873eca6103SJohn Levon#       There are multiple implementations of bignum functions, and the
883eca6103SJohn Levon#	appropriate one must be chosen at run time, based on testing
893eca6103SJohn Levon#	hardware capabilites.
903eca6103SJohn Levon#
913eca6103SJohn Levon# -DPSR_MUL:
923eca6103SJohn Levon# For AMD64, there is a processor-specific implementation of
933eca6103SJohn Levon# the bignum multiply functions, which takes advantage of the
943eca6103SJohn Levon# 64x64->128 bit multiply instruction.
953eca6103SJohn Levon#
963eca6103SJohn Levon# -UHWCAP:
973eca6103SJohn Levon# There is only one implementation, because the 128 bit multiply using
983eca6103SJohn Levon# general-purpose registers is faster than any MMX or SSE2 implementation.
99b60f2a0bSfr41279
1003eca6103SJohn LevonBIGNUM_CFG = -DPSR_MUL
101*d17be682SRichard LoweCFLAGS	+= -xO4
1020aaef2f5SRichard Lowe$(OBJS_DIR)/bignumimpl.o := CPPFLAGS += $(BIGNUM_CFG)
1030aaef2f5SRichard Lowe$(OBJS_DIR)/bignum_amd64.o := CPPFLAGS += $(BIGNUM_CFG)
1043eca6103SJohn Levon
1053eca6103SJohn Levon$(OBJS_DIR)/bignum_amd64.o: $(BIGNUMDIR)/amd64/bignum_amd64.c
1063eca6103SJohn Levon	$(COMPILE.c) -o $@ $(BIGNUM_CFG) $(BIGNUMDIR)/amd64/bignum_amd64.c
1073eca6103SJohn Levon	$(CTFCONVERT_O)
1083eca6103SJohn Levon
1095d9d9091SRichard Lowe$(OBJS_DIR)/bignum_amd64_asm.o: $(BIGNUMDIR)/amd64/bignum_amd64_asm.S
1105d9d9091SRichard Lowe	$(COMPILE.s) -c -o $@ $(BIGNUM_CFG) \
1115d9d9091SRichard Lowe		$(BIGNUMDIR)/amd64/bignum_amd64_asm.S
112