]>
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 AJ |
15 | # You should have received a copy of the GNU Lesser General Public |
16 | # License along with the GNU C Library; if not, write to the Free | |
17 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | # 02111-1307 USA. | |
5f0e6fc7 RM |
19 | |
20 | # | |
21 | # Makefile for name service switch. | |
22 | # | |
23 | subdir := nss | |
24 | ||
a8874ead | 25 | headers := nss.h |
5f0e6fc7 | 26 | distribute := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \ |
14bab8de | 27 | getXXent.c getXXent_r.c databases.def \ |
7e3399b3 | 28 | nsswitch.conf digits_dots.c function.def |
5f0e6fc7 RM |
29 | |
30 | # This is the trivial part which goes into libc itself. | |
a5fdf99b | 31 | routines = nsswitch getnssent getnssent_r digits_dots \ |
8b801829 | 32 | $(addsuffix -lookup,$(databases)) |
5f0e6fc7 | 33 | |
6dbe2837 | 34 | # These are the databases that go through nss dispatch. |
a8874ead UD |
35 | # Caution: if you add a database here, you must add its real name |
36 | # in databases.def, too. | |
a8922de8 | 37 | databases = proto service hosts network grp pwd rpc ethers \ |
829fea46 | 38 | spwd netgrp key alias sgrp |
5f0e6fc7 | 39 | |
9ee76b5a UD |
40 | others := getent makedb |
41 | install-bin := getent makedb | |
42 | makedb-modules = xmalloc hash-string | |
43 | extra-objs += $(makedb-modules:=.o) | |
7d6a8338 | 44 | |
c3e2f19b | 45 | tests = test-netdb tst-nss-test1 |
9a1c21c4 | 46 | xtests = bug-erange |
6591c335 | 47 | |
26b4d766 UD |
48 | include ../Makeconfig |
49 | ||
6d4752d8 UD |
50 | ifeq (yes,$(build-static-nss)) |
51 | otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ | |
52 | $(resolvobjdir)/libresolv.a | |
53 | endif | |
54 | ||
5f0e6fc7 | 55 | # Specify rules for the nss_* modules. We have some services. |
2666d441 | 56 | services := files db |
5f0e6fc7 RM |
57 | |
58 | extra-libs = $(services:%=libnss_%) | |
dbe31b9a RM |
59 | # These libraries will be built in the `others' pass rather than |
60 | # the `lib' pass, because they depend on libc.so being built already. | |
61 | extra-libs-others = $(extra-libs) | |
5f0e6fc7 RM |
62 | |
63 | # The sources are found in the appropriate subdir. | |
6dbe2837 | 64 | subdir-dirs = $(services:%=nss_%) |
9ee76b5a | 65 | vpath %.c $(subdir-dirs) ../locale/programs ../intl |
5f0e6fc7 RM |
66 | |
67 | ||
aa132749 | 68 | libnss_files-routines := $(addprefix files-,$(databases)) \ |
319b9ad4 | 69 | files-initgroups files-have_o_cloexec files-init |
5f0e6fc7 RM |
70 | distribute += files-XXX.c files-parse.c |
71 | ||
2666d441 UD |
72 | libnss_db-dbs := $(addprefix db-,\ |
73 | $(filter-out hosts network key alias,\ | |
9f2da732 UD |
74 | $(databases))) \ |
75 | db-initgroups | |
319b9ad4 | 76 | libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string |
2666d441 UD |
77 | generated += $(filter-out db-alias.c db-netgrp.c, \ |
78 | $(addsuffix .c,$(libnss_db-dbs))) | |
79 | distribute += $(addprefix nss_db/, db-XXX.c nss_db.h) | |
1aadea59 | 80 | |
77fb9117 UD |
81 | install-others += $(inst_vardbdir)/Makefile |
82 | ||
6ca96fe2 | 83 | # Build static module if requested |
5107cf1d | 84 | ifneq ($(build-static-nss),yes) |
40a55d20 | 85 | libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) |
2666d441 | 86 | libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) |
6ca96fe2 | 87 | endif |
5f0e6fc7 RM |
88 | |
89 | include ../Rules | |
90 | ||
91 | ||
6d4752d8 UD |
92 | ifeq (yes,$(build-static-nss)) |
93 | $(objpfx)getent: $(objpfx)libnss_files.a | |
94 | endif | |
95 | ||
9ee76b5a UD |
96 | ifeq (yes,$(have-selinux)) |
97 | LDLIBS-makedb := -lselinux | |
98 | endif | |
99 | ||
8a594e3c RM |
100 | # Depend on libc.so so a DT_NEEDED is generated in the shared objects. |
101 | # This ensures they will load libc.so for needed symbols if loaded by | |
102 | # a statically-linked program that hasn't already loaded it. | |
7b57bfe5 UD |
103 | libnss-libc = $(common-objpfx)linkobj/libc.so |
104 | $(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \ | |
639c3248 | 105 | $(common-objpfx)libc_nonshared.a |
c3e2f19b | 106 | |
2666d441 UD |
107 | $(objpfx)libnss_db.so: $(objpfx)libnss_files.so |
108 | ||
109 | $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c | |
110 | @rm -f $@.new | |
111 | (echo '#define EXTERN_PARSER';\ | |
112 | echo '#define GENERIC "../nss_db/db-XXX.c"';\ | |
113 | echo '#include "$<"') > $@.new | |
114 | mv -f $@.new $@ | |
115 | ||
c3e2f19b | 116 | |
9ee76b5a UD |
117 | $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o) |
118 | ||
77fb9117 UD |
119 | $(inst_vardbdir)/Makefile: db-Makefile $(+force) |
120 | $(do-install) | |
121 | ||
c3e2f19b UD |
122 | distribute += nss_test1.c |
123 | ||
124 | CFLAGS-nss_test1.c = -DNOT_IN_libc=1 | |
125 | $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \ | |
126 | $(common-objpfx)libc_nonshared.a | |
127 | $(build-module) | |
128 | $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so | |
129 | $(make-link) | |
130 | $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version) |