Fix tst-pthread-getattr test case
[glibc.git] / nscd / Makefile
blobba052eb9deb596e36241531bb6e407ec42e436fa
1 # Copyright (C) 1998,2000,2002-2009,2011,2012 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, see
16 # <http://www.gnu.org/licenses/>.
19 # Sub-makefile for nscd portion of the library.
21 subdir := nscd
23 routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
24 nscd_initgroups nscd_getserv_r nscd_netgroup
25 aux := nscd_helper
27 include ../Makeconfig
29 # To find xmalloc.c
30 vpath %.c ../locale/programs
32 nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
33 getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
34 getsrvbynm_r getsrvbypt_r servicescache \
35 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
36 xmalloc xstrdup aicache initgrcache gai res_hconf \
37 netgroupcache
39 ifeq ($(have-thread-library),yes)
41 others += nscd
42 others-pie += nscd
43 install-sbin := nscd
45 extra-objs = $(nscd-modules:=.o)
47 endif
49 all-nscd-modules := $(nscd-modules) selinux
50 ifeq (yes,$(have-selinux))
51 ifeq (yes,$(have-libaudit))
52 libaudit = -laudit
53 ifeq (yes,$(have-libcap))
54 libcap = -lcap
55 endif
56 endif
58 nscd-modules += selinux
59 selinux-LIBS := -lselinux $(libaudit) $(libcap)
61 # The configure.in check for libselinux and its headers did not use
62 # $SYSINCLUDES. The directory specified by --with-headers usually
63 # contains only the basic kernel interface headers, not something like
64 # libselinux. So the simplest thing is to presume that the standard
65 # system headers will be ok for this file.
66 $(objpfx)nscd_stat.o: sysincludes = # nothing
67 $(objpfx)selinux.o: sysincludes = # nothing
68 endif
70 LDLIBS-nscd = $(selinux-LIBS)
72 include ../Rules
74 CFLAGS-nscd_getpw_r.c = -fexceptions
75 CFLAGS-nscd_getgr_r.c = -fexceptions
76 CFLAGS-nscd_gethst_r.c = -fexceptions
77 CFLAGS-nscd_getai.c = -fexceptions
78 CFLAGS-nscd_initgroups.c = -fexceptions
80 nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
81 ifeq (yesyes,$(have-fpie)$(build-shared))
82 nscd-cflags += $(pie-ccflag)
83 endif
84 ifeq (yes,$(have-ssp))
85 nscd-cflags += -fstack-protector
86 endif
88 CFLAGS-nscd.c += $(nscd-cflags)
89 CFLAGS-connections.c += $(nscd-cflags)
90 CFLAGS-pwdcache.c += $(nscd-cflags)
91 CFLAGS-getpwnam_r.c += $(nscd-cflags)
92 CFLAGS-getpwuid_r.c += $(nscd-cflags)
93 CFLAGS-grpcache.c += $(nscd-cflags)
94 CFLAGS-getgrnam_r.c += $(nscd-cflags)
95 CFLAGS-getgrgid_r.c += $(nscd-cflags)
96 CFLAGS-hstcache.c += $(nscd-cflags)
97 CFLAGS-gethstbyad_r.c += $(nscd-cflags)
98 CFLAGS-gethstbynm3_r.c += $(nscd-cflags)
99 CFLAGS-dbg_log.c += $(nscd-cflags)
100 CFLAGS-nscd_conf.c += $(nscd-cflags)
101 CFLAGS-nscd_stat.c += $(nscd-cflags)
102 CFLAGS-cache.c += $(nscd-cflags)
103 CFLAGS-xmalloc.c += $(nscd-cflags)
104 CFLAGS-xstrdup.c += $(nscd-cflags)
105 CFLAGS-mem.c += $(nscd-cflags)
106 CFLAGS-nscd_setup_thread.c += $(nscd-cflags)
107 CFLAGS-aicache.c += $(nscd-cflags)
108 CFLAGS-selinux.c += $(nscd-cflags)
109 CFLAGS-initgrcache.c += $(nscd-cflags)
110 CFLAGS-gai.c += $(nscd-cflags)
111 CFLAGS-servicescache.c += $(nscd-cflags)
112 CFLAGS-getsrvbynm_r.c += $(nscd-cflags)
113 CFLAGS-getsrvbypt_r.c += $(nscd-cflags)
114 CFLAGS-res_hconf.c += $(nscd-cflags)
115 CFLAGS-netgroupcache.c += $(nscd-cflags)
117 ifeq (yesyes,$(have-fpie)$(build-shared))
118 LDFLAGS-nscd = -Wl,-z,now
119 endif
121 # This makes sure -DNOT_IN_libc is passed for all these modules.
122 cpp-srcs-left := $(nscd-modules:=.c)
123 lib := nonlib
124 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
126 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
128 ifeq ($(build-shared),yes)
129 $(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \
130 $(common-objpfx)nis/libnsl.so
131 else
132 $(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \
133 $(common-objpfx)nis/libnsl.a
134 endif