misc: Reformat Makefile.
[glibc.git] / misc / Makefile
blob84aa4cb0ad9ebde1351d88385f6e141a1b9c7909
1 # Copyright (C) 1991-2023 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 # <https://www.gnu.org/licenses/>.
19 # Sub-makefile for misc portion of the library.
22 subdir := misc
24 include ../Makeconfig
26 headers := \
27 sys/uio.h \
28 bits/uio-ext.h \
29 bits/uio_lim.h \
30 sys/ioctl.h \
31 bits/ioctls.h \
32 bits/ioctl-types.h \
33 sys/ptrace.h \
34 sys/file.h \
35 sys/dir.h \
36 sys/cdefs.h \
37 ar.h \
38 a.out.h \
39 libgen.h \
40 stab.h \
41 bits/stab.def \
42 sgtty.h \
43 ttyent.h \
44 paths.h \
45 sys/reboot.h \
46 sys/mman.h \
47 sys/param.h \
48 bits/param.h \
49 fstab.h \
50 mntent.h \
51 search.h \
52 err.h \
53 error.h \
54 sys/queue.h \
55 sysexits.h \
56 syscall.h \
57 sys/syscall.h \
58 sys/swap.h \
59 sys/select.h \
60 sys/sysinfo.h \
61 regexp.h \
62 bits/select.h \
63 bits/mman.h \
64 sys/xattr.h \
65 syslog.h \
66 sys/syslog.h \
67 bits/syslog.h \
68 bits/syslog-ldbl.h \
69 bits/syslog-path.h \
70 bits/error.h \
71 bits/select2.h \
72 bits/hwcap.h \
73 sys/auxv.h \
74 sys/sysmacros.h \
75 bits/sysmacros.h \
76 bits/types/struct_iovec.h \
77 bits/err-ldbl.h \
78 bits/error-ldbl.h \
79 sys/single_threaded.h \
80 # headers
82 routines := \
83 acct \
84 allocate_once \
85 atomic_wide_counter \
86 brk \
87 chflags \
88 chroot \
89 daemon \
90 dirname \
91 efgcvt \
92 efgcvt_r \
93 err \
94 error \
95 fchflags \
96 fd_to_filename \
97 fdatasync \
98 fgetxattr \
99 flistxattr \
100 fremovexattr \
101 fsetxattr \
102 fstab \
103 fsync \
104 ftruncate \
105 ftruncate64 \
106 futimes \
107 futimesat \
108 getauxval \
109 getclktck \
110 getdomain \
111 getdtsz \
112 gethostid \
113 gethostname \
114 getloadavg \
115 getpagesize \
116 getpass \
117 getsysstats \
118 getttyent \
119 getusershell \
120 getxattr \
121 gtty \
122 hsearch \
123 hsearch_r \
124 ifunc-impl-list \
125 insremque \
126 ioctl \
127 lgetxattr \
128 listxattr \
129 llistxattr \
130 lremovexattr \
131 lsearch \
132 lsetxattr \
133 lutimes \
134 madvise \
135 makedev \
136 mincore \
137 mkdtemp \
138 mkostemp \
139 mkostemp64 \
140 mkostemps \
141 mkostemps64 \
142 mkstemp \
143 mkstemp64 \
144 mkstemps \
145 mkstemps64 \
146 mktemp \
147 mlock \
148 mlockall \
149 mmap \
150 mmap64 \
151 mntent \
152 mntent_r \
153 mprotect \
154 msync \
155 munlock \
156 munlockall \
157 munmap \
158 preadv \
159 preadv2 \
160 preadv64 \
161 preadv64v2 \
162 pselect \
163 ptrace \
164 pwritev \
165 pwritev2 \
166 pwritev64 \
167 pwritev64v2 \
168 qefgcvt \
169 qefgcvt_r \
170 readv \
171 reboot \
172 regexp \
173 remap_file_pages \
174 removexattr \
175 revoke \
176 sbrk \
177 select \
178 setdomain \
179 setegid \
180 seteuid \
181 sethostid \
182 sethostname \
183 setregid \
184 setreuid \
185 setxattr \
186 single_threaded \
187 sstk \
188 stty \
189 swapoff \
190 swapon \
191 sync \
192 syncfs \
193 syscall \
194 syslog \
195 truncate \
196 truncate64 \
197 tsearch \
198 ttyslot \
199 ualarm \
200 unwind-link \
201 usleep \
202 ustat \
203 utimes \
204 vhangup \
205 writev \
206 # routines
208 generated += \
209 tst-allocate_once-mem.out \
210 tst-allocate_once.mtrace \
211 tst-error1-mem.out \
212 tst-error1.mtrace \
213 # generated
215 aux := init-misc
216 install-lib := libg.a
218 gpl2lgpl := \
219 error.c \
220 error.h \
221 # gpl2lgpl
223 tests := \
224 bug-hsearch1 \
225 bug18240 \
226 tst-dbl-efgcvt \
227 tst-dirname \
228 tst-empty \
229 tst-error1 \
230 tst-fdset \
231 tst-hsearch \
232 tst-insremque \
233 tst-ioctl \
234 tst-ldbl-efgcvt \
235 tst-ldbl-error \
236 tst-ldbl-errorfptr \
237 tst-ldbl-warn \
238 tst-makedev \
239 tst-mntent \
240 tst-mntent-autofs \
241 tst-mntent-blank-corrupt \
242 tst-mntent-blank-passno \
243 tst-mntent-escape \
244 tst-mntent2 \
245 tst-preadvwritev \
246 tst-preadvwritev2 \
247 tst-preadvwritev64 \
248 tst-preadvwritev64v2 \
249 tst-pselect \
250 tst-select \
251 tst-syscalls \
252 tst-tsearch \
253 tst-warn-wide \
254 # tests
256 tests-time64 := \
257 tst-ioctl-time64 \
258 tst-pselect-time64 \
259 tst-select-time64 \
260 # tests-time64
262 # Tests which need libdl.
263 ifeq (yes,$(build-shared))
264 tests += tst-gethostid
265 endif
267 tests-internal := \
268 tst-allocate_once \
269 tst-atomic \
270 tst-atomic-long \
271 # tests-internal
272 tests-static := tst-empty
274 # Test for the internal, non-exported __fd_to_filename function.
275 tests-internal += tst-fd_to_filename
276 tests-static += tst-fd_to_filename
278 ifeq ($(run-built-tests),yes)
279 tests-special += $(objpfx)tst-error1-mem.out \
280 $(objpfx)tst-allocate_once-mem.out
281 endif
283 tests-container := tst-syslog
285 CFLAGS-select.c += -fexceptions -fasynchronous-unwind-tables
286 CFLAGS-tsearch.c += $(uses-callbacks)
287 CFLAGS-lsearch.c += $(uses-callbacks)
288 CFLAGS-pselect.c += -fexceptions
289 CFLAGS-readv.c += -fexceptions -fasynchronous-unwind-tables
290 CFLAGS-writev.c += -fexceptions -fasynchronous-unwind-tables
291 CFLAGS-preadv.c += -fexceptions -fasynchronous-unwind-tables
292 CFLAGS-preadv64.c += -fexceptions -fasynchronous-unwind-tables
293 CFLAGS-pwritev.c += -fexceptions -fasynchronous-unwind-tables
294 CFLAGS-pwritev64.c += -fexceptions -fasynchronous-unwind-tables
295 CFLAGS-preadv2.c += -fexceptions -fasynchronous-unwind-tables
296 CFLAGS-preadv64v2.c += -fexceptions -fasynchronous-unwind-tables
297 CFLAGS-pwritev2.c += -fexceptions -fasynchronous-unwind-tables
298 CFLAGS-pwritev64v2.c += -fexceptions -fasynchronous-unwind-tables
299 CFLAGS-usleep.c += -fexceptions
300 CFLAGS-syslog.c += -fexceptions
301 CFLAGS-error.c += -fexceptions
302 CFLAGS-getpass.c += -fexceptions
303 CFLAGS-mkstemp.c += -fexceptions
304 CFLAGS-mkstemp64.c += -fexceptions
305 CFLAGS-getsysstats.c += -fexceptions
306 CFLAGS-getusershell.c += -fexceptions
307 CFLAGS-err.c += -fexceptions
308 CFLAGS-tst-tsearch.c += $(stack-align-test-flags)
309 CFLAGS-msync.c += -fexceptions -fasynchronous-unwind-tables
310 CFLAGS-fdatasync.c += -fexceptions -fasynchronous-unwind-tables
311 CFLAGS-fsync.c += -fexceptions -fasynchronous-unwind-tables
312 CFLAGS-makedev.c += $(config-cflags-wno-ignored-attributes)
313 CFLAGS-mmap64.c += $(config-cflags-wno-ignored-attributes)
315 # Called during static library initialization, so turn stack-protection
316 # off for non-shared builds.
317 CFLAGS-sbrk.o = $(no-stack-protector)
318 CFLAGS-sbrk.op = $(no-stack-protector)
319 CFLAGS-brk.o = $(no-stack-protector)
320 CFLAGS-brk.op = $(no-stack-protector)
321 CFLAGS-mmap.o = $(no-stack-protector)
322 CFLAGS-mmap.op = $(no-stack-protector)
323 CFLAGS-mmap64.o = $(no-stack-protector)
324 CFLAGS-mmap64.op = $(no-stack-protector)
326 include ../Rules
328 $(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
330 $(objpfx)tst-tsearch: $(libm)
332 tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace \
333 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
334 tst-error1-ARGS = $(objpfx)tst-error1.out
335 $(objpfx)tst-error1-mem.out: $(objpfx)tst-error1.out
336 $(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@; \
337 $(evaluate-test)
339 tst-allocate_once-ENV = MALLOC_TRACE=$(objpfx)tst-allocate_once.mtrace \
340 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
341 $(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out
342 $(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \
343 $(evaluate-test)
345 $(objpfx)tst-select: $(librt)
346 $(objpfx)tst-select-time64: $(librt)
347 $(objpfx)tst-pselect: $(librt)
348 $(objpfx)tst-pselect-time64: $(librt)