1 # Copyright (C) 1998,2000,2002,2003,2004,2005,2006,2007,2008
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, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # Sub-makefile for nscd portion of the library.
25 routines
:= nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
26 nscd_initgroups nscd_getserv_r
32 vpath
%.c ..
/locale
/programs
34 nscd-modules
:= nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
35 getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
36 getsrvbynm_r getsrvbypt_r servicescache \
37 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
38 xmalloc xstrdup aicache initgrcache gai res_hconf
40 ifeq ($(have-thread-library
),yes
)
42 ifneq (yesyes
,$(have-fpie
)$(build-shared
))
47 extra-objs
:= $(nscd-modules
:=.o
)
51 ifeq (yes
,$(build-static-nss
))
52 otherlibs
+= $(nssobjdir
)/libnss_files.a
$(resolvobjdir
)/libnss_dns.a \
53 $(resolvobjdir
)/libresolv.a
56 all-nscd-modules
:= $(nscd-modules
) selinux
57 ifeq (yes
,$(have-selinux
))
58 ifeq (yes
,$(have-libaudit
))
60 ifeq (yes
,$(have-libcap
))
65 nscd-modules
+= selinux
66 selinux-LIBS
:= -lselinux
$(libaudit
) $(libcap
)
68 # The configure.in check for libselinux and its headers did not use
69 # $SYSINCLUDES. The directory specified by --with-headers usually
70 # contains only the basic kernel interface headers, not something like
71 # libselinux. So the simplest thing is to presume that the standard
72 # system headers will be ok for this file.
73 $(objpfx
)nscd_stat.o
: sysincludes
= # nothing
74 $(objpfx
)selinux.o
: sysincludes
= # nothing
77 LDLIBS-nscd
= $(selinux-LIBS
)
79 distribute
:= nscd.h nscd-client.h dbg_log.h \
80 $(addsuffix .c
, $(filter-out xmalloc
,$(all-nscd-modules
))) \
81 nscd.conf nscd.init nscd_proto.h nscd-types.h
85 CFLAGS-nscd_getpw_r.c
= -fexceptions
86 CFLAGS-nscd_getgr_r.c
= -fexceptions
87 CFLAGS-nscd_gethst_r.c
= -fexceptions
88 CFLAGS-nscd_getai.c
= -fexceptions
89 CFLAGS-nscd_initgroups.c
= -fexceptions
91 nscd-cflags
= -DIS_IN_nscd
=1 -D_FORTIFY_SOURCE
=2
92 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
93 nscd-cflags
+= $(pie-ccflag
)
95 ifeq (yes
,$(have-ssp
))
96 nscd-cflags
+= -fstack-protector
99 CFLAGS-nscd.c
+= $(nscd-cflags
)
100 CFLAGS-connections.c
+= $(nscd-cflags
)
101 CFLAGS-pwdcache.c
+= $(nscd-cflags
)
102 CFLAGS-getpwnam_r.c
+= $(nscd-cflags
)
103 CFLAGS-getpwuid_r.c
+= $(nscd-cflags
)
104 CFLAGS-grpcache.c
+= $(nscd-cflags
)
105 CFLAGS-getgrnam_r.c
+= $(nscd-cflags
)
106 CFLAGS-getgrgid_r.c
+= $(nscd-cflags
)
107 CFLAGS-hstcache.c
+= $(nscd-cflags
)
108 CFLAGS-gethstbyad_r.c
+= $(nscd-cflags
)
109 CFLAGS-gethstbynm3_r.c
+= $(nscd-cflags
)
110 CFLAGS-dbg_log.c
+= $(nscd-cflags
)
111 CFLAGS-nscd_conf.c
+= $(nscd-cflags
)
112 CFLAGS-nscd_stat.c
+= $(nscd-cflags
)
113 CFLAGS-cache.c
+= $(nscd-cflags
)
114 CFLAGS-xmalloc.c
+= $(nscd-cflags
)
115 CFLAGS-xstrdup.c
+= $(nscd-cflags
)
116 CFLAGS-mem.c
+= $(nscd-cflags
)
117 CFLAGS-nscd_setup_thread.c
+= $(nscd-cflags
)
118 CFLAGS-aicache.c
+= $(nscd-cflags
)
119 CFLAGS-selinux.c
+= $(nscd-cflags
)
120 CFLAGS-initgrcache.c
+= $(nscd-cflags
)
121 CFLAGS-gai.c
+= $(nscd-cflags
)
122 CFLAGS-servicescache.c
+= $(nscd-cflags
)
123 CFLAGS-getsrvbynm_r.c
+= $(nscd-cflags
)
124 CFLAGS-getsrvbypt_r.c
+= $(nscd-cflags
)
125 CFLAGS-res_hconf.c
+= $(nscd-cflags
)
127 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
128 relro-LDFLAGS
+= -Wl
,-z
,now
130 $(objpfx
)nscd
: $(addprefix $(objpfx
),$(nscd-modules
:=.o
))
131 $(LINK.o
) -pie
-Wl
,-O1
$(nscd-cflags
) \
132 $(sysdep-LDFLAGS
) $(config-LDFLAGS
) $(relro-LDFLAGS
) \
133 $(extra-B-
$(@F
:lib
%.so
=%).so
) -B
$(csu-objpfx
) \
134 $(extra-B-
$(@F
:lib
%.so
=%).so
) $(load-map-file
) \
135 $(LDFLAGS
) $(LDFLAGS-
$(@F
)) \
136 -L
$(subst :, -L
,$(rpath-link
)) -Wl
,-rpath-link
=$(rpath-link
) \
137 -o
$@
$^
$(LDLIBS-nscd
) $(common-objpfx
)libc_nonshared.a
140 # This makes sure -DNOT_IN_libc is passed for all these modules.
141 cpp-srcs-left
:= $(nscd-modules
:=.c
)
143 include $(patsubst %,$(..
)cppflags-iterator.mk
,$(cpp-srcs-left
))
145 $(objpfx
)nscd
: $(nscd-modules
:%=$(objpfx
)%.o
)
147 ifeq ($(build-shared
),yes
)
148 $(objpfx
)nscd
: $(common-objpfx
)rt
/librt.so
$(shared-thread-library
) \
149 $(common-objpfx
)nis
/libnsl.so
151 $(objpfx
)nscd
: $(common-objpfx
)rt
/librt.a
$(static-thread-library
) \
152 $(common-objpfx
)nis
/libnsl.a