Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / unix / sysv / linux / Makefile
blob234d5a747ab2226e20a6208222b2aa3d51fd1591
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),socket)
15 sysdep_routines += internal_accept4 internal_recvmmsg internal_sendmmsg
16 endif
18 ifeq ($(subdir),misc)
19 include $(firstword $(wildcard $(sysdirs:=/sysctl.mk)))
21 sysdep_routines += clone llseek umount umount2 readahead \
22 setfsuid setfsgid makedev epoll_pwait signalfd \
23 eventfd eventfd_read eventfd_write prlimit
25 CFLAGS-gethostid.c = -fexceptions
26 CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=0x80000000-__getpagesize()"
28 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
29 sys/klog.h sys/kdaemon.h \
30 sys/user.h sys/procfs.h sys/prctl.h \
31 sys/kd.h sys/soundcard.h sys/vt.h \
32 sys/quota.h sys/fsuid.h \
33 scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
34 sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
35 bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
36 sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
37 bits/signalfd.h bits/timerfd.h bits/epoll.h \
38 bits/socket_type.h bits/syscall.h bits/sysctl.h \
39 bits/mman-linux.h
41 tests += tst-clone tst-fanotify
43 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
45 # If there is more than one syscall list for different architecture
46 # variants, the CPU/Makefile defines abi-variants to be a list of names
47 # for those variants (e.g. 32 64), and, for each variant, defines
48 # abi-$(variant)-options to be compiler options to cause <asm/unistd.h>
49 # to define the desired list of syscalls and abi-$(variant)-condition to
50 # be the condition for those options to use in a C #if condition.
51 # abi-includes may be defined to a list of headers to include
52 # in the generated header, if the default does not suffice.
54 # The generated header is compiled with `-ffreestanding' to avoid any
55 # circular dependencies against the installed implementation headers.
56 # Such a dependency would require the implementation header to be
57 # installed before the generated header could be built (See bug 15711).
58 # In current practice the generated header dependencies do not include
59 # any of the implementation headers removed by the use of `-ffreestanding'.
61 $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/syscall.h
62 $(make-target-directory)
63 { \
64 echo '/* Generated at libc build time from kernel syscall list. */';\
65 echo ''; \
66 echo '#ifndef _SYSCALL_H'; \
67 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
68 echo '#endif'; \
69 echo ''; \
70 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
71 echo ''; \
72 $(if $(abi-variants), \
73 $(foreach v,$(abi-variants),\
74 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
75 -x c $(sysincludes) $< $(abi-$(v)-options) \
76 -D_LIBC -dM | \
77 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
78 LC_ALL=C sort > $(@:.d=.h).new$(v); \
79 $(if $(abi-$(v)-condition),\
80 echo '#if $(abi-$(v)-condition)';) \
81 cat $(@:.d=.h).new$(v); \
82 $(if $(abi-$(v)-condition),echo '#endif';) \
83 rm -f $(@:.d=.h).new$(v); \
84 ), \
85 $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
86 -x c $(sysincludes) $< \
87 -D_LIBC -dM | \
88 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
89 LC_ALL=C sort;) \
90 } > $(@:.d=.h).new
91 mv -f $(@:.d=.h).new $(@:.d=.h)
92 ifdef abi-variants
93 ifneq (,$(objpfx))
94 sed $(sed-remove-objpfx) \
95 $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) > $(@:.h=.d)-t3
96 else
97 cat $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v)) \
98 > $(@:.h=.d)-t3
99 endif
100 rm -f $(foreach v,$(abi-variants),$(@:.h=.d)-t$(v))
101 mv -f $(@:.h=.d)-t3 $(@:.h=.d)
102 else
103 mv -f $(@:.h=.d)-t $(@:.h=.d)
104 endif
106 ifndef no_deps
107 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
108 -include $(objpfx)bits/syscall.d
109 endif
110 generated += bits/syscall.h bits/syscall.d
111 endif
113 ifeq ($(subdir),time)
114 sysdep_headers += sys/timex.h bits/timex.h
116 sysdep_routines += ntp_gettime ntp_gettimex
117 endif
119 ifeq ($(subdir),socket)
120 sysdep_headers += net/if_ppp.h net/ppp-comp.h \
121 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
122 net/if_slip.h net/if_packet.h net/if_shaper.h
123 sysdep_routines += cmsg_nxthdr
124 endif
126 ifeq ($(subdir),sunrpc)
127 sysdep_headers += nfs/nfs.h
128 endif
130 ifeq ($(subdir),termios)
131 sysdep_headers += termio.h
132 endif
134 ifeq ($(subdir),posix)
135 sysdep_headers += bits/initspin.h
137 sysdep_routines += exit-thread sched_getcpu
139 tests += tst-getcpu
140 endif
142 ifeq ($(subdir),inet)
143 sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
144 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
145 netrom/netrom.h netpacket/packet.h netrose/rose.h \
146 neteconet/ec.h netiucv/iucv.h
147 endif
149 # Don't compile the ctype glue code, since there is no old non-GNU C library.
150 inhibit-glue = yes
152 ifeq ($(subdir),dirent)
153 sysdep_routines += getdirentries getdirentries64
154 endif
156 ifeq ($(subdir),nis)
157 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
158 endif
160 ifeq ($(subdir),io)
161 sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
162 sync_file_range fallocate fallocate64
163 sysdep_headers += bits/fcntl-linux.h
164 endif
166 ifeq ($(subdir),elf)
167 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
168 dl-fxstatat64
170 CPPFLAGS-lddlibc4 += -DNOT_IN_libc
171 endif
173 ifeq ($(subdir),rt)
174 CFLAGS-mq_send.c += -fexceptions
175 CFLAGS-mq_receive.c += -fexceptions
176 endif
178 ifeq ($(subdir),nscd)
179 sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY -DHAVE_NETLINK
180 CFLAGS-gai.c += -DNEED_NETLINK
181 endif