<arpa/nameser.h>: Remove RR type classification macros [BZ #20592]
[glibc.git] / nss / Makefile
blob1f016d99c78a7433948e494c2da06c84f4b297e3
1 # Copyright (C) 1996-2016 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile for name service switch.
21 subdir := nss
23 include ../Makeconfig
25 headers := nss.h
27 # This is the trivial part which goes into libc itself.
28 routines = nsswitch getnssent getnssent_r digits_dots \
29 valid_field valid_list_field rewrite_field \
30 $(addsuffix -lookup,$(databases))
32 # These are the databases that go through nss dispatch.
33 # Caution: if you add a database here, you must add its real name
34 # in databases.def, too.
35 databases = proto service hosts network grp pwd ethers \
36 spwd netgrp alias sgrp
38 ifneq (,$(filter sunrpc,$(subdirs)))
39 databases += key rpc
40 have-sunrpc := 1
41 else
42 have-sunrpc := 0
43 endif
44 CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
46 others := getent makedb
47 install-bin := getent makedb
48 makedb-modules = xmalloc hash-string
49 extra-objs += $(makedb-modules:=.o)
51 tests-static = tst-field
52 tests = test-netdb tst-nss-test1 test-digits-dots \
53 tst-nss-getpwent bug17079 \
54 $(tests-static)
55 xtests = bug-erange
57 # Specify rules for the nss_* modules. We have some services.
58 services := files db
60 extra-libs = $(services:%=libnss_%)
61 # These libraries will be built in the `others' pass rather than
62 # the `lib' pass, because they depend on libc.so being built already.
63 extra-libs-others = $(extra-libs)
65 # The sources are found in the appropriate subdir.
66 subdir-dirs = $(services:%=nss_%)
67 vpath %.c $(subdir-dirs) ../locale/programs ../intl
70 libnss_files-routines := $(addprefix files-,$(databases)) \
71 files-initgroups files-have_o_cloexec files-init
73 libnss_db-dbs := $(addprefix db-,\
74 $(filter-out hosts network key alias,\
75 $(databases))) \
76 db-initgroups
77 libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
78 generated += $(filter-out db-alias.c db-netgrp.c, \
79 $(addsuffix .c,$(libnss_db-dbs)))
81 install-others += $(inst_vardbdir)/Makefile
83 # Build static module into libc if requested
84 libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
85 libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
86 ifeq ($(build-static-nss),yes)
87 routines += $(libnss_files-routines)
88 static-only-routines += $(libnss_files-routines)
89 tests-static += tst-nss-static
90 endif
91 extra-test-objs += nss_test1.os
93 include ../Rules
95 ifeq (yes,$(have-selinux))
96 LDLIBS-makedb := -lselinux
97 endif
99 libnss-libc = $(common-objpfx)linkobj/libc.so
100 # Target-specific variable setting to link objects using deprecated
101 # RPC interfaces with the version of libc.so that makes them available
102 # for new links:
103 $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
105 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
107 $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
108 @rm -f $@.new
109 (echo '#define EXTERN_PARSER';\
110 echo '#define GENERIC "../nss_db/db-XXX.c"';\
111 echo '#include "$<"') > $@.new
112 mv -f $@.new $@
115 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
117 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
118 $(do-install)
120 libof-nss_test1 = extramodules
121 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
122 $(build-module)
123 ifdef libnss_test1.so-version
124 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
125 $(make-link)
126 endif
127 $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)