1 # Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011,2012
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
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.
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
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
20 # Makefile for name service switch.
26 # This is the trivial part which goes into libc itself.
27 routines
= nsswitch getnssent getnssent_r digits_dots \
28 $(addsuffix -lookup
,$(databases
))
30 # These are the databases that go through nss dispatch.
31 # Caution: if you add a database here, you must add its real name
32 # in databases.def, too.
33 databases
= proto service hosts network grp pwd rpc ethers \
34 spwd netgrp key alias sgrp
36 others
:= getent makedb
37 install-bin
:= getent makedb
38 makedb-modules
= xmalloc hash-string
39 extra-objs
+= $(makedb-modules
:=.o
)
41 tests
= test-netdb tst-nss-test1
46 ifeq (yes
,$(build-static-nss
))
47 otherlibs
+= $(nssobjdir
)/libnss_files.a
$(resolvobjdir
)/libnss_dns.a \
48 $(resolvobjdir
)/libresolv.a
51 # Specify rules for the nss_* modules. We have some services.
54 extra-libs
= $(services
:%=libnss_
%)
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
)
59 # The sources are found in the appropriate subdir.
60 subdir-dirs
= $(services
:%=nss_
%)
61 vpath
%.c
$(subdir-dirs
) ..
/locale
/programs ..
/intl
64 libnss_files-routines
:= $(addprefix files-
,$(databases
)) \
65 files-initgroups files-have_o_cloexec files-init
67 libnss_db-dbs
:= $(addprefix db-
,\
68 $(filter-out hosts network key alias
,\
71 libnss_db-routines
:= $(libnss_db-dbs
) db-open db-init hash-string
72 generated
+= $(filter-out db-alias.c db-netgrp.c
, \
73 $(addsuffix .c
,$(libnss_db-dbs
)))
75 install-others
+= $(inst_vardbdir
)/Makefile
77 # Build static module if requested
78 ifneq ($(build-static-nss
),yes
)
79 libnss_files-inhibit-o
= $(filter-out .os
,$(object-suffixes
))
80 libnss_db-inhibit-o
= $(filter-out .os
,$(object-suffixes
))
86 ifeq (yes
,$(build-static-nss
))
87 $(objpfx
)getent
: $(objpfx
)libnss_files.a
90 ifeq (yes
,$(have-selinux
))
91 LDLIBS-makedb
:= -lselinux
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.
97 libnss-libc
= $(common-objpfx
)linkobj
/libc.so
98 $(services
:%=$(objpfx
)libnss_
%.so
): $(libnss-libc
) \
99 $(common-objpfx
)libc_nonshared.a
101 $(objpfx
)libnss_db.so
: $(objpfx
)libnss_files.so
103 $(libnss_db-dbs
:%=$(objpfx
)%.c
): $(objpfx
)db-
%.c
: nss_files
/files-
%.c
105 (echo
'#define EXTERN_PARSER';\
106 echo
'#define GENERIC "../nss_db/db-XXX.c"';\
107 echo
'#include "$<"') > $@.new
111 $(objpfx
)makedb
: $(makedb-modules
:%=$(objpfx
)%.o
)
113 $(inst_vardbdir
)/Makefile
: db-Makefile
$(+force)
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
120 $(objpfx
)/libnss_test1.so
$(libnss_test1.so-version
): $(objpfx
)/libnss_test1.so
122 $(objpfx
)tst-nss-test1.out
: $(objpfx
)/libnss_test1.so
$(libnss_test1.so-version
)