xref: /titanic_41/usr/src/lib/pkcs11/libsoftcrypto/Makefile.com (revision 3c112a2b34403220c06c3e2fcac403358cfba168)
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#
23# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24#
25
26#
27# lib/pkcs11/libsoftcrypto/Makefile.com
28#
29
30# AES
31AES_DIR= $(SRC)/common/crypto/aes
32AES_COMMON_OBJS= aes_impl.o aes_modes.o
33AES_COMMON_SRC= $(AES_COMMON_OBJS:%.o=$(AES_DIR)/%.c)
34AES_FLAGS= -I$(AES_DIR)
35
36# Blowfish
37BLOWFISH_DIR= $(SRC)/common/crypto/blowfish
38BLOWFISH_COMMON_OBJS= blowfish_impl.o
39BLOWFISH_COMMON_SRC= $(BLOWFISH_COMMON_OBJS:%.o=$(BLOWFISH_DIR)/%.c)
40BLOWFISH_FLAGS= -I$(BLOWFISH_DIR)
41
42# ARCFour
43ARCFOUR_DIR= $(SRC)/common/crypto/arcfour
44ARCFOUR_COMMON_OBJS= arcfour_crypt.o
45ARCFOUR_COMMON_SRC= $(ARCFOUR_COMMON_OBJS:%.o=$(ARCFOUR_DIR)/%.c)
46ARCFOUR_FLAGS= -I$(ARCFOUR_DIR)
47
48# DES
49DES_DIR= $(SRC)/common/crypto/des
50DES_COMMON_OBJS= des_impl.o des_ks.o
51DES_COMMON_SRC= $(DES_COMMON_OBJS:%.o=$(DES_DIR)/%.c)
52DES_FLAGS= -I$(DES_DIR)
53
54# BIGNUM -- needed by DH, DSA, RSA
55BIGNUM_DIR= $(SRC)/common/bignum
56BIGNUM_COMMON_OBJS= bignumimpl.o
57BIGNUM_COMMON_SRC= $(BIGNUM_COMMON_OBJS:%.o=$(BIGNUM_DIR)/%.c)
58BIGNUM_FLAGS= -I$(BIGNUM_DIR)
59
60# Modes
61MODES_DIR= $(SRC)/common/crypto/modes
62MODES_COMMON_OBJS= modes.o ecb.o cbc.o ctr.o
63MODES_COMMON_SRC= $(MODES_COMMON_OBJS:%.o=$(MODES_DIR)/%.c)
64MODES_FLAGS= -I$(MODES_DIR)
65
66# DH
67DH_DIR= $(SRC)/common/crypto/dh
68DH_COMMON_OBJS= dh_impl.o
69DH_COMMON_SRC= $(DH_COMMON_OBJS:%.o=$(DH_DIR)/%.c)
70DH_FLAGS= $(BIGNUM_FLAGS) -I$(DH_DIR)
71
72# DSA
73DSA_DIR= $(SRC)/common/crypto/dsa
74DSA_COMMON_OBJS= dsa_impl.o
75DSA_COMMON_SRC= $(DSA_COMMON_OBJS:%.o=$(DSA_DIR)/%.c)
76DSA_FLAGS= $(BIGNUM_FLAGS) -I$(DSA_DIR)
77
78# RSA
79RSA_DIR= $(SRC)/common/crypto/rsa
80RSA_COMMON_OBJS= rsa_impl.o
81RSA_COMMON_SRC= $(RSA_COMMON_OBJS:%.o=$(RSA_DIR)/%.c)
82RSA_FLAGS= $(BIGNUM_FLAGS) -I$(RSA_DIR)
83
84# PADDING -- needed by RSA
85PAD_DIR= $(SRC)/common/crypto/padding
86PAD_COMMON_OBJS= pkcs1.o pkcs7.o
87PAD_COMMON_SRC= $(PAD_COMMON_OBJS:%.o=$(PAD_DIR)/%.c)
88PAD_FLAGS= -I$(PAD_DIR)
89
90# Object setup
91AES_OBJS= $(AES_COMMON_OBJS) $(AES_PSM_OBJS)
92ARCFOUR_OBJS= $(ARCFOUR_COMMON_OBJS) $(ARCFOUR_PSM_OBJS)
93BLOWFISH_OBJS= $(BLOWFISH_COMMON_OBJS) $(BLOWFISH_PSM_OBJS)
94DES_OBJS= $(DES_COMMON_OBJS) $(DES_PSM_OBJS)
95BIGNUM_OBJS= $(BIGNUM_COMMON_OBJS) $(BIGNUM_PSM_OBJS)
96MODES_OBJS= $(MODES_COMMON_OBJS) $(MODES_PSM_OBJS)
97DH_OBJS= $(DH_COMMON_OBJS) $(DH_PSM_OBJS)
98DSA_OBJS= $(DSA_COMMON_OBJS) $(DSA_PSM_OBJS)
99RSA_OBJS= $(RSA_COMMON_OBJS) $(RSA_PSM_OBJS)
100PAD_OBJS= $(PAD_COMMON_OBJS) $(PAD_PSM_OBJS)
101
102OBJECTS= $(AES_OBJS) $(ARCFOUR_OBJS) $(BIGNUM_OBJS) $(BLOWFISH_OBJS) \
103	$(DES_OBJS) $(MODES_OBJS) $(DH_OBJS) $(DSA_OBJS) \
104	$(RSA_OBJS) $(PAD_OBJS)
105
106include $(SRC)/lib/Makefile.lib
107
108# Source file setup
109AES_SRC= $(AES_COMMON_SRC) $(AES_PSM_SRC)
110ARCFOUR_SRC= $(ARCFOUR_COMMON_SRC) $(ARCFOUR_PSM_SRC)
111BLOWFISH_SRC= $(BLOWFISH_COMMON_SRC) $(BLOWFISH_PSM_SRC)
112DES_SRC= $(DES_COMMON_SRC) $(DES_PSM_SRC)
113BIGNUM_SRC= $(BIGNUM_COMMON_SRC) $(BIGNUM_PSM_SRC)
114MODES_SRC= $(MODES_COMMON_SRC) $(MODES_PSM_SRC)
115DH_SRC= $(DH_COMMON_SRC) $(DH_PSM_SRC)
116DSA_SRC= $(DSA_COMMON_SRC) $(DSA_PSM_SRC)
117RSA_SRC= $(RSA_COMMON_SRC) $(RSA_PSM_SRC)
118PAD_SRC= $(PAD_COMMON_SRC) $(PAD_PSM_SRC)
119
120SRCS=	$(AES_SRC) $(ARCFOUR_SRC) $(BIGNUM_SRC) $(BLOWFISH_SRC) $(DES_SRC) \
121	$(MODES_SRC) $(DH_SRC) $(DSA_SRC) $(RSA_SRC) \
122	$(PAD_SRC)
123
124# Do not lint ECC and MPI
125LINTABLE= \
126	$(AES_SRC) $(ARCFOUR_SRC) $(BIGNUM_SRC) $(BLOWFISH_SRC) $(DES_SRC) \
127	$(MODES_SRC) $(DH_SRC) $(DSA_SRC) $(RSA_SRC) $(PAD_SRC)
128
129#
130# Compiler settings
131#
132
133SRCDIR=	$(SRC)/lib/pkcs11/libsoftcrypto/common/
134CRYPTODIR= $(SRC)/common/crypto/
135UTSDIR= $(SRC)/uts/common/
136ROOTLIBDIR= $(ROOT)/usr/lib
137ROOTLIBDIR64= $(ROOT)/usr/lib/$(MACH64)
138ROOTHWCAPDIR= $(ROOTLIBDIR)/libsoftcrypto
139
140# $(LINTLIB) is not included here;  i386_hwcap1/Makefile does not make
141# a lint library, so each of the other platform-specific Makefiles adds
142# the lint library target individually
143LIBS = $(DYNLIB)
144LDLIBS += -lc
145
146CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
147CPPFLAGS += -I$(SRCDIR) -I$(CRYPTODIR) -I$(UTSDIR) \
148	$(BIGNUM_FLAGS) \
149	-D_POSIX_PTHREAD_SEMANTICS
150ASFLAGS = $(AS_PICFLAGS) -P -D__STDC__ -D_ASM
151EXTRA_LINT_FLAGS = \
152	$(AES_FLAGS) $(BLOWFISH_FLAGS) $(ARCFOUR_FLAGS) $(DES_FLAGS) \
153	$(BIGNUM_FLAGS) $(MODES_FLAGS) $(DH_FLAGS) $(DSA_FLAGS) \
154	$(RSA_FLAGS) $(PAD_FLAGS)
155LINTFLAGS += $(EXTRA_LINT_FLAGS)
156LINTFLAGS64 += $(EXTRA_LINT_FLAGS) -errchk=longptr64
157
158LINTLIB=	llib-l$(LIBNAME).ln
159$(LINTLIB)	:= 	SRCS = $(LINTABLE)
160lintcheck	:=	SRCS = $(LINTABLE)
161
162all:	$(LIBS)
163
164lint:	lintcheck
165
166pics/%.o:	$(AES_DIR)/%.c
167	$(COMPILE.c) $(AES_FLAGS) -o $@ $<
168	$(POST_PROCESS_O)
169
170pics/%.o:	$(ARCFOUR_DIR)/%.c
171	$(COMPILE.c) $(ARCFOUR_FLAGS) -o $@ $<
172	$(POST_PROCESS_O)
173
174pics/%.o:	$(BIGNUM_DIR)/%.c
175	$(COMPILE.c) $(BIGNUM_FLAGS) -o $@ $<
176	$(POST_PROCESS_O)
177
178pics/%.o:	$(BLOWFISH_DIR)/%.c
179	$(COMPILE.c) $(BLOWFISH_FLAGS) -o $@ $<
180	$(POST_PROCESS_O)
181
182pics/%.o:	$(DES_DIR)/%.c
183	$(COMPILE.c) $(DES_FLAGS) -o $@ $<
184	$(POST_PROCESS_O)
185
186pics/%.o:	$(MODES_DIR)/%.c
187	$(COMPILE.c) $(MODES_FLAGS) -o $@ $<
188	$(POST_PROCESS_O)
189
190pics/%.o:	$(DH_DIR)/%.c
191	$(COMPILE.c) $(DH_FLAGS) -o $@ $<
192	$(POST_PROCESS_O)
193
194pics/%.o:	$(DSA_DIR)/%.c
195	$(COMPILE.c) $(DSA_FLAGS) -o $@ $<
196	$(POST_PROCESS_O)
197
198pics/%.o:	$(RSA_DIR)/%.c
199	$(COMPILE.c) $(RSA_FLAGS) -o $@ $<
200	$(POST_PROCESS_O)
201
202pics/%.o:	$(PAD_DIR)/%.c
203	$(COMPILE.c) $(PAD_FLAGS) -o $@ $<
204	$(POST_PROCESS_O)
205
206#
207# Platform-specific targets
208#
209
210
211SOFT_PSR_DIRS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib)
212SOFT_PSR_LINKS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MODULE))
213
214SOFT_PSR64_DIRS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MACH64))
215SOFT_PSR64_LINKS = \
216	$(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MACH64)/$(MODULE))
217
218INS.slink6 = $(RM) -r $@; \
219	$(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@
220INS.slink64 = $(RM) -r $@; \
221	$(SYMLINK) ../../../$(PLATFORM)/lib/$(MACH64)/$(MODULE) $@
222
223$(SOFT_PSR_DIRS) \
224$(SOFT_PSR64_DIRS):
225	-$(INS.dir)
226
227$(SOFT_PSR_LINKS): $(SOFT_PSR_DIRS)
228	-$(INS.slink6)
229
230$(SOFT_PSR64_LINKS): $(SOFT_PSR64_DIRS)
231	-$(INS.slink64)
232
233
234include $(SRC)/lib/Makefile.targ
235