PowerPC: Change sched_getcpu to use vDSO getcpu instead of syscall.
[glibc.git] / nss / Makefile
blobeecf57e205d3d6beafd7d0e48cb5bb6826f378ac
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.
22 subdir := nss
24 headers := nss.h
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
42 xtests = bug-erange
44 include ../Makeconfig
46 # Specify rules for the nss_* modules. We have some services.
47 services := files db
49 extra-libs = $(services:%=libnss_%)
50 # These libraries will be built in the `others' pass rather than
51 # the `lib' pass, because they depend on libc.so being built already.
52 extra-libs-others = $(extra-libs)
54 # The sources are found in the appropriate subdir.
55 subdir-dirs = $(services:%=nss_%)
56 vpath %.c $(subdir-dirs) ../locale/programs ../intl
59 libnss_files-routines := $(addprefix files-,$(databases)) \
60 files-initgroups files-have_o_cloexec files-init
62 libnss_db-dbs := $(addprefix db-,\
63 $(filter-out hosts network key alias,\
64 $(databases))) \
65 db-initgroups
66 libnss_db-routines := $(libnss_db-dbs) db-open db-init hash-string
67 generated += $(filter-out db-alias.c db-netgrp.c, \
68 $(addsuffix .c,$(libnss_db-dbs)))
70 install-others += $(inst_vardbdir)/Makefile
72 # Build static module into libc if requested
73 libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
74 libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
75 ifeq ($(build-static-nss),yes)
76 routines += $(libnss_files-routines)
77 static-only-routines += $(libnss_files-routines)
78 tests-static = tst-nss-static
79 tests += $(tests-static)
80 endif
82 include ../Rules
84 ifeq (yes,$(have-selinux))
85 LDLIBS-makedb := -lselinux
86 endif
88 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
89 # This ensures they will load libc.so for needed symbols if loaded by
90 # a statically-linked program that hasn't already loaded it.
91 libnss-libc = $(common-objpfx)linkobj/libc.so
92 $(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \
93 $(common-objpfx)libc_nonshared.a
95 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
97 $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
98 @rm -f $@.new
99 (echo '#define EXTERN_PARSER';\
100 echo '#define GENERIC "../nss_db/db-XXX.c"';\
101 echo '#include "$<"') > $@.new
102 mv -f $@.new $@
105 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
107 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
108 $(do-install)
110 CFLAGS-nss_test1.c = -DNOT_IN_libc=1
111 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \
112 $(common-objpfx)libc_nonshared.a
113 $(build-module)
114 ifdef libnss_test1.so-version
115 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
116 $(make-link)
117 endif
118 $(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)