xref: /illumos-gate/usr/src/uts/intel/bignum/Makefile (revision 3eca610387779e26c8c63e26d2ba418b0cd1bf5a)
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#
21*3eca6103SJohn Levon# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
22*3eca6103SJohn Levon# Use is subject to license terms.
23b60f2a0bSfr41279#
2432e0ab73SMisaki Miyashita# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25b60f2a0bSfr41279#
26*3eca6103SJohn 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)/%)
41b60f2a0bSfr41279LINTS		= $(BIGNUM_OBJS:%.o=$(LINTS_DIR)/%.ln)
42b60f2a0bSfr41279ROOTMODULE	= $(ROOT_MISC_DIR)/$(MODULE)
43b60f2a0bSfr41279
44*3eca6103SJohn LevonBIGNUM_PSR_OBJS = bignum_amd64.o bignum_amd64_asm.o
45b60f2a0bSfr41279
46b60f2a0bSfr41279#
47b60f2a0bSfr41279#	Include common rules.
48b60f2a0bSfr41279#
49b60f2a0bSfr41279include $(UTSBASE)/intel/Makefile.intel
50b60f2a0bSfr41279
51b60f2a0bSfr41279#
52b60f2a0bSfr41279#	Define targets
53b60f2a0bSfr41279#
54b60f2a0bSfr41279ALL_TARGET	= $(BINARY)
55b60f2a0bSfr41279LINT_TARGET	= $(MODULE).lint
56b60f2a0bSfr41279INSTALL_TARGET	= $(BINARY) $(ROOTMODULE)
57b60f2a0bSfr41279
58b60f2a0bSfr41279#
59b60f2a0bSfr41279# Linkage dependencies
60b60f2a0bSfr41279#
6132e0ab73SMisaki MiyashitaLDFLAGS += -dy -Nmisc/kcf
62b60f2a0bSfr41279
6332e0ab73SMisaki MiyashitaCPPFLAGS	+= -I$(BIGNUMDIR) -I$(CRYPTODIR)
64b60f2a0bSfr41279
65b60f2a0bSfr41279#
66b60f2a0bSfr41279#	Default build targets.
67b60f2a0bSfr41279#
68b60f2a0bSfr41279.KEEP_STATE:
69b60f2a0bSfr41279
70b60f2a0bSfr41279def:		$(DEF_DEPS)
71b60f2a0bSfr41279
72b60f2a0bSfr41279all:		$(ALL_DEPS)
73b60f2a0bSfr41279
74b60f2a0bSfr41279clean:		$(CLEAN_DEPS)
75b60f2a0bSfr41279
76b60f2a0bSfr41279clobber:	$(CLOBBER_DEPS)
77b60f2a0bSfr41279
78b60f2a0bSfr41279lint:		$(LINT_DEPS)
79b60f2a0bSfr41279
80b60f2a0bSfr41279modlintlib:	$(MODLINTLIB_DEPS)
81b60f2a0bSfr41279
82b60f2a0bSfr41279clean.lint:	$(CLEAN_LINT_DEPS)
83b60f2a0bSfr41279
84b60f2a0bSfr41279install:	$(INSTALL_DEPS)
85b60f2a0bSfr41279
86b60f2a0bSfr41279#
87b60f2a0bSfr41279#	Include common targets.
88b60f2a0bSfr41279#
89b60f2a0bSfr41279include $(UTSBASE)/intel/Makefile.targ
90b60f2a0bSfr41279
91*3eca6103SJohn Levon# Bignum configuration (BIGNUM_CFG):
92*3eca6103SJohn Levon#   PSR_MUL:
93*3eca6103SJohn Levon#       There is a processor-specific implementation bignum multiply functions
94*3eca6103SJohn Levon#   HWCAP:
95*3eca6103SJohn Levon#       There are multiple implementations of bignum functions, and the
96*3eca6103SJohn Levon#	appropriate one must be chosen at run time, based on testing
97*3eca6103SJohn Levon#	hardware capabilites.
98*3eca6103SJohn Levon#
99*3eca6103SJohn Levon# -DPSR_MUL:
100*3eca6103SJohn Levon# For AMD64, there is a processor-specific implementation of
101*3eca6103SJohn Levon# the bignum multiply functions, which takes advantage of the
102*3eca6103SJohn Levon# 64x64->128 bit multiply instruction.
103*3eca6103SJohn Levon#
104*3eca6103SJohn Levon# -UHWCAP:
105*3eca6103SJohn Levon# There is only one implementation, because the 128 bit multiply using
106*3eca6103SJohn Levon# general-purpose registers is faster than any MMX or SSE2 implementation.
107b60f2a0bSfr41279
108*3eca6103SJohn LevonBIGNUM_CFG = -DPSR_MUL
109*3eca6103SJohn LevonCFLAGS	+= -xO4 -xcrossfile
110*3eca6103SJohn Levon$(OBJS_DIR)/bignumimpl.o $(LINTS_DIR)/bignumimpl.ln := \
111*3eca6103SJohn Levon	CPPFLAGS += $(BIGNUM_CFG)
112*3eca6103SJohn Levon$(OBJS_DIR)/bignum_amd64.o $(LINTS_DIR)/bignum_amd64.ln := \
113*3eca6103SJohn Levon	CPPFLAGS += $(BIGNUM_CFG)
114*3eca6103SJohn Levon
115*3eca6103SJohn Levon$(OBJS_DIR)/bignum_amd64.o: $(BIGNUMDIR)/amd64/bignum_amd64.c
116*3eca6103SJohn Levon	$(COMPILE.c) -o $@ $(BIGNUM_CFG) $(BIGNUMDIR)/amd64/bignum_amd64.c
117*3eca6103SJohn Levon	$(CTFCONVERT_O)
118*3eca6103SJohn Levon
119*3eca6103SJohn Levon$(OBJS_DIR)/bignum_amd64_asm.o: $(BIGNUMDIR)/amd64/bignum_amd64_asm.s
120*3eca6103SJohn Levon	$(COMPILE.s) -P -o $@ $(BIGNUM_CFG) \
121*3eca6103SJohn Levon		$(BIGNUMDIR)/amd64/bignum_amd64_asm.s
122*3eca6103SJohn Levon
123*3eca6103SJohn Levon$(LINTS_DIR)/bignum_amd64.ln: $(BIGNUMDIR)/amd64/bignum_amd64.c
124*3eca6103SJohn Levon	@($(LHEAD) $(LINT.c) $(BIGNUMDIR)/amd64/bignum_amd64.c $(LTAIL))
125*3eca6103SJohn Levon
126*3eca6103SJohn Levon$(LINTS_DIR)/bignum_amd64_asm.ln: $(BIGNUMDIR)/amd64/bignum_amd64_asm.s
127*3eca6103SJohn Levon	@($(LHEAD) $(LINT.s) $(BIGNUMDIR)/amd64/bignum_amd64_asm.s $(LTAIL))
128