xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | # Copyright (C) 1998-2016 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, see |
| 16 | # <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | # |
| 19 | # Sub-makefile for nscd portion of the library. |
| 20 | # |
| 21 | subdir := nscd |
| 22 | |
| 23 | include ../Makeconfig |
| 24 | |
| 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 | endif |
| 30 | |
| 31 | # To find xmalloc.c |
| 32 | vpath %.c ../locale/programs |
| 33 | |
| 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 \ |
| 39 | netgroupcache |
| 40 | |
| 41 | ifeq ($(build-nscd)$(have-thread-library),yesyes) |
| 42 | |
| 43 | others += nscd |
| 44 | others-pie += nscd |
| 45 | install-sbin := nscd |
| 46 | |
| 47 | extra-objs = $(nscd-modules:=.o) |
| 48 | |
| 49 | endif |
| 50 | |
| 51 | all-nscd-modules := $(nscd-modules) selinux |
| 52 | ifeq (yes,$(have-selinux)) |
| 53 | ifeq (yes,$(have-libaudit)) |
| 54 | libaudit = -laudit |
| 55 | ifeq (yes,$(have-libcap)) |
| 56 | libcap = -lcap |
| 57 | endif |
| 58 | endif |
| 59 | |
| 60 | nscd-modules += selinux |
| 61 | selinux-LIBS := -lselinux $(libaudit) $(libcap) |
| 62 | |
| 63 | # The configure.ac check for libselinux and its headers did not use |
| 64 | # $SYSINCLUDES. The directory specified by --with-headers usually |
| 65 | # contains only the basic kernel interface headers, not something like |
| 66 | # libselinux. So the simplest thing is to presume that the standard |
| 67 | # system headers will be ok for this file. |
| 68 | $(objpfx)nscd_stat.o: sysincludes = # nothing |
| 69 | $(objpfx)selinux.o: sysincludes = # nothing |
| 70 | endif |
| 71 | |
| 72 | LDLIBS-nscd = $(selinux-LIBS) |
| 73 | |
| 74 | include ../Rules |
| 75 | |
| 76 | CFLAGS-nscd_getpw_r.c = -fexceptions |
| 77 | CFLAGS-nscd_getgr_r.c = -fexceptions |
| 78 | CFLAGS-nscd_gethst_r.c = -fexceptions |
| 79 | CFLAGS-nscd_getai.c = -fexceptions |
| 80 | CFLAGS-nscd_initgroups.c = -fexceptions |
| 81 | |
| 82 | CPPFLAGS-nscd += -D_FORTIFY_SOURCE=2 |
| 83 | |
| 84 | ifeq (yesyes,$(have-fpie)$(build-shared)) |
| 85 | CFLAGS-nscd += $(pie-ccflag) |
| 86 | endif |
| 87 | CFLAGS-nscd += $(stack-protector) |
| 88 | |
| 89 | ifeq (yesyes,$(have-fpie)$(build-shared)) |
| 90 | LDFLAGS-nscd = -Wl,-z,now |
| 91 | endif |
| 92 | |
| 93 | # Set libof-nscd. |
| 94 | cpp-srcs-left := $(nscd-modules) |
| 95 | lib := nscd |
| 96 | include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) |
| 97 | |
| 98 | $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o) |
| 99 | |
| 100 | ifeq ($(build-shared),yes) |
| 101 | $(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so |
| 102 | else |
| 103 | $(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a |
| 104 | endif |