xref: /illumos-gate/usr/src/uts/intel/sha2/Makefile (revision d6004f2d6507e58bb1cb59ab594185cfe4214f85)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2019, Joyent, Inc.
26# Copyright 2026 Gernot Strasser
27
28#
29#	Path to the base of the uts directory tree (usually /usr/src/uts).
30#
31UTSBASE	= ../..
32COMDIR	= $(COMMONBASE)/crypto
33
34#
35#	Define the module and object file sets.
36#
37MODULE		= sha2
38SHA2_OBJS_32    =
39SHA2_OBJS_64    = sha512-x86_64.o sha256-x86_64.o sha256-ni.o
40SHA2_OBJS       += $(SHA2_OBJS_$(CLASS))
41OBJECTS		= $(SHA2_OBJS:%=$(OBJS_DIR)/%)
42ROOTMODULE	= $(ROOT_CRYPTO_DIR)/$(MODULE)
43ROOTLINK	= $(ROOT_MISC_DIR)/$(MODULE)
44
45#
46#	Include common rules.
47#
48include $(UTSBASE)/intel/Makefile.intel
49
50#
51#	Override defaults
52#
53CLEANFILES += sha512-x86_64.S sha256-x86_64.S sha512-x86_64.s sha256-x86_64.s
54
55#
56#	Define targets
57#
58ALL_TARGET	= $(BINARY)
59INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOTLINK)
60
61#
62# Linkage dependencies
63#
64LDFLAGS += -Nmisc/kcf
65
66CFLAGS += -I$(COMDIR)
67
68CERRWARN	+= -_gcc=-Wno-switch
69CERRWARN	+= $(CNOWARN_UNINIT)
70
71#
72#	Default build targets.
73#
74.KEEP_STATE:
75
76def:		$(DEF_DEPS)
77
78all:		$(ALL_DEPS)
79
80clean:		$(CLEAN_DEPS)
81
82clobber:	$(CLOBBER_DEPS)
83
84install:	$(INSTALL_DEPS)
85
86$(ROOTLINK):	$(ROOT_MISC_DIR) $(ROOTMODULE)
87	-$(RM) $@; ln $(ROOTMODULE) $@
88
89#
90#	Include common targets.
91#
92include $(UTSBASE)/intel/Makefile.targ
93
94$(OBJS_DIR)/%.o: %.S
95	$(COMPILE.s) -o $@ ${@F:.o=.S}
96
97#
98# sha256-ni.S is a static source under common/crypto; the SHA256_NI_KERNEL
99# define selects the kernel-private entry name so it does not collide with
100# the generic SHA256TransformBlocks from sha256-x86_64.o.  Its kernel FPU
101# guard uses CLTS/STTS from sys/machprivregs.h, which lives under the
102# platform directory (same arrangement as intel/aes).
103#
104AS_CPPFLAGS	+= -I../../$(PLATFORM)
105
106$(OBJS_DIR)/%.o: $(COMDIR)/sha2/amd64/%.S
107	$(COMPILE.s) -DSHA256_NI_KERNEL -o $@ $(COMDIR)/sha2/amd64/${@F:.o=.S}
108
109sha512-x86_64.S: $(COMDIR)/sha2/amd64/sha512-x86_64.pl
110	$(PERL) $? $@
111
112sha256-x86_64.S: $(COMDIR)/sha2/amd64/sha512-x86_64.pl
113	$(PERL) $? $@
114