xref: /titanic_52/usr/src/lib/pkcs11/libsoftcrypto/Makefile.com (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
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# lib/pkcs11/libsoftcrypto/Makefile.com
26#
27
28# AES
29AES_DIR= $(SRC)/common/crypto/aes
30AES_COMMON_OBJS= aes_impl.o aes_modes.o
31AES_COMMON_SRC= $(AES_COMMON_OBJS:%.o=$(AES_DIR)/%.c)
32AES_FLAGS= -I$(AES_DIR)
33
34# Blowfish
35BLOWFISH_DIR= $(SRC)/common/crypto/blowfish
36BLOWFISH_COMMON_OBJS= blowfish_impl.o
37BLOWFISH_COMMON_SRC= $(BLOWFISH_COMMON_OBJS:%.o=$(BLOWFISH_DIR)/%.c)
38BLOWFISH_FLAGS= -I$(BLOWFISH_DIR)
39
40# ARCFour
41ARCFOUR_DIR= $(SRC)/common/crypto/arcfour
42ARCFOUR_COMMON_OBJS= arcfour_crypt.o
43ARCFOUR_COMMON_SRC= $(ARCFOUR_COMMON_OBJS:%.o=$(ARCFOUR_DIR)/%.c)
44ARCFOUR_FLAGS= -I$(ARCFOUR_DIR)
45
46# DES
47DES_DIR= $(SRC)/common/crypto/des
48DES_COMMON_OBJS= des_impl.o des_ks.o
49DES_COMMON_SRC= $(DES_COMMON_OBJS:%.o=$(DES_DIR)/%.c)
50DES_FLAGS= -I$(DES_DIR)
51
52# BIGNUM
53BIGNUM_DIR= $(SRC)/common/bignum
54BIGNUM_COMMON_OBJS= bignumimpl.o
55BIGNUM_COMMON_SRC= $(BIGNUM_COMMON_OBJS:%.o=$(BIGNUM_DIR)/%.c)
56BIGNUM_FLAGS= -I$(BIGNUM_DIR)
57
58# Modes
59MODES_DIR= $(SRC)/common/crypto/modes
60MODES_COMMON_OBJS= modes.o ecb.o cbc.o ctr.o
61MODES_COMMON_SRC= $(MODES_COMMON_OBJS:%.o=$(MODES_DIR)/%.c)
62
63
64# Object setup
65AES_OBJS= $(AES_COMMON_OBJS) $(AES_PSM_OBJS)
66ARCFOUR_OBJS= $(ARCFOUR_COMMON_OBJS) $(ARCFOUR_PSM_OBJS)
67BLOWFISH_OBJS= $(BLOWFISH_COMMON_OBJS) $(BLOWFISH_PSM_OBJS)
68DES_OBJS= $(DES_COMMON_OBJS) $(DES_PSM_OBJS)
69BIGNUM_OBJS= $(BIGNUM_COMMON_OBJS) $(BIGNUM_PSM_OBJS)
70MODES_OBJS= $(MODES_COMMON_OBJS)
71
72OBJECTS= $(AES_OBJS) $(ARCFOUR_OBJS) $(BIGNUM_OBJS) $(BLOWFISH_OBJS) \
73	$(DES_OBJS) $(MODES_OBJS)
74
75include $(SRC)/lib/Makefile.lib
76
77# Source file setup
78AES_SRC= $(AES_COMMON_SRC) $(AES_PSM_SRC)
79ARCFOUR_SRC= $(ARCFOUR_COMMON_SRC) $(ARCFOUR_PSM_SRC)
80BLOWFISH_SRC= $(BLOWFISH_COMMON_SRC) $(BLOWFISH_PSM_SRC)
81DES_SRC= $(DES_COMMON_SRC) $(DES_PSM_SRC)
82BIGNUM_SRC= $(BIGNUM_COMMON_SRC) $(BIGNUM_PSM_SRC)
83MODES_SRC= $(MODES_COMMON_SRC)
84
85SRCS=	$(AES_SRC) $(ARCFOUR_SRC) $(BIGNUM_SRC) $(BLOWFISH_SRC) $(DES_SRC) \
86	$(MODES_SRC)
87
88#
89# Compiler settings
90#
91
92SRCDIR=	$(SRC)/lib/pkcs11/libsoftcrypto/common/
93CRYPTODIR= $(SRC)/common/crypto/
94MODESDIR= $(SRC)/uts/common/
95ROOTLIBDIR= $(ROOT)/usr/lib
96ROOTLIBDIR64= $(ROOT)/usr/lib/$(MACH64)
97ROOTHWCAPDIR= $(ROOTLIBDIR)/libsoftcrypto
98
99LIBS = $(DYNLIB)
100
101CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
102CPPFLAGS += -I$(SRCDIR) -I$(CRYPTODIR) -I$(MODESDIR) -D_POSIX_PTHREAD_SEMANTICS
103ASFLAGS = $(AS_PICFLAGS) -P -D__STDC__ -D_ASM
104LINTFLAGS64 += -errchk=longptr64
105
106all:	$(LIBS)
107
108lint:	$(SRCS)
109	$(LINT.c) $(LINTCHECKFLAGS) $(SRCS) $(LDLIBS)
110
111pics/%.o:	$(AES_DIR)/%.c
112	$(COMPILE.c) $(AES_FLAGS) -o $@ $<
113	$(POST_PROCESS_O)
114
115pics/%.o:	$(ARCFOUR_DIR)/%.c
116	$(COMPILE.c) $(ARCFOUR_FLAGS) -o $@ $<
117	$(POST_PROCESS_O)
118
119pics/%.o:	$(BIGNUM_DIR)/%.c
120	$(COMPILE.c) $(BIGNUM_FLAGS) -o $@ $<
121	$(POST_PROCESS_O)
122
123pics/%.o:	$(BLOWFISH_DIR)/%.c
124	$(COMPILE.c) $(BLOWFISH_FLAGS) -o $@ $<
125	$(POST_PROCESS_O)
126
127pics/%.o:	$(DES_DIR)/%.c
128	$(COMPILE.c) $(DES_FLAGS) -o $@ $<
129	$(POST_PROCESS_O)
130
131pics/%.o:	$(MODES_DIR)/%.c
132	$(COMPILE.c) -o $@ $<
133	$(POST_PROCESS_O)
134
135
136#
137# Platform-specific targets
138#
139
140
141SOFT_PSR_DIRS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib)
142SOFT_PSR_LINKS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MODULE))
143
144SOFT_PSR64_DIRS = $(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MACH64))
145SOFT_PSR64_LINKS = \
146	$(LINKED_PLATFORMS:%=$(USR_PLAT_DIR)/%/lib/$(MACH64)/$(MODULE))
147
148INS.slink6 = $(RM) -r $@; \
149	$(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@
150INS.slink64 = $(RM) -r $@; \
151	$(SYMLINK) ../../../$(PLATFORM)/lib/$(MACH64)/$(MODULE) $@
152
153$(SOFT_PSR_DIRS) \
154$(SOFT_PSR64_DIRS):
155	-$(INS.dir.root.bin)
156
157$(SOFT_PSR_LINKS): $(SOFT_PSR_DIRS)
158	-$(INS.slink6)
159
160$(SOFT_PSR64_LINKS): $(SOFT_PSR64_DIRS)
161	-$(INS.slink64)
162
163
164include $(SRC)/lib/Makefile.targ
165