Miscellaneous low-risk changes preparing for _ISOMAC testsuite.
[glibc.git] / sysdeps / unix / sysv / linux / Makefile
blobfc29c54c86104094125e84d0a77d6bcb859e679e
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 umount umount2 readahead \
18 setfsuid setfsgid epoll_pwait signalfd \
19 eventfd eventfd_read eventfd_write prlimit \
20 personality
22 CFLAGS-gethostid.c = -fexceptions
23 CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
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
45 tests += tst-clone tst-clone2 tst-fanotify tst-personality tst-quota \
46 tst-sync_file_range
48 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
50 # If there is more than one syscall list for different architecture
51 # variants, the CPU/Makefile defines abi-variants to be a list of names
52 # for those variants (e.g. 32 64), and, for each variant, defines
53 # abi-$(variant)-options to be compiler options to cause <asm/unistd.h>
54 # to define the desired list of syscalls and abi-$(variant)-condition to
55 # be the condition for those options to use in a C #if condition.
56 # abi-includes may be defined to a list of headers to include
57 # in the generated header, if the default does not suffice.
59 # The generated header is compiled with `-ffreestanding' to avoid any
60 # circular dependencies against the installed implementation headers.
61 # Such a dependency would require the implementation header to be
62 # installed before the generated header could be built (See bug 15711).
63 # In current practice the generated header dependencies do not include
64 # any of the implementation headers removed by the use of `-ffreestanding'.
66 $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/syscall.h
67 $(make-target-directory)
68 { \
69 echo '/* Generated at libc build time from kernel syscall list. */';\
70 echo ''; \
71 echo '#ifndef _SYSCALL_H'; \
72 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
73 echo '#endif'; \
74 echo ''; \
75 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
76 echo ''; \
77 $(if $(abi-variants), \
78 $(foreach v,$(abi-variants),\
79 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
80 -x c $(sysincludes) $< $(abi-$(v)-options) \
81 -D_LIBC -dM | \
82 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
83 LC_ALL=C sort > $(@:.d=.h).new$(v); \
84 $(if $(abi-$(v)-condition),\
85 echo '#if $(abi-$(v)-condition)';) \
86 cat $(@:.d=.h).new$(v); \
87 $(if $(abi-$(v)-condition),echo '#endif';) \
88 rm -f $(@:.d=.h).new$(v); \
89 ), \
90 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
91 -x c $(sysincludes) $< \
92 -D_LIBC -dM | \
93 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
94 LC_ALL=C sort;) \
95 } > $(@:.d=.h).new
96 mv -f $(@:.d=.h).new $(@:.d=.h)
97 ifdef abi-variants
98 ifneq (,$(objpfx))
99 sed $(sed-remove-objpfx) \
100 $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) > $(@:.h=.d)-t3
101 else
102 cat $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) \
103 > $(@:.h=.d)-t3
104 endif
105 rm -f $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v))
106 mv -f $(@:.h=.d)-t3 $(@:.h=.d)
107 else
108 mv -f $(@:.h=.d)-t $(@:.h=.d)
109 endif
111 ifndef no_deps
112 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
113 -include $(objpfx)bits/syscall.d
114 endif
115 generated += bits/syscall.h bits/syscall.d
116 endif
118 ifeq ($(subdir),time)
119 sysdep_headers += sys/timex.h bits/timex.h
121 sysdep_routines += ntp_gettime ntp_gettimex
122 endif
124 ifeq ($(subdir),socket)
125 sysdep_headers += net/if_ppp.h net/ppp-comp.h \
126 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
127 net/if_slip.h net/if_packet.h net/if_shaper.h
128 sysdep_routines += cmsg_nxthdr
129 CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
130 CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
131 endif
133 ifeq ($(subdir),sunrpc)
134 sysdep_headers += nfs/nfs.h
135 endif
137 ifeq ($(subdir),termios)
138 sysdep_headers += termio.h
139 endif
141 ifeq ($(subdir),posix)
142 sysdep_headers += bits/initspin.h
144 sysdep_routines += sched_getcpu
146 tests += tst-affinity tst-affinity-pid
148 CFLAGS-fork.c = $(libio-mtsafe)
149 CFLAGS-getpid.o = -fomit-frame-pointer
150 CFLAGS-getpid.os = -fomit-frame-pointer
151 endif
153 ifeq ($(subdir),inet)
154 sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
155 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
156 netrom/netrom.h netpacket/packet.h netrose/rose.h \
157 neteconet/ec.h netiucv/iucv.h
158 sysdep_routines += netlink_assert_response
159 endif
161 # Don't compile the ctype glue code, since there is no old non-GNU C library.
162 inhibit-glue = yes
164 ifeq ($(subdir),dirent)
165 sysdep_routines += getdirentries getdirentries64
166 endif
168 ifeq ($(subdir),nis)
169 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
170 endif
172 ifeq ($(subdir),io)
173 sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
174 sync_file_range fallocate fallocate64
175 sysdep_headers += bits/fcntl-linux.h
177 tests += tst-fallocate tst-fallocate64
178 endif
180 ifeq ($(subdir),elf)
181 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
182 dl-fxstatat64
184 libof-lddlibc4 = lddlibc4
186 others += pldd
187 install-bin += pldd
188 $(objpfx)pldd: $(objpfx)xmalloc.o
189 endif
191 ifeq ($(subdir),rt)
192 CFLAGS-mq_send.c += -fexceptions
193 CFLAGS-mq_receive.c += -fexceptions
194 endif
196 ifeq ($(subdir),nscd)
197 sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY -DHAVE_NETLINK
198 CFLAGS-gai.c += -DNEED_NETLINK
199 endif
201 ifeq ($(subdir),nptl)
202 tests += tst-setgetname tst-align-clone tst-getpid1 \
203 tst-thread-affinity-pthread tst-thread-affinity-pthread2 \
204 tst-thread-affinity-sched
205 endif