chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / nscd / Makefile
1 # Copyright (C) 1998,2000,2002-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 #       Sub-makefile for nscd portion of the library.
21 #
22 include ../option-groups.mak
23
24 subdir  := nscd
25
26 routines-$(OPTION_EGLIBC_INET) += \
27              nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
28             nscd_initgroups nscd_getserv_r
29 aux-$(OPTION_EGLIBC_INET) += nscd_helper
30
31 include ../Makeconfig
32
33 # To find xmalloc.c
34 vpath %.c ../locale/programs
35
36 nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
37                 getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
38                 getsrvbynm_r getsrvbypt_r servicescache \
39                 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
40                 xmalloc xstrdup aicache initgrcache gai res_hconf
41 ifneq (y,$(OPTION_EGLIBC_NIS))
42 # If we haven't build libnsl.so, then we'll need to include our
43 # own copy of nis_hash.
44 nscd-modules += nis_hash
45 endif
46 ifeq ($(have-thread-library),yes)
47
48 ifneq (yesyes,$(have-fpie)$(build-shared))
49 others-$(OPTION_EGLIBC_INET) += nscd
50 endif
51 install-sbin-$(OPTION_EGLIBC_INET) += nscd
52
53 extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
54
55 endif
56
57 ifeq (yes,$(build-static-nss))
58 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
59              $(resolvobjdir)/libresolv.a
60 endif
61
62 all-nscd-modules := $(nscd-modules) selinux
63 ifeq (yes,$(have-selinux))
64 ifeq (yes,$(have-libaudit))
65 libaudit = -laudit
66 ifeq (yes,$(have-libcap))
67 libcap = -lcap
68 endif
69 endif
70
71 nscd-modules += selinux
72 selinux-LIBS := -lselinux $(libaudit) $(libcap)
73
74 # The configure.in check for libselinux and its headers did not use
75 # $SYSINCLUDES.  The directory specified by --with-headers usually
76 # contains only the basic kernel interface headers, not something like
77 # libselinux.  So the simplest thing is to presume that the standard
78 # system headers will be ok for this file.
79 $(objpfx)nscd_stat.o: sysincludes = # nothing
80 $(objpfx)selinux.o: sysincludes = # nothing
81 endif
82
83 LDLIBS-nscd = $(selinux-LIBS)
84
85 distribute := nscd.h nscd-client.h dbg_log.h \
86               $(addsuffix .c, $(filter-out xmalloc,$(all-nscd-modules))) \
87               nscd.conf nscd.init nscd_proto.h nscd-types.h \
88               nis_hash.c
89
90 include ../Rules
91
92 CFLAGS-nscd_getpw_r.c = -fexceptions
93 CFLAGS-nscd_getgr_r.c = -fexceptions
94 CFLAGS-nscd_gethst_r.c = -fexceptions
95 CFLAGS-nscd_getai.c = -fexceptions
96 CFLAGS-nscd_initgroups.c = -fexceptions
97
98 nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
99 ifeq (yesyes,$(have-fpie)$(build-shared))
100 nscd-cflags += $(pie-ccflag)
101 endif
102 ifeq (yes,$(have-ssp))
103 nscd-cflags += -fstack-protector
104 endif
105
106 CFLAGS-nscd.c += $(nscd-cflags)
107 CFLAGS-connections.c += $(nscd-cflags)
108 CFLAGS-pwdcache.c += $(nscd-cflags)
109 CFLAGS-getpwnam_r.c += $(nscd-cflags)
110 CFLAGS-getpwuid_r.c += $(nscd-cflags)
111 CFLAGS-grpcache.c += $(nscd-cflags)
112 CFLAGS-getgrnam_r.c += $(nscd-cflags)
113 CFLAGS-getgrgid_r.c += $(nscd-cflags)
114 CFLAGS-hstcache.c += $(nscd-cflags)
115 CFLAGS-gethstbyad_r.c += $(nscd-cflags)
116 CFLAGS-gethstbynm3_r.c += $(nscd-cflags)
117 CFLAGS-dbg_log.c += $(nscd-cflags)
118 CFLAGS-nscd_conf.c += $(nscd-cflags)
119 CFLAGS-nscd_stat.c += $(nscd-cflags)
120 CFLAGS-cache.c += $(nscd-cflags)
121 CFLAGS-xmalloc.c += $(nscd-cflags)
122 CFLAGS-xstrdup.c += $(nscd-cflags)
123 CFLAGS-mem.c += $(nscd-cflags)
124 CFLAGS-nscd_setup_thread.c += $(nscd-cflags)
125 CFLAGS-aicache.c += $(nscd-cflags)
126 CFLAGS-selinux.c += $(nscd-cflags)
127 CFLAGS-initgrcache.c += $(nscd-cflags)
128 CFLAGS-gai.c += $(nscd-cflags)
129 CFLAGS-servicescache.c += $(nscd-cflags)
130 CFLAGS-getsrvbynm_r.c += $(nscd-cflags)
131 CFLAGS-getsrvbypt_r.c += $(nscd-cflags)
132 CFLAGS-res_hconf.c += $(nscd-cflags)
133 CFLAGS-nis_hash.c += $(nscd-cflags)
134
135 ifeq (yesyes,$(have-fpie)$(build-shared))
136 relro-LDFLAGS += -Wl,-z,now
137
138 $(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
139         $(+link-pie)
140 endif
141
142 # This makes sure -DNOT_IN_libc is passed for all these modules.
143 cpp-srcs-left := $(nscd-modules:=.c)
144 lib := nonlib
145 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
146
147 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
148
149 ifeq ($(build-shared),yes)
150 $(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library)
151 else
152 $(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library)
153 endif
154
155 ifeq (y,$(OPTION_EGLIBC_NIS))
156 ifeq ($(build-shared),yes)
157 $(objpfx)nscd: $(common-objpfx)nis/libnsl.so
158 else
159 $(objpfx)nscd: $(common-objpfx)nis/libnsl.a
160 endif
161 endif