math: Remove slow paths from atan2 [BZ #15267]
[glibc.git] / nss / Makefile
blob71fbe583bfc31319469e8f969a1da8a683bfa132
1 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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/>.
19 # Makefile for name service switch.
21 subdir := nss
23 include ../Makeconfig
25 headers := nss.h
27 # This is the trivial part which goes into libc itself.
28 routines = nsswitch getnssent getnssent_r digits_dots \
29 valid_field valid_list_field rewrite_field \
30 $(addsuffix -lookup,$(databases)) \
31 compat-lookup nss_hash nss_files_fopen \
32 nss_readline nss_parse_line_result \
33 nss_fgetent_r nss_module nss_action \
34 nss_action_parse nss_database
36 # These are the databases that go through nss dispatch.
37 # Caution: if you add a database here, you must add its real name
38 # in databases.def, too.
39 databases = proto service hosts network grp pwd ethers \
40 spwd netgrp alias sgrp
42 ifneq (,$(filter sunrpc,$(subdirs)))
43 databases += key rpc
44 have-sunrpc := 1
45 else
46 have-sunrpc := 0
47 endif
48 CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
50 others := getent makedb
51 install-bin := getent makedb
52 makedb-modules = xmalloc hash-string
53 others-extras = $(makedb-modules)
54 extra-objs += $(makedb-modules:=.o)
56 tests-static = tst-field
57 tests-internal = tst-field
58 tests = test-netdb test-digits-dots tst-nss-getpwent bug17079 \
59 tst-nss-test1 \
60 tst-nss-test2 \
61 tst-nss-test4 \
62 tst-nss-test5
63 xtests = bug-erange
65 tests-container = \
66 tst-nss-compat1 \
67 tst-nss-test3 \
68 tst-nss-files-hosts-long \
69 tst-nss-db-endpwent \
70 tst-nss-db-endgrent \
71 tst-reload1 tst-reload2
73 # Tests which need libdl
74 ifeq (yes,$(build-shared))
75 tests += tst-nss-files-hosts-erange
76 tests += tst-nss-files-hosts-multi
77 tests += tst-nss-files-hosts-getent
78 tests += tst-nss-files-alias-leak
79 tests += tst-nss-files-alias-truncated
80 endif
82 # If we have a thread library then we can test cancellation against
83 # some routines like getpwuid_r.
84 ifeq (yes,$(have-thread-library))
85 tests += tst-cancel-getpwuid_r
86 endif
88 # Specify rules for the nss_* modules. We have some services.
89 services := files db compat
91 extra-libs = $(services:%=libnss_%)
92 # These libraries will be built in the `others' pass rather than
93 # the `lib' pass, because they depend on libc.so being built already.
94 extra-libs-others = $(extra-libs)
96 # The sources are found in the appropriate subdir.
97 subdir-dirs = $(services:%=nss_%)
98 vpath %.c $(subdir-dirs) ../locale/programs ../intl
101 libnss_files-routines := $(addprefix files-, \
102 $(filter-out key, $(databases))) \
103 files-initgroups files-init
105 libnss_db-dbs := $(addprefix db-,\
106 $(filter-out hosts network key alias,\
107 $(databases))) \
108 db-initgroups
109 libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
110 generated += $(filter-out db-alias.c db-netgrp.c, \
111 $(addsuffix .c,$(libnss_db-dbs)))
113 libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \
114 nisdomain
116 install-others += $(inst_vardbdir)/Makefile
118 # Build static module into libc if requested
119 libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
120 libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
121 libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
122 ifeq ($(build-static-nss),yes)
123 routines += $(libnss_files-routines)
124 static-only-routines += $(libnss_files-routines)
125 tests-static += tst-nss-static
126 endif
127 extra-test-objs += nss_test1.os nss_test2.os
129 include ../Rules
131 ifeq (yes,$(have-selinux))
132 LDLIBS-makedb := -lselinux
133 endif
135 libnss-libc = $(common-objpfx)linkobj/libc.so
136 # Target-specific variable setting to link objects using deprecated
137 # RPC interfaces with the version of libc.so that makes them available
138 # for new links:
139 $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
141 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
143 $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
144 @rm -f $@.new
145 (echo '#define EXTERN_PARSER';\
146 echo '#define GENERIC "../nss_db/db-XXX.c"';\
147 echo '#include "$<"') > $@.new
148 mv -f $@.new $@
151 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
153 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
154 $(do-install)
156 libnss_test1.so-no-z-defs = 1
157 libnss_test2.so-no-z-defs = 1
159 rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
161 libof-nss_test1 = extramodules
162 libof-nss_test2 = extramodules
163 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
164 $(build-module)
165 $(objpfx)/libnss_test2.so: $(objpfx)nss_test2.os $(link-libc-deps)
166 $(build-module)
167 $(objpfx)nss_test2.os : nss_test1.c
168 ifdef libnss_test1.so-version
169 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
170 $(make-link)
171 endif
172 ifdef libnss_test2.so-version
173 $(objpfx)/libnss_test2.so$(libnss_test2.so-version): $(objpfx)/libnss_test2.so
174 $(make-link)
175 endif
176 $(patsubst %,$(objpfx)%.out,$(tests) $(tests-container)) : \
177 $(objpfx)/libnss_test1.so$(libnss_test1.so-version) \
178 $(objpfx)/libnss_test2.so$(libnss_test2.so-version)
180 ifeq (yes,$(have-thread-library))
181 $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library)
182 endif
184 $(objpfx)tst-nss-files-hosts-erange: $(libdl)
185 $(objpfx)tst-nss-files-hosts-multi: $(libdl)
186 $(objpfx)tst-nss-files-hosts-getent: $(libdl)
187 $(objpfx)tst-nss-files-alias-leak: $(libdl)
188 $(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so
189 $(objpfx)tst-nss-files-alias-truncated: $(libdl)
190 $(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so