Install nscd systemd files
[glibc.git] / nscd / Makefile
blob1d65c00ba26a3ef1557edd23bb87a244eaf1fe90
1 # Copyright (C) 1998-2015 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 include ../Makeconfig
25 ifneq ($(use-nscd),no)
26 routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
27 nscd_initgroups nscd_getserv_r nscd_netgroup
28 aux := nscd_helper
29 install-others = $(inst_sysconfdir)/nscd.conf
30 ifneq ($(systemd-system-unit-dir),)
31 install-others += $(inst_systemdsystemunitdir)/nscd.service
32 install-others += $(inst_libdir)/tmpfiles.d/nscd.conf
33 endif
34 endif
36 # To find xmalloc.c
37 vpath %.c ../locale/programs
39 nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
40 getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
41 getsrvbynm_r getsrvbypt_r servicescache \
42 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
43 xmalloc xstrdup aicache initgrcache gai res_hconf \
44 netgroupcache
46 ifeq ($(build-nscd)$(have-thread-library),yesyes)
48 others += nscd
49 others-pie += nscd
50 install-sbin := nscd
52 extra-objs = $(nscd-modules:=.o)
54 endif
56 all-nscd-modules := $(nscd-modules) selinux
57 ifeq (yes,$(have-selinux))
58 ifeq (yes,$(have-libaudit))
59 libaudit = -laudit
60 ifeq (yes,$(have-libcap))
61 libcap = -lcap
62 endif
63 endif
65 nscd-modules += selinux
66 selinux-LIBS := -lselinux $(libaudit) $(libcap)
68 # The configure.ac 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
75 endif
77 LDLIBS-nscd = $(selinux-LIBS)
79 include ../Rules
81 CFLAGS-nscd_getpw_r.c = -fexceptions
82 CFLAGS-nscd_getgr_r.c = -fexceptions
83 CFLAGS-nscd_gethst_r.c = -fexceptions
84 CFLAGS-nscd_getai.c = -fexceptions
85 CFLAGS-nscd_initgroups.c = -fexceptions
87 CPPFLAGS-nscd += -D_FORTIFY_SOURCE=2
89 ifeq (yesyes,$(have-fpie)$(build-shared))
90 CFLAGS-nscd += $(pie-ccflag)
91 endif
92 ifeq (yes,$(have-ssp))
93 CFLAGS-nscd += -fstack-protector
94 endif
96 ifeq (yesyes,$(have-fpie)$(build-shared))
97 LDFLAGS-nscd = -Wl,-z,now
98 endif
100 # Set libof-nscd.
101 cpp-srcs-left := $(nscd-modules)
102 lib := nscd
103 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
105 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
107 ifeq ($(build-shared),yes)
108 $(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
109 else
110 $(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
111 endif
113 $(inst_sysconfdir)/nscd.conf: nscd.conf $(+force)
114 $(do-install)
116 ifneq ($(systemd-system-unit-dir),)
117 $(inst_systemdsystemunitdir)/nscd.service: nscd.service $(+force)
118 $(do-install)
120 $(inst_libdir)/tmpfiles.d/nscd.conf: nscd.tmpfiles $(+force)
121 $(do-install)
122 endif