]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/Makefile
linux: Consolidate Linux open_by_handle_at syscall
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / Makefile
1 ifeq ($(subdir),csu)
2 sysdep_routines += errno-loc
3 endif
4
5 ifeq ($(subdir),assert)
6 CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
7 CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
8 endif
9
10 ifeq ($(subdir),malloc)
11 CFLAGS-malloc.c += -DMORECORE_CLEARS=2
12 endif
13
14 ifeq ($(subdir),misc)
15 include $(firstword $(wildcard $(sysdirs:=/sysctl.mk)))
16
17 sysdep_routines += clone umount umount2 readahead \
18 setfsuid setfsgid epoll_pwait signalfd \
19 eventfd eventfd_read eventfd_write prlimit \
20 personality epoll_wait tee vmsplice splice \
21 open_by_handle_at
22
23 CFLAGS-gethostid.c = -fexceptions
24 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
25 CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
26
27 # Note that bits/mman-linux.h is listed here though the file lives in the
28 # top-level bits/ subdirectory instead of here in sysdeps/.../linux/bits/.
29 # That is just so that other (non-Linux) configurations for whom the
30 # bits/mman-linux.h definitions work well do not have to duplicate the
31 # contents of the file. The file must still be listed in sysdep_headers
32 # here and in any non-Linux configuration that uses it; other
33 # configurations will not install the file.
34 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
35 sys/klog.h \
36 sys/user.h sys/prctl.h \
37 sys/kd.h sys/soundcard.h sys/vt.h \
38 sys/quota.h sys/fsuid.h \
39 scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
40 sys/raw.h sys/personality.h sys/epoll.h \
41 bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
42 sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
43 bits/signalfd.h bits/timerfd.h bits/epoll.h \
44 bits/socket_type.h bits/syscall.h bits/sysctl.h \
45 bits/mman-linux.h
46
47 tests += tst-clone tst-clone2 tst-fanotify tst-personality tst-quota \
48 tst-sync_file_range test-errno-linux
49
50 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
51
52 # If there is more than one syscall list for different architecture
53 # variants, the CPU/Makefile defines abi-variants to be a list of names
54 # for those variants (e.g. 32 64), and, for each variant, defines
55 # abi-$(variant)-options to be compiler options to cause <asm/unistd.h>
56 # to define the desired list of syscalls and abi-$(variant)-condition to
57 # be the condition for those options to use in a C #if condition.
58 # abi-includes may be defined to a list of headers to include
59 # in the generated header, if the default does not suffice.
60 #
61 # The generated header is compiled with `-ffreestanding' to avoid any
62 # circular dependencies against the installed implementation headers.
63 # Such a dependency would require the implementation header to be
64 # installed before the generated header could be built (See bug 15711).
65 # In current practice the generated header dependencies do not include
66 # any of the implementation headers removed by the use of `-ffreestanding'.
67
68 $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/syscall.h
69 $(make-target-directory)
70 { \
71 echo '/* Generated at libc build time from kernel syscall list. */';\
72 echo ''; \
73 echo '#ifndef _SYSCALL_H'; \
74 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
75 echo '#endif'; \
76 echo ''; \
77 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
78 echo ''; \
79 $(if $(abi-variants), \
80 $(foreach v,$(abi-variants),\
81 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
82 -x c $(sysincludes) $< $(abi-$(v)-options) \
83 -D_LIBC -dM | \
84 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
85 LC_ALL=C sort > $(@:.d=.h).new$(v); \
86 $(if $(abi-$(v)-condition),\
87 echo '#if $(abi-$(v)-condition)';) \
88 cat $(@:.d=.h).new$(v); \
89 $(if $(abi-$(v)-condition),echo '#endif';) \
90 rm -f $(@:.d=.h).new$(v); \
91 ), \
92 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
93 -x c $(sysincludes) $< \
94 -D_LIBC -dM | \
95 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
96 LC_ALL=C sort;) \
97 } > $(@:.d=.h).new
98 mv -f $(@:.d=.h).new $(@:.d=.h)
99 ifdef abi-variants
100 ifneq (,$(objpfx))
101 sed $(sed-remove-objpfx) \
102 $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) > $(@:.h=.d)-t3
103 else
104 cat $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) \
105 > $(@:.h=.d)-t3
106 endif
107 rm -f $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v))
108 mv -f $(@:.h=.d)-t3 $(@:.h=.d)
109 else
110 mv -f $(@:.h=.d)-t $(@:.h=.d)
111 endif
112
113 ifndef no_deps
114 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
115 -include $(objpfx)bits/syscall.d
116 endif
117 generated += bits/syscall.h bits/syscall.d
118 endif
119
120 ifeq ($(subdir),time)
121 sysdep_headers += sys/timex.h bits/timex.h
122
123 sysdep_routines += ntp_gettime ntp_gettimex
124 endif
125
126 ifeq ($(subdir),socket)
127 sysdep_headers += net/if_ppp.h net/ppp-comp.h \
128 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
129 net/if_slip.h net/if_packet.h net/if_shaper.h
130 sysdep_routines += cmsg_nxthdr
131 CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
132 CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
133 endif
134
135 ifeq ($(subdir),sunrpc)
136 sysdep_headers += nfs/nfs.h
137 endif
138
139 ifeq ($(subdir),termios)
140 sysdep_headers += termio.h
141 endif
142
143 ifeq ($(subdir),posix)
144 sysdep_headers += bits/initspin.h
145
146 sysdep_routines += sched_getcpu
147
148 tests += tst-affinity tst-affinity-pid
149
150 CFLAGS-fork.c = $(libio-mtsafe)
151 CFLAGS-getpid.o = -fomit-frame-pointer
152 CFLAGS-getpid.os = -fomit-frame-pointer
153 endif
154
155 ifeq ($(subdir),inet)
156 sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
157 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
158 netrom/netrom.h netpacket/packet.h netrose/rose.h \
159 neteconet/ec.h netiucv/iucv.h
160 sysdep_routines += netlink_assert_response
161 endif
162
163 # Don't compile the ctype glue code, since there is no old non-GNU C library.
164 inhibit-glue = yes
165
166 ifeq ($(subdir),dirent)
167 sysdep_routines += getdirentries getdirentries64
168 endif
169
170 ifeq ($(subdir),nis)
171 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
172 endif
173
174 ifeq ($(subdir),io)
175 sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
176 sync_file_range fallocate fallocate64
177 sysdep_headers += bits/fcntl-linux.h
178
179 tests += tst-fallocate tst-fallocate64
180 endif
181
182 ifeq ($(subdir),elf)
183 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
184 dl-fxstatat64
185
186 libof-lddlibc4 = lddlibc4
187
188 others += pldd
189 install-bin += pldd
190 $(objpfx)pldd: $(objpfx)xmalloc.o
191 endif
192
193 ifeq ($(subdir),rt)
194 CFLAGS-mq_send.c += -fexceptions
195 CFLAGS-mq_receive.c += -fexceptions
196 endif
197
198 ifeq ($(subdir),nscd)
199 sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY -DHAVE_NETLINK
200 CFLAGS-gai.c += -DNEED_NETLINK
201 endif
202
203 ifeq ($(subdir),nptl)
204 tests += tst-align-clone tst-getpid1 \
205 tst-thread-affinity-pthread tst-thread-affinity-pthread2 \
206 tst-thread-affinity-sched
207 tests-internal += tst-setgetname
208 endif