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