1 # Copyright (C) 1998,2000,2002,2003,2004,2005 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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
20 # Sub-makefile for nscd portion of the library.
24 routines
:= nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai nscd_initgroups
30 vpath
%.c ..
/locale
/programs
32 nscd-modules
:= nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
33 getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm2_r \
34 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
35 xmalloc xstrdup aicache initgrcache gai
37 ifeq ($(have-thread-library
),yes
)
39 ifneq (yesyes
,$(have-fpie
)$(build-shared
))
44 extra-objs
:= $(nscd-modules
:=.o
)
48 ifeq (yes
,$(build-static-nss
))
49 otherlibs
+= $(nssobjdir
)/libnss_files.a
$(resolvobjdir
)/libnss_dns.a \
50 $(resolvobjdir
)/libresolv.a
53 all-nscd-modules
:= $(nscd-modules
) selinux
54 ifeq (yes
,$(have-selinux
))
55 ifeq (yes
,$(have-libaudit
))
59 nscd-modules
+= selinux
60 selinux-LIBS
:= -lselinux
$(libaudit
)
63 LDLIBS-nscd
= $(selinux-LIBS
)
65 # The configure.in check for libselinux and its headers did not use
66 # $SYSINCLUDES. The directory specified by --with-headers usually
67 # contains only the basic kernel interface headers, not something like
68 # libselinux. So the simplest thing is to presume that the standard
69 # system headers will be ok for this file.
70 $(objpfx
)nscd_stat.o
: sysincludes
= # nothing
71 $(objpfx
)selinux.o
: sysincludes
= # nothing
73 distribute
:= nscd.h nscd-client.h dbg_log.h \
74 $(addsuffix .c
, $(filter-out xmalloc
,$(all-nscd-modules
))) \
75 nscd.conf nscd.init nscd_proto.h nscd-types.h
79 CFLAGS-nscd_getpw_r.c
= -fexceptions
80 CFLAGS-nscd_getgr_r.c
= -fexceptions
81 CFLAGS-nscd_gethst_r.c
= -fexceptions
82 CFLAGS-nscd_getai.c
= -fexceptions
83 CFLAGS-nscd_initgroups.c
= -fexceptions
85 nscd-cflags
= -DIS_IN_nscd
=1 -D_FORTIFY_SOURCE
=2
86 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
89 ifeq (yes
,$(have-ssp
))
90 nscd-cflags
+= -fstack-protector
93 CFLAGS-nscd.c
+= $(nscd-cflags
)
94 CFLAGS-connections.c
+= $(nscd-cflags
)
95 CFLAGS-pwdcache.c
+= $(nscd-cflags
)
96 CFLAGS-getpwnam_r.c
+= $(nscd-cflags
)
97 CFLAGS-getpwuid_r.c
+= $(nscd-cflags
)
98 CFLAGS-grpcache.c
+= $(nscd-cflags
)
99 CFLAGS-getgrnam_r.c
+= $(nscd-cflags
)
100 CFLAGS-getgrgid_r.c
+= $(nscd-cflags
)
101 CFLAGS-hstcache.c
+= $(nscd-cflags
)
102 CFLAGS-gethstbyad_r.c
+= $(nscd-cflags
)
103 CFLAGS-gethstbynm2_r.c
+= $(nscd-cflags
)
104 CFLAGS-dbg_log.c
+= $(nscd-cflags
)
105 CFLAGS-nscd_conf.c
+= $(nscd-cflags
)
106 CFLAGS-nscd_stat.c
+= $(nscd-cflags
)
107 CFLAGS-cache.c
+= $(nscd-cflags
)
108 CFLAGS-xmalloc.c
+= $(nscd-cflags
)
109 CFLAGS-xstrdup.c
+= $(nscd-cflags
)
110 CFLAGS-mem.c
+= $(nscd-cflags
)
111 CFLAGS-nscd_setup_thread.c
+= $(nscd-cflags
)
112 CFLAGS-aicache.c
+= $(nscd-cflags
)
113 CFLAGS-selinux.c
+= $(nscd-cflags
)
114 CFLAGS-initgrcache.c
+= $(nscd-cflags
)
115 CFLAGS-gai.c
+= $(nscd-cflags
)
117 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
118 ifeq (yes
,$(have-z-relro
))
119 relro-LDFLAGS
+= -Wl
,-z
,now
122 $(objpfx
)nscd
: $(addprefix $(objpfx
),$(nscd-modules
:=.o
))
123 $(LINK.o
) -pie
-Wl
,-O1
$(nscd-cflags
) \
124 $(sysdep-LDFLAGS
) $(config-LDFLAGS
) $(relro-LDFLAGS
) \
125 $(extra-B-
$(@F
:lib
%.so
=%).so
) -B
$(csu-objpfx
) \
126 $(extra-B-
$(@F
:lib
%.so
=%).so
) $(load-map-file
) \
127 $(LDFLAGS
) $(LDFLAGS-
$(@F
)) \
128 -L
$(subst :, -L
,$(rpath-link
)) -Wl
,-rpath-link
=$(rpath-link
) \
129 -o
$@
$^
$(LDLIBS-nscd
) $(common-objpfx
)libc_nonshared.a
132 # This makes sure -DNOT_IN_libc is passed for all these modules.
133 cpp-srcs-left
:= $(nscd-modules
:=.c
)
135 include $(patsubst %,$(..
)cppflags-iterator.mk
,$(cpp-srcs-left
))
137 $(objpfx
)nscd
: $(nscd-modules
:%=$(objpfx
)%.o
)
139 ifeq ($(build-shared
),yes
)
140 $(objpfx
)nscd
: $(common-objpfx
)rt
/librt.so
$(shared-thread-library
) \
141 $(common-objpfx
)nis
/libnsl.so
143 $(objpfx
)nscd
: $(common-objpfx
)rt
/librt.a
$(static-thread-library
) \
144 $(common-objpfx
)nis
/libnsl.a