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