]>
Commit | Line | Data |
---|---|---|
7b57bfe5 | 1 | # Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011 |
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 | 25 | distribute := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \ |
14bab8de | 26 | getXXent.c getXXent_r.c databases.def \ |
7e3399b3 | 27 | nsswitch.conf digits_dots.c function.def |
5f0e6fc7 RM |
28 | |
29 | # This is the trivial part which goes into libc itself. | |
a5fdf99b | 30 | routines = nsswitch getnssent getnssent_r digits_dots \ |
8b801829 | 31 | $(addsuffix -lookup,$(databases)) |
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. | |
a8922de8 | 36 | databases = proto service hosts network grp pwd rpc ethers \ |
829fea46 | 37 | spwd netgrp key alias sgrp |
5f0e6fc7 | 38 | |
9ee76b5a UD |
39 | others := getent makedb |
40 | install-bin := getent makedb | |
41 | makedb-modules = xmalloc hash-string | |
42 | extra-objs += $(makedb-modules:=.o) | |
7d6a8338 | 43 | |
c3e2f19b | 44 | tests = test-netdb tst-nss-test1 |
9a1c21c4 | 45 | xtests = bug-erange |
6591c335 | 46 | |
26b4d766 UD |
47 | include ../Makeconfig |
48 | ||
6d4752d8 UD |
49 | ifeq (yes,$(build-static-nss)) |
50 | otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ | |
51 | $(resolvobjdir)/libresolv.a | |
52 | endif | |
53 | ||
5f0e6fc7 | 54 | # Specify rules for the nss_* modules. We have some services. |
2666d441 | 55 | services := files db |
5f0e6fc7 RM |
56 | |
57 | extra-libs = $(services:%=libnss_%) | |
dbe31b9a RM |
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) | |
5f0e6fc7 RM |
61 | |
62 | # The sources are found in the appropriate subdir. | |
6dbe2837 | 63 | subdir-dirs = $(services:%=nss_%) |
9ee76b5a | 64 | vpath %.c $(subdir-dirs) ../locale/programs ../intl |
5f0e6fc7 RM |
65 | |
66 | ||
aa132749 | 67 | libnss_files-routines := $(addprefix files-,$(databases)) \ |
319b9ad4 | 68 | files-initgroups files-have_o_cloexec files-init |
5f0e6fc7 RM |
69 | distribute += files-XXX.c files-parse.c |
70 | ||
2666d441 UD |
71 | libnss_db-dbs := $(addprefix db-,\ |
72 | $(filter-out hosts network key alias,\ | |
9f2da732 UD |
73 | $(databases))) \ |
74 | db-initgroups | |
319b9ad4 | 75 | libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string |
2666d441 UD |
76 | generated += $(filter-out db-alias.c db-netgrp.c, \ |
77 | $(addsuffix .c,$(libnss_db-dbs))) | |
78 | distribute += $(addprefix nss_db/, db-XXX.c nss_db.h) | |
1aadea59 | 79 | |
77fb9117 UD |
80 | install-others += $(inst_vardbdir)/Makefile |
81 | ||
6ca96fe2 | 82 | # Build static module if requested |
5107cf1d | 83 | ifneq ($(build-static-nss),yes) |
40a55d20 | 84 | libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) |
2666d441 | 85 | libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) |
6ca96fe2 | 86 | endif |
5f0e6fc7 RM |
87 | |
88 | include ../Rules | |
89 | ||
90 | ||
6d4752d8 UD |
91 | ifeq (yes,$(build-static-nss)) |
92 | $(objpfx)getent: $(objpfx)libnss_files.a | |
93 | endif | |
94 | ||
9ee76b5a UD |
95 | ifeq (yes,$(have-selinux)) |
96 | LDLIBS-makedb := -lselinux | |
97 | endif | |
98 | ||
8a594e3c RM |
99 | # Depend on libc.so so a DT_NEEDED is generated in the shared objects. |
100 | # This ensures they will load libc.so for needed symbols if loaded by | |
101 | # a statically-linked program that hasn't already loaded it. | |
7b57bfe5 UD |
102 | libnss-libc = $(common-objpfx)linkobj/libc.so |
103 | $(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \ | |
639c3248 | 104 | $(common-objpfx)libc_nonshared.a |
c3e2f19b | 105 | |
2666d441 UD |
106 | $(objpfx)libnss_db.so: $(objpfx)libnss_files.so |
107 | ||
108 | $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c | |
109 | @rm -f $@.new | |
110 | (echo '#define EXTERN_PARSER';\ | |
111 | echo '#define GENERIC "../nss_db/db-XXX.c"';\ | |
112 | echo '#include "$<"') > $@.new | |
113 | mv -f $@.new $@ | |
114 | ||
c3e2f19b | 115 | |
9ee76b5a UD |
116 | $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o) |
117 | ||
77fb9117 UD |
118 | $(inst_vardbdir)/Makefile: db-Makefile $(+force) |
119 | $(do-install) | |
120 | ||
c3e2f19b UD |
121 | distribute += nss_test1.c |
122 | ||
123 | CFLAGS-nss_test1.c = -DNOT_IN_libc=1 | |
124 | $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \ | |
125 | $(common-objpfx)libc_nonshared.a | |
126 | $(build-module) | |
127 | $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so | |
128 | $(make-link) | |
129 | $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version) |