Add test case for bug 18287
[glibc.git] / nss / Makefile
blobf6ef912cfccdcb3b361b011f593bf2ff4b280656
1 # Copyright (C) 1996-2015 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 # <http://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 $(addsuffix -lookup,$(databases))
31 # These are the databases that go through nss dispatch.
32 # Caution: if you add a database here, you must add its real name
33 # in databases.def, too.
34 databases = proto service hosts network grp pwd ethers \
35 spwd netgrp alias sgrp
37 ifneq (,$(filter sunrpc,$(subdirs)))
38 databases += key rpc
39 have-sunrpc := 1
40 else
41 have-sunrpc := 0
42 endif
43 CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
45 others := getent makedb
46 install-bin := getent makedb
47 makedb-modules = xmalloc hash-string
48 extra-objs += $(makedb-modules:=.o)
50 tests = test-netdb tst-nss-test1 test-digits-dots \
51 tst-nss-getpwent bug18287
52 xtests = bug-erange
54 # Specify rules for the nss_* modules. We have some services.
55 services := files db
57 extra-libs = $(services:%=libnss_%)
58 # These libraries will be built in the `others' pass rather than
59 # the `lib' pass, because they depend on libc.so being built already.
60 extra-libs-others = $(extra-libs)
62 # The sources are found in the appropriate subdir.
63 subdir-dirs = $(services:%=nss_%)
64 vpath %.c $(subdir-dirs) ../locale/programs ../intl
67 libnss_files-routines := $(addprefix files-,$(databases)) \
68 files-initgroups files-have_o_cloexec files-init
70 libnss_db-dbs := $(addprefix db-,\
71 $(filter-out hosts network key alias,\
72 $(databases))) \
73 db-initgroups
74 libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
75 generated += $(filter-out db-alias.c db-netgrp.c, \
76 $(addsuffix .c,$(libnss_db-dbs)))
78 install-others += $(inst_vardbdir)/Makefile
80 # Build static module into libc if requested
81 libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
82 libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
83 ifeq ($(build-static-nss),yes)
84 routines += $(libnss_files-routines)
85 static-only-routines += $(libnss_files-routines)
86 tests-static = tst-nss-static
87 tests += $(tests-static)
88 endif
90 include ../Rules
92 ifeq (yes,$(have-selinux))
93 LDLIBS-makedb := -lselinux
94 endif
96 libnss-libc = $(common-objpfx)linkobj/libc.so
97 # Target-specific variable setting to link objects using deprecated
98 # RPC interfaces with the version of libc.so that makes them available
99 # for new links:
100 $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
102 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
104 $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
105 @rm -f $@.new
106 (echo '#define EXTERN_PARSER';\
107 echo '#define GENERIC "../nss_db/db-XXX.c"';\
108 echo '#include "$<"') > $@.new
109 mv -f $@.new $@
112 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
114 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
115 $(do-install)
117 libof-nss_test1 = extramodules
118 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
119 $(build-module)
120 ifdef libnss_test1.so-version
121 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
122 $(make-link)
123 endif
124 $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)