chiark / gitweb /
Apply https://sourceware.org/git/?p=glibc.git;a=commit;h=d5dd6189d506068ed11c8bfa1e1e...
[eglibc.git] / nss / Makefile
1 # Copyright (C) 1996-1998,2000-2002,2007,2009 Free Software Foundation, Inc.
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
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.
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
12 # Lesser General Public License for more details.
13
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
18
19 #
20 #       Makefile for name service switch.
21 #
22 include ../option-groups.mak
23
24 subdir  := nss
25
26 headers                 := nss.h
27 distribute              := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \
28                            getXXent.c getXXent_r.c databases.def \
29                            nsswitch.conf digits_dots.c function.def \
30                            gen-fixed-nsswitch.c
31
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-y             = grp pwd spwd sgrp
36 databases-$(OPTION_EGLIBC_INET) \
37                         += proto service hosts network rpc ethers \
38                            netgrp key
39 databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
40
41 # This is the trivial part which goes into libc itself.
42 routines-y              += nsswitch getnssent getnssent_r \
43                           $(addsuffix -lookup,$(databases-y))
44 routines-$(OPTION_EGLIBC_INET) += digits_dots
45
46 others                  := getent
47 install-bin             := getent
48
49 tests-$(OPTION_EGLIBC_INET) += test-netdb test-digits-dots
50 xtests-$(OPTION_EGLIBC_INET) += bug-erange
51
52 include ../Makeconfig
53
54 ifeq (yes,$(build-static-nss))
55 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
56              $(resolvobjdir)/libresolv.a
57 endif
58
59 # Specify rules for the nss_* modules.  We have some services.
60 services                := files
61
62 extra-libs              = $(services:%=libnss_%)
63 # These libraries will be built in the `others' pass rather than
64 # the `lib' pass, because they depend on libc.so being built already.
65 extra-libs-others       = $(extra-libs)
66
67 # The sources are found in the appropriate subdir.
68 subdir-dirs = $(services:%=nss_%)
69 vpath %.c $(subdir-dirs)
70
71
72 libnss_files-routines   := $(addprefix files-,$(databases-y)) \
73                            files-have_o_cloexec
74 distribute              += files-XXX.c files-parse.c
75
76
77 # Build static module if requested
78 ifneq ($(build-static-nss),yes)
79 libnss_files-inhibit-o  = $(filter-out .os,$(object-suffixes))
80 endif
81
82 ifneq ($(OPTION_EGLIBC_NSSWITCH),y)
83
84 ifndef OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
85 $(error OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG variable left unset)
86 endif
87
88 ifndef OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
89 $(error OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS variable left unset)
90 endif
91
92 ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)))
93 $(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed config file)
94 $(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG))
95 endif
96
97 ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)))
98 $(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed functions file)
99 $(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS))
100 endif
101
102 before-compile := $(objpfx)fixed-nsswitch.h
103 generated := fixed-nsswitch.h
104 $(objpfx)fixed-nsswitch.h $(objfpx)fixed-nsswitch-libs: \
105     $(objpfx)gen-fixed-nsswitch                         \
106     $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
107         $< $(objpfx)fixed-nsswitch.h                    \
108            $(objpfx)fixed-nsswitch-libs                 \
109            $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
110
111 $(objpfx)gen-fixed-nsswitch: gen-fixed-nsswitch.c       \
112     $(common-objpfx)option-groups.config                \
113     $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)
114         $(native-compile)
115 gen-fixed-nsswitch-CFLAGS =                                             \
116         -g3 -O -Wall                                                    \
117         -I $(objpfx)                                                    \
118         -DFIXED_FUNCTIONS='"$(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)"'
119 endif
120
121 include ../Rules
122
123
124 ifeq (yes,$(build-static-nss))
125 $(objpfx)getent: $(objpfx)libnss_files.a
126 endif
127
128 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
129 # This ensures they will load libc.so for needed symbols if loaded by
130 # a statically-linked program that hasn't already loaded it.
131 $(services:%=$(objpfx)libnss_%.so): $(common-objpfx)libc.so \
132                                     $(common-objpfx)libc_nonshared.a