1# Copyright (C) 1996-2022 Free Software Foundation, Inc.
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8
9# The GNU C Library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# Lesser General Public License for more details.
13
14# You should have received a copy of the GNU Lesser General Public
15# License along with the GNU C Library; if not, see
16# <https://www.gnu.org/licenses/>.
17
18#
19#	Sub-makefile for crypt() portion of the library.
20#
21subdir	:= crypt
22
23include ../Makeconfig
24
25headers := crypt.h
26
27extra-libs := libcrypt
28extra-libs-others := $(extra-libs)
29
30libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
31		     crypt_util
32
33tests := cert md5c-test sha256c-test sha512c-test badsalttest
34
35ifeq ($(nss-crypt),yes)
36nss-cpp-flags := -DUSE_NSS \
37  -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir)
38CPPFLAGS-sha256-crypt.c += $(nss-cpp-flags)
39CPPFLAGS-sha512-crypt.c += $(nss-cpp-flags)
40CPPFLAGS-md5-crypt.c += $(nss-cpp-flags)
41LDLIBS-crypt.so = -lfreebl3
42else
43libcrypt-routines += md5 sha256 sha512
44
45tests += md5test sha256test sha512test
46
47# The test md5test-giant uses up to 400 MB of RSS and runs on a fast
48# machine over a minute.
49xtests = md5test-giant
50endif
51
52include ../Rules
53
54ifneq ($(nss-crypt),yes)
55md5-routines := md5 $(filter md5%,$(libcrypt-sysdep_routines))
56sha256-routines := sha256 $(filter sha256%,$(libcrypt-sysdep_routines))
57sha512-routines := sha512 $(filter sha512%,$(libcrypt-sysdep_routines))
58
59$(objpfx)md5test: $(patsubst %, $(objpfx)%.o,$(md5-routines))
60$(objpfx)md5test-giant: $(patsubst %, $(objpfx)%.o,$(md5-routines))
61$(objpfx)sha256test: $(patsubst %, $(objpfx)%.o,$(sha256-routines))
62$(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
63endif
64
65ifeq (yes,$(build-shared))
66$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
67else
68$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
69endif
70