Indian scripts: More fixes after the recent import.
[glibc.git] / nss / Makefile
blobd9f6d411814bbcc6fd9577d5651120963ea85637
1 # Copyright (C) 1996-2017 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 valid_field valid_list_field rewrite_field \
30 $(addsuffix -lookup,$(databases))
32 # These are the databases that go through nss dispatch.
33 # Caution: if you add a database here, you must add its real name
34 # in databases.def, too.
35 databases = proto service hosts network grp pwd ethers \
36 spwd netgrp alias sgrp
38 ifneq (,$(filter sunrpc,$(subdirs)))
39 databases += key rpc
40 have-sunrpc := 1
41 else
42 have-sunrpc := 0
43 endif
44 CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
46 others := getent makedb
47 install-bin := getent makedb
48 makedb-modules = xmalloc hash-string
49 extra-objs += $(makedb-modules:=.o)
51 tests-static = tst-field
52 tests-internal = tst-field
53 tests = test-netdb test-digits-dots tst-nss-getpwent bug17079 \
54 tst-nss-test1 \
55 tst-nss-test2 \
56 tst-nss-test3 \
57 tst-nss-test4 \
58 tst-nss-test5
59 xtests = bug-erange
61 # If we have a thread library then we can test cancellation against
62 # some routines like getpwuid_r.
63 ifeq (yes,$(have-thread-library))
64 tests += tst-cancel-getpwuid_r
65 endif
67 # Specify rules for the nss_* modules. We have some services.
68 services := files db
70 extra-libs = $(services:%=libnss_%)
71 # These libraries will be built in the `others' pass rather than
72 # the `lib' pass, because they depend on libc.so being built already.
73 extra-libs-others = $(extra-libs)
75 # The sources are found in the appropriate subdir.
76 subdir-dirs = $(services:%=nss_%)
77 vpath %.c $(subdir-dirs) ../locale/programs ../intl
80 libnss_files-routines := $(addprefix files-,$(databases)) \
81 files-initgroups files-init
83 libnss_db-dbs := $(addprefix db-,\
84 $(filter-out hosts network key alias,\
85 $(databases))) \
86 db-initgroups
87 libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
88 generated += $(filter-out db-alias.c db-netgrp.c, \
89 $(addsuffix .c,$(libnss_db-dbs)))
91 install-others += $(inst_vardbdir)/Makefile
93 # Build static module into libc if requested
94 libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
95 libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
96 ifeq ($(build-static-nss),yes)
97 routines += $(libnss_files-routines)
98 static-only-routines += $(libnss_files-routines)
99 tests-static += tst-nss-static
100 endif
101 extra-test-objs += nss_test1.os nss_test2.os
103 include ../Rules
105 ifeq (yes,$(have-selinux))
106 LDLIBS-makedb := -lselinux
107 endif
109 libnss-libc = $(common-objpfx)linkobj/libc.so
110 # Target-specific variable setting to link objects using deprecated
111 # RPC interfaces with the version of libc.so that makes them available
112 # for new links:
113 $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
115 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
117 $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
118 @rm -f $@.new
119 (echo '#define EXTERN_PARSER';\
120 echo '#define GENERIC "../nss_db/db-XXX.c"';\
121 echo '#include "$<"') > $@.new
122 mv -f $@.new $@
125 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
127 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
128 $(do-install)
130 libnss_test1.so-no-z-defs = 1
131 libnss_test2.so-no-z-defs = 1
133 rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
135 libof-nss_test1 = extramodules
136 libof-nss_test2 = extramodules
137 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
138 $(build-module)
139 $(objpfx)/libnss_test2.so: $(objpfx)nss_test2.os $(link-libc-deps)
140 $(build-module)
141 $(objpfx)nss_test2.os : nss_test1.c
142 ifdef libnss_test1.so-version
143 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
144 $(make-link)
145 endif
146 ifdef libnss_test2.so-version
147 $(objpfx)/libnss_test2.so$(libnss_test2.so-version): $(objpfx)/libnss_test2.so
148 $(make-link)
149 endif
150 $(patsubst %,$(objpfx)%.out,$(tests)) : \
151 $(objpfx)/libnss_test1.so$(libnss_test1.so-version) \
152 $(objpfx)/libnss_test2.so$(libnss_test2.so-version)
154 ifeq (yes,$(have-thread-library))
155 $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library)
156 endif