]>
Commit | Line | Data |
---|---|---|
a4300c7a | 1 | # Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011,2012 |
c3e2f19b | 2 | # Free Software Foundation, Inc. |
5f0e6fc7 RM |
3 | # This file is part of the GNU C Library. |
4 | ||
5 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | # modify it under the terms of the GNU Lesser General Public |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
5f0e6fc7 RM |
9 | |
10 | # The GNU C Library is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | # Lesser General Public License for more details. |
5f0e6fc7 | 14 | |
41bdb6e2 | 15 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | # License along with the GNU C Library; if not, see |
17 | # <http://www.gnu.org/licenses/>. | |
5f0e6fc7 RM |
18 | |
19 | # | |
20 | # Makefile for name service switch. | |
21 | # | |
22 | subdir := nss | |
23 | ||
a8874ead | 24 | headers := nss.h |
5f0e6fc7 RM |
25 | |
26 | # This is the trivial part which goes into libc itself. | |
a5fdf99b | 27 | routines = nsswitch getnssent getnssent_r digits_dots \ |
8b801829 | 28 | $(addsuffix -lookup,$(databases)) |
5f0e6fc7 | 29 | |
6dbe2837 | 30 | # These are the databases that go through nss dispatch. |
a8874ead UD |
31 | # Caution: if you add a database here, you must add its real name |
32 | # in databases.def, too. | |
a8922de8 | 33 | databases = proto service hosts network grp pwd rpc ethers \ |
829fea46 | 34 | spwd netgrp key alias sgrp |
5f0e6fc7 | 35 | |
9ee76b5a UD |
36 | others := getent makedb |
37 | install-bin := getent makedb | |
38 | makedb-modules = xmalloc hash-string | |
39 | extra-objs += $(makedb-modules:=.o) | |
7d6a8338 | 40 | |
c3e2f19b | 41 | tests = test-netdb tst-nss-test1 |
9a1c21c4 | 42 | xtests = bug-erange |
6591c335 | 43 | |
26b4d766 UD |
44 | include ../Makeconfig |
45 | ||
6d4752d8 UD |
46 | ifeq (yes,$(build-static-nss)) |
47 | otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ | |
48 | $(resolvobjdir)/libresolv.a | |
49 | endif | |
50 | ||
5f0e6fc7 | 51 | # Specify rules for the nss_* modules. We have some services. |
2666d441 | 52 | services := files db |
5f0e6fc7 RM |
53 | |
54 | extra-libs = $(services:%=libnss_%) | |
dbe31b9a RM |
55 | # These libraries will be built in the `others' pass rather than |
56 | # the `lib' pass, because they depend on libc.so being built already. | |
57 | extra-libs-others = $(extra-libs) | |
5f0e6fc7 RM |
58 | |
59 | # The sources are found in the appropriate subdir. | |
6dbe2837 | 60 | subdir-dirs = $(services:%=nss_%) |
9ee76b5a | 61 | vpath %.c $(subdir-dirs) ../locale/programs ../intl |
5f0e6fc7 RM |
62 | |
63 | ||
aa132749 | 64 | libnss_files-routines := $(addprefix files-,$(databases)) \ |
319b9ad4 | 65 | files-initgroups files-have_o_cloexec files-init |
5f0e6fc7 | 66 | |
2666d441 UD |
67 | libnss_db-dbs := $(addprefix db-,\ |
68 | $(filter-out hosts network key alias,\ | |
9f2da732 UD |
69 | $(databases))) \ |
70 | db-initgroups | |
319b9ad4 | 71 | libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string |
2666d441 UD |
72 | generated += $(filter-out db-alias.c db-netgrp.c, \ |
73 | $(addsuffix .c,$(libnss_db-dbs))) | |
1aadea59 | 74 | |
77fb9117 UD |
75 | install-others += $(inst_vardbdir)/Makefile |
76 | ||
6ca96fe2 | 77 | # Build static module if requested |
5107cf1d | 78 | ifneq ($(build-static-nss),yes) |
40a55d20 | 79 | libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) |
2666d441 | 80 | libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) |
6ca96fe2 | 81 | endif |
5f0e6fc7 RM |
82 | |
83 | include ../Rules | |
84 | ||
85 | ||
6d4752d8 UD |
86 | ifeq (yes,$(build-static-nss)) |
87 | $(objpfx)getent: $(objpfx)libnss_files.a | |
88 | endif | |
89 | ||
9ee76b5a UD |
90 | ifeq (yes,$(have-selinux)) |
91 | LDLIBS-makedb := -lselinux | |
92 | endif | |
93 | ||
8a594e3c RM |
94 | # Depend on libc.so so a DT_NEEDED is generated in the shared objects. |
95 | # This ensures they will load libc.so for needed symbols if loaded by | |
96 | # a statically-linked program that hasn't already loaded it. | |
7b57bfe5 UD |
97 | libnss-libc = $(common-objpfx)linkobj/libc.so |
98 | $(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \ | |
639c3248 | 99 | $(common-objpfx)libc_nonshared.a |
c3e2f19b | 100 | |
2666d441 UD |
101 | $(objpfx)libnss_db.so: $(objpfx)libnss_files.so |
102 | ||
103 | $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c | |
104 | @rm -f $@.new | |
105 | (echo '#define EXTERN_PARSER';\ | |
106 | echo '#define GENERIC "../nss_db/db-XXX.c"';\ | |
107 | echo '#include "$<"') > $@.new | |
108 | mv -f $@.new $@ | |
109 | ||
c3e2f19b | 110 | |
9ee76b5a UD |
111 | $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o) |
112 | ||
77fb9117 UD |
113 | $(inst_vardbdir)/Makefile: db-Makefile $(+force) |
114 | $(do-install) | |
115 | ||
c3e2f19b UD |
116 | CFLAGS-nss_test1.c = -DNOT_IN_libc=1 |
117 | $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \ | |
118 | $(common-objpfx)libc_nonshared.a | |
119 | $(build-module) | |
120 | $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so | |
121 | $(make-link) | |
122 | $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version) |