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