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://opensource.org/licenses/CDDL-1.0.
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 # Copyright 2013 Saso Kiselkov. All rights reserved.
22 #
23 # This makefile drives the production of the sha2 test suite.
24 # To run the tests, simply type "make" or "make check".
25
26 include ../../../../Makefile.master
27
28 CFLAGS = -I${SRC}/uts/common -D_KERNEL -fno-builtin -O2 -W -Wall \
29 -Wno-unknown-pragmas -Wno-unused -std=c99
30 CPUMHZ:sh = psrinfo -v 0 | awk '/processor operates at/{print $6}'
31 GCC = $(GCC_ROOT)/bin/gcc
32
33 PERL = perl
34 AS = /opt/onbld/bin/i386/aw
35 ASSFLAGS = -P -xarch=amd64 -P -Ui386 -U__i386 -D_KERNEL -D_SYSCALL32 \
36 -D_SYSCALL32_IMPL -D_ELF64 -D_DDI_STRICT -Dsun -D__sun -D__SVR4 \
37 -DDEBUG -D_ASM -D__STDC__=0 -I../../../../uts/intel \
38 -I../../../../uts/common
39 COMPILE.s = $(AS) $(ASSFLAGS)
40
41 check : sha2_test32_check sha2_test64_check
42 all : sha2_test32 sha2_test64
43
44 sha2_test32 : sha2_test.c
45 @ echo Building 32-bit test...
46 @ $(GCC) $(CFLAGS) -o sha2_test32 sha2_test.c ../sha2.c
47
48 sha2_test64 : sha2_test.c sha256-x86_64.o sha512-x86_64.o ../sha2.c
49 @ echo Building 64-bit test...
50 @ $(GCC) $(CFLAGS) -m64 -o $@ sha2_test.c sha256-x86_64.o \
51 sha512-x86_64.o ../sha2.c
52
53 sha2_test32_check : sha2_test32
54 @ echo Running 32-bit test...
55 @ ./sha2_test32 $(CPUMHZ)
56
57 sha2_test64_check : sha2_test64
58 @ echo Running 64-bit test...
59 @ ./sha2_test64 $(CPUMHZ)
60
61 %.o: %.s
62 @ $(COMPILE.s) -o $@ ${@F:.o=.s}
63
64 sha512-x86_64.s: ../amd64/sha512-x86_64.pl
65 @ $(PERL) $? $@
66
67 sha256-x86_64.s: ../amd64/sha512-x86_64.pl
68 @ $(PERL) $? $@
69
70 clean :
71 rm -f sha2_test32 sha2_test64 *.o *.s