]> git.ipfire.org Git - thirdparty/glibc.git/blame - nss/Makefile
[powerpc] No need to enter "Ignore Exceptions Mode"
[thirdparty/glibc.git] / nss / Makefile
CommitLineData
04277e02 1# Copyright (C) 1996-2019 Free Software Foundation, Inc.
5f0e6fc7
RM
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
41bdb6e2
AJ
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.
5f0e6fc7
RM
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
41bdb6e2 12# Lesser General Public License for more details.
5f0e6fc7 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
5f0e6fc7
RM
17
18#
19# Makefile for name service switch.
20#
21subdir := nss
22
a5f891ac
JM
23include ../Makeconfig
24
a8874ead 25headers := nss.h
5f0e6fc7
RM
26
27# This is the trivial part which goes into libc itself.
a5fdf99b 28routines = nsswitch getnssent getnssent_r digits_dots \
676599b3 29 valid_field valid_list_field rewrite_field \
c88ffc23 30 $(addsuffix -lookup,$(databases)) \
67f36c79 31 compat-lookup nss_hash
5f0e6fc7 32
6dbe2837 33# These are the databases that go through nss dispatch.
a8874ead
UD
34# Caution: if you add a database here, you must add its real name
35# in databases.def, too.
a1309c2b
RM
36databases = proto service hosts network grp pwd ethers \
37 spwd netgrp alias sgrp
38
39ifneq (,$(filter sunrpc,$(subdirs)))
40databases += key rpc
41have-sunrpc := 1
42else
43have-sunrpc := 0
44endif
45CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
5f0e6fc7 46
9ee76b5a
UD
47others := getent makedb
48install-bin := getent makedb
49makedb-modules = xmalloc hash-string
7b3ce395 50others-extras = $(makedb-modules)
9ee76b5a 51extra-objs += $(makedb-modules:=.o)
7d6a8338 52
676599b3 53tests-static = tst-field
7c3018f9 54tests-internal = tst-field
ae5c498d
DD
55tests = test-netdb test-digits-dots tst-nss-getpwent bug17079 \
56 tst-nss-test1 \
57 tst-nss-test2 \
ae5c498d
DD
58 tst-nss-test4 \
59 tst-nss-test5
9a1c21c4 60xtests = bug-erange
6591c335 61
561b0bec 62tests-container = \
11eb21c4 63 tst-nss-test3 \
99135114
DD
64 tst-nss-files-hosts-long \
65 tst-nss-db-endpwent \
66 tst-nss-db-endgrent
561b0bec 67
f4a6be25
FW
68# Tests which need libdl
69ifeq (yes,$(build-shared))
70tests += tst-nss-files-hosts-erange
d8425e11 71tests += tst-nss-files-hosts-multi
916124ed 72tests += tst-nss-files-hosts-getent
e95c6f61 73tests += tst-nss-files-alias-leak
2bac7daa 74tests += tst-nss-files-alias-truncated
f4a6be25
FW
75endif
76
b0a679f4
CD
77# If we have a thread library then we can test cancellation against
78# some routines like getpwuid_r.
79ifeq (yes,$(have-thread-library))
80tests += tst-cancel-getpwuid_r
81endif
82
5f0e6fc7 83# Specify rules for the nss_* modules. We have some services.
64d1e08e 84services := files db compat
5f0e6fc7
RM
85
86extra-libs = $(services:%=libnss_%)
dbe31b9a
RM
87# These libraries will be built in the `others' pass rather than
88# the `lib' pass, because they depend on libc.so being built already.
89extra-libs-others = $(extra-libs)
5f0e6fc7
RM
90
91# The sources are found in the appropriate subdir.
6dbe2837 92subdir-dirs = $(services:%=nss_%)
9ee76b5a 93vpath %.c $(subdir-dirs) ../locale/programs ../intl
5f0e6fc7
RM
94
95
aa132749 96libnss_files-routines := $(addprefix files-,$(databases)) \
cef9b653 97 files-initgroups files-init
5f0e6fc7 98
2666d441
UD
99libnss_db-dbs := $(addprefix db-,\
100 $(filter-out hosts network key alias,\
9f2da732
UD
101 $(databases))) \
102 db-initgroups
319b9ad4 103libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
2666d441
UD
104generated += $(filter-out db-alias.c db-netgrp.c, \
105 $(addsuffix .c,$(libnss_db-dbs)))
1aadea59 106
64d1e08e
AS
107libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \
108 nisdomain
109
77fb9117
UD
110install-others += $(inst_vardbdir)/Makefile
111
3ff42526 112# Build static module into libc if requested
40a55d20 113libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
2666d441 114libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
64d1e08e 115libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
3ff42526
PP
116ifeq ($(build-static-nss),yes)
117routines += $(libnss_files-routines)
118static-only-routines += $(libnss_files-routines)
676599b3 119tests-static += tst-nss-static
6ca96fe2 120endif
ae5c498d 121extra-test-objs += nss_test1.os nss_test2.os
5f0e6fc7
RM
122
123include ../Rules
124
9ee76b5a
UD
125ifeq (yes,$(have-selinux))
126LDLIBS-makedb := -lselinux
127endif
128
7b57bfe5 129libnss-libc = $(common-objpfx)linkobj/libc.so
fab7ce3f
JM
130# Target-specific variable setting to link objects using deprecated
131# RPC interfaces with the version of libc.so that makes them available
132# for new links:
133$(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
c3e2f19b 134
2666d441
UD
135$(objpfx)libnss_db.so: $(objpfx)libnss_files.so
136
137$(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
138 @rm -f $@.new
139 (echo '#define EXTERN_PARSER';\
140 echo '#define GENERIC "../nss_db/db-XXX.c"';\
141 echo '#include "$<"') > $@.new
142 mv -f $@.new $@
143
c3e2f19b 144
9ee76b5a
UD
145$(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
146
77fb9117
UD
147$(inst_vardbdir)/Makefile: db-Makefile $(+force)
148 $(do-install)
149
ae5c498d
DD
150libnss_test1.so-no-z-defs = 1
151libnss_test2.so-no-z-defs = 1
152
153rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
154
9cd47470 155libof-nss_test1 = extramodules
ae5c498d 156libof-nss_test2 = extramodules
fab7ce3f 157$(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
c3e2f19b 158 $(build-module)
ae5c498d
DD
159$(objpfx)/libnss_test2.so: $(objpfx)nss_test2.os $(link-libc-deps)
160 $(build-module)
161$(objpfx)nss_test2.os : nss_test1.c
6bacf05b 162ifdef libnss_test1.so-version
c3e2f19b
UD
163$(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
164 $(make-link)
6bacf05b 165endif
ae5c498d
DD
166ifdef libnss_test2.so-version
167$(objpfx)/libnss_test2.so$(libnss_test2.so-version): $(objpfx)/libnss_test2.so
168 $(make-link)
169endif
268bb71e 170$(patsubst %,$(objpfx)%.out,$(tests) $(tests-container)) : \
ae5c498d
DD
171 $(objpfx)/libnss_test1.so$(libnss_test1.so-version) \
172 $(objpfx)/libnss_test2.so$(libnss_test2.so-version)
b0a679f4
CD
173
174ifeq (yes,$(have-thread-library))
175$(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library)
176endif
f4a6be25
FW
177
178$(objpfx)tst-nss-files-hosts-erange: $(libdl)
d8425e11 179$(objpfx)tst-nss-files-hosts-multi: $(libdl)
916124ed 180$(objpfx)tst-nss-files-hosts-getent: $(libdl)
e95c6f61
FW
181$(objpfx)tst-nss-files-alias-leak: $(libdl)
182$(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so
081bdf94
FW
183$(objpfx)tst-nss-files-alias-truncated: $(libdl)
184$(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so