Debian Codegraph @

login/Makefile

raw symbols SCIP
1 # Copyright (C) 1996-2026 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 # <https://www.gnu.org/licenses/>.
17
18 #
19 # Sub-makefile for login portion of the library.
20 #
21
22 subdir := login
23
24 include ../Makeconfig
25
26 headers := \
27 bits/utmp.h \
28 lastlog.h \
29 pty.h \
30 utmp.h \
31 # headers
32
33 routines := \
34 forkpty \
35 getlogin \
36 getlogin_r \
37 getlogin_r_chk \
38 getpt \
39 getutent \
40 getutent_r \
41 getutid \
42 getutid_r \
43 getutline \
44 getutline_r \
45 grantpt \
46 login \
47 login_tty \
48 logout \
49 logwtmp \
50 openpty \
51 ptsname \
52 ptsname_r_chk \
53 setlogin \
54 unlockpt \
55 updwtmp \
56 utmp_file \
57 utmpname \
58 # routines
59
60 CFLAGS-grantpt.c += -DLIBEXECDIR='"$(libexecdir)"'
61
62 others = utmpdump
63
64 ifeq (yes,$(build-pt-chown))
65 others += \
66 pt_chown \
67 # others
68 others-pie = \
69 pt_chown \
70 # others-pie
71 install-others-programs = $(inst_libexecdir)/pt_chown
72 endif
73
74 subdir-dirs = programs
75 vpath %.c programs
76
77 tests := \
78 tst-getlogin \
79 tst-grantpt \
80 tst-ptsname \
81 tst-pututxline-cache \
82 tst-pututxline-lockfail \
83 tst-updwtmpx \
84 tst-utmp \
85 tst-utmp-size \
86 tst-utmp-size-64 \
87 tst-utmp-unsigned \
88 tst-utmp-unsigned-64 \
89 tst-utmpx \
90 # tests
91
92 CFLAGS-tst-utmp-size-64.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
93 CFLAGS-tst-utmp-unsigned-64.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
94
95 # Empty compatibility library for old binaries.
96 extra-libs := libutil
97 extra-libs-others := $(extra-libs)
98 ifeq ($(have-GLIBC_2.33),yes)
99 libutil-routines := libutil-compat
100 libutil-shared-only-routines := libutil-compat
101
102 # Pretend that libutil.so is a linker script, so that the symbolic
103 # link is not installed.
104 install-lib-ldscripts = libutil.so
105 $(inst_libdir)/libutil.so:
106 else # not $(have-GLIBC_2.33)
107 libutil-inhibit-o = $(filter-out .o,$(object-suffixes))
108 endif # $(have-GLIBC_2.33)
109
110 include ../Rules
111
112 CFLAGS-getpt.c += -fexceptions
113
114 # Exclude fortified routines from being built with _FORTIFY_SOURCE
115 routines_no_fortify += \
116 getlogin_r \
117 ptsname_r \
118 # routines_no_fortify
119
120 ifeq (yesyes,$(have-fpie)$(build-shared))
121 pt_chown-cflags += $(pie-ccflag)
122 endif
123 ifeq (yes,$(have-libcap))
124 libcap = -lcap
125 endif
126 CFLAGS-pt_chown.c += $(pt_chown-cflags)
127 LDLIBS-pt_chown = $(libcap)
128 ifeq (yesyes,$(have-fpie)$(build-shared))
129 LDFLAGS-pt_chown = -Wl,-z,now
130 endif
131
132 # pt_chown needs to be setuid root.
133 $(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(+force)
134 $(make-target-directory)
135 -$(INSTALL_PROGRAM) -m 4755 -o root $< $@
136
137 $(objpfx)tst-pututxline-lockfail: $(shared-thread-library)
138 $(objpfx)tst-pututxline-cache: $(shared-thread-library)