Replace FSF snail mail address with URLs.
[platform/upstream/glibc.git] / nss / Makefile
1 # Copyright (C) 1996-1998,2000-2002,2007,2009,2010,2011
2 # Free Software Foundation, Inc.
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
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.
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
13 # Lesser General Public License for more details.
14
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/>.
18
19 #
20 #       Makefile for name service switch.
21 #
22 subdir  := nss
23
24 headers                 := nss.h
25 distribute              := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \
26                            getXXent.c getXXent_r.c databases.def \
27                            nsswitch.conf digits_dots.c function.def
28
29 # This is the trivial part which goes into libc itself.
30 routines                = nsswitch getnssent getnssent_r digits_dots \
31                           $(addsuffix -lookup,$(databases))
32
33 # These are the databases that go through nss dispatch.
34 # Caution: if you add a database here, you must add its real name
35 # in databases.def, too.
36 databases               = proto service hosts network grp pwd rpc ethers \
37                           spwd netgrp key alias sgrp
38
39 others                  := getent makedb
40 install-bin             := getent makedb
41 makedb-modules = xmalloc hash-string
42 extra-objs              += $(makedb-modules:=.o)
43
44 tests                   = test-netdb tst-nss-test1
45 xtests                  = bug-erange
46
47 include ../Makeconfig
48
49 ifeq (yes,$(build-static-nss))
50 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
51              $(resolvobjdir)/libresolv.a
52 endif
53
54 # Specify rules for the nss_* modules.  We have some services.
55 services                := files db
56
57 extra-libs              = $(services:%=libnss_%)
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)
61
62 # The sources are found in the appropriate subdir.
63 subdir-dirs = $(services:%=nss_%)
64 vpath %.c $(subdir-dirs) ../locale/programs ../intl
65
66
67 libnss_files-routines   := $(addprefix files-,$(databases)) \
68                            files-initgroups files-have_o_cloexec files-init
69 distribute              += files-XXX.c files-parse.c
70
71 libnss_db-dbs           := $(addprefix db-,\
72                                        $(filter-out hosts network key alias,\
73                                                     $(databases))) \
74                            db-initgroups
75 libnss_db-routines      := $(libnss_db-dbs) db-open db-init hash-string
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)
79
80 install-others          += $(inst_vardbdir)/Makefile
81
82 # Build static module if requested
83 ifneq ($(build-static-nss),yes)
84 libnss_files-inhibit-o  = $(filter-out .os,$(object-suffixes))
85 libnss_db-inhibit-o     = $(filter-out .os,$(object-suffixes))
86 endif
87
88 include ../Rules
89
90
91 ifeq (yes,$(build-static-nss))
92 $(objpfx)getent: $(objpfx)libnss_files.a
93 endif
94
95 ifeq (yes,$(have-selinux))
96 LDLIBS-makedb           := -lselinux
97 endif
98
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.
102 libnss-libc = $(common-objpfx)linkobj/libc.so
103 $(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \
104                                     $(common-objpfx)libc_nonshared.a
105
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
115
116 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
117
118 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
119         $(do-install)
120
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)