Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # Copyright (C) 1998-2026 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3. # The GNU C Library is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU Lesser General Public
  5. # License as published by the Free Software Foundation; either
  6. # version 2.1 of the License, or (at your option) any later version.
  7. # The GNU C Library is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. # Lesser General Public License for more details.
  11. # You should have received a copy of the GNU Lesser General Public
  12. # License along with the GNU C Library; if not, see
  13. # <https://www.gnu.org/licenses/>.
  14. #
  15. # Sub-makefile for nscd portion of the library.
  16. #
  17. subdir := nscd
  18. include ../Makeconfig
  19. ifneq ($(use-nscd),no)
  20. routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
  21. nscd_initgroups nscd_getserv_r nscd_netgroup
  22. aux := nscd_helper
  23. endif
  24. # To find xmalloc.c
  25. vpath %.c ../locale/programs
  26. nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
  27. getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
  28. getsrvbynm_r getsrvbypt_r servicescache \
  29. dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
  30. xmalloc xstrdup aicache initgrcache res_hconf \
  31. netgroupcache cachedumper
  32. ifeq ($(build-nscd)$(have-thread-library),yesyes)
  33. others += nscd
  34. others-pie += nscd
  35. install-sbin := nscd
  36. extra-objs = $(nscd-modules:=.o)
  37. endif
  38. all-nscd-modules := $(nscd-modules) selinux
  39. ifeq (yes,$(have-selinux))
  40. ifeq (yes,$(have-libaudit))
  41. libaudit = -laudit
  42. ifeq (yes,$(have-libcap))
  43. libcap = -lcap
  44. endif
  45. endif
  46. nscd-modules += selinux
  47. selinux-LIBS := -lselinux $(libaudit) $(libcap)
  48. # The configure.ac check for libselinux and its headers did not use
  49. # $SYSINCLUDES. The directory specified by --with-headers usually
  50. # contains only the basic kernel interface headers, not something like
  51. # libselinux. So the simplest thing is to presume that the standard
  52. # system headers will be ok for this file.
  53. $(objpfx)nscd_stat.o: sysincludes = # nothing
  54. $(objpfx)selinux.o: sysincludes = # nothing
  55. endif
  56. LDLIBS-nscd = $(selinux-LIBS)
  57. include ../Rules
  58. CFLAGS-nscd_getpw_r.c += -fexceptions
  59. CFLAGS-nscd_getgr_r.c += -fexceptions
  60. CFLAGS-nscd_gethst_r.c += -fexceptions
  61. CFLAGS-nscd_getai.c += -fexceptions
  62. CFLAGS-nscd_initgroups.c += -fexceptions
  63. ifeq (yesyes,$(have-fpie)$(build-shared))
  64. CFLAGS-nscd += $(pie-ccflag)
  65. endif
  66. ifeq (yesyes,$(have-fpie)$(build-shared))
  67. LDFLAGS-nscd = -Wl,-z,now
  68. endif
  69. # Set libof-nscd.
  70. cpp-srcs-left := $(nscd-modules)
  71. lib := nscd
  72. include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
  73. $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
  74. ifeq ($(build-shared),yes)
  75. $(objpfx)nscd: $(shared-thread-library)
  76. else
  77. $(objpfx)nscd: $(static-thread-library)
  78. endif