]>
Commit | Line | Data |
---|---|---|
f7a9f785 | 1 | # Copyright (C) 1996-2016 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 PE |
15 | # License along with the GNU C Library; if not, see |
16 | # <http://www.gnu.org/licenses/>. | |
5f0e6fc7 RM |
17 | |
18 | # | |
19 | # Makefile for name service switch. | |
20 | # | |
21 | subdir := nss | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
a8874ead | 25 | headers := nss.h |
5f0e6fc7 RM |
26 | |
27 | # This is the trivial part which goes into libc itself. | |
a5fdf99b | 28 | routines = nsswitch getnssent getnssent_r digits_dots \ |
676599b3 | 29 | valid_field valid_list_field rewrite_field \ |
8b801829 | 30 | $(addsuffix -lookup,$(databases)) |
5f0e6fc7 | 31 | |
6dbe2837 | 32 | # These are the databases that go through nss dispatch. |
a8874ead UD |
33 | # Caution: if you add a database here, you must add its real name |
34 | # in databases.def, too. | |
a1309c2b RM |
35 | databases = proto service hosts network grp pwd ethers \ |
36 | spwd netgrp alias sgrp | |
37 | ||
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) | |
5f0e6fc7 | 45 | |
9ee76b5a UD |
46 | others := getent makedb |
47 | install-bin := getent makedb | |
48 | makedb-modules = xmalloc hash-string | |
49 | extra-objs += $(makedb-modules:=.o) | |
7d6a8338 | 50 | |
676599b3 | 51 | tests-static = tst-field |
e07aabba | 52 | tests = test-netdb tst-nss-test1 test-digits-dots \ |
676599b3 FW |
53 | tst-nss-getpwent bug17079 \ |
54 | $(tests-static) | |
9a1c21c4 | 55 | xtests = bug-erange |
6591c335 | 56 | |
5f0e6fc7 | 57 | # Specify rules for the nss_* modules. We have some services. |
2666d441 | 58 | services := files db |
5f0e6fc7 RM |
59 | |
60 | extra-libs = $(services:%=libnss_%) | |
dbe31b9a RM |
61 | # These libraries will be built in the `others' pass rather than |
62 | # the `lib' pass, because they depend on libc.so being built already. | |
63 | extra-libs-others = $(extra-libs) | |
5f0e6fc7 RM |
64 | |
65 | # The sources are found in the appropriate subdir. | |
6dbe2837 | 66 | subdir-dirs = $(services:%=nss_%) |
9ee76b5a | 67 | vpath %.c $(subdir-dirs) ../locale/programs ../intl |
5f0e6fc7 RM |
68 | |
69 | ||
aa132749 | 70 | libnss_files-routines := $(addprefix files-,$(databases)) \ |
319b9ad4 | 71 | files-initgroups files-have_o_cloexec files-init |
5f0e6fc7 | 72 | |
2666d441 UD |
73 | libnss_db-dbs := $(addprefix db-,\ |
74 | $(filter-out hosts network key alias,\ | |
9f2da732 UD |
75 | $(databases))) \ |
76 | db-initgroups | |
319b9ad4 | 77 | libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string |
2666d441 UD |
78 | generated += $(filter-out db-alias.c db-netgrp.c, \ |
79 | $(addsuffix .c,$(libnss_db-dbs))) | |
1aadea59 | 80 | |
77fb9117 UD |
81 | install-others += $(inst_vardbdir)/Makefile |
82 | ||
3ff42526 | 83 | # Build static module into libc if requested |
40a55d20 | 84 | libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) |
2666d441 | 85 | libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) |
3ff42526 PP |
86 | ifeq ($(build-static-nss),yes) |
87 | routines += $(libnss_files-routines) | |
88 | static-only-routines += $(libnss_files-routines) | |
676599b3 | 89 | tests-static += tst-nss-static |
6ca96fe2 | 90 | endif |
5f0e6fc7 RM |
91 | |
92 | include ../Rules | |
93 | ||
9ee76b5a UD |
94 | ifeq (yes,$(have-selinux)) |
95 | LDLIBS-makedb := -lselinux | |
96 | endif | |
97 | ||
7b57bfe5 | 98 | libnss-libc = $(common-objpfx)linkobj/libc.so |
fab7ce3f JM |
99 | # Target-specific variable setting to link objects using deprecated |
100 | # RPC interfaces with the version of libc.so that makes them available | |
101 | # for new links: | |
102 | $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc) | |
c3e2f19b | 103 | |
2666d441 UD |
104 | $(objpfx)libnss_db.so: $(objpfx)libnss_files.so |
105 | ||
106 | $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c | |
107 | @rm -f $@.new | |
108 | (echo '#define EXTERN_PARSER';\ | |
109 | echo '#define GENERIC "../nss_db/db-XXX.c"';\ | |
110 | echo '#include "$<"') > $@.new | |
111 | mv -f $@.new $@ | |
112 | ||
c3e2f19b | 113 | |
9ee76b5a UD |
114 | $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o) |
115 | ||
77fb9117 UD |
116 | $(inst_vardbdir)/Makefile: db-Makefile $(+force) |
117 | $(do-install) | |
118 | ||
9cd47470 | 119 | libof-nss_test1 = extramodules |
fab7ce3f | 120 | $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps) |
c3e2f19b | 121 | $(build-module) |
6bacf05b | 122 | ifdef libnss_test1.so-version |
c3e2f19b UD |
123 | $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so |
124 | $(make-link) | |
6bacf05b | 125 | endif |
c3e2f19b | 126 | $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version) |