* sysdeps/unix/sysv/linux/Versions: Move sync_file_range to
[glibc.git] / sysdeps / unix / sysv / linux / Makefile
blob1d9443a5fece10c4f2165542c33fc1cdc17df3ed
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 sysdep_routines += sysctl clone llseek umount umount2 readahead \
16 setfsuid setfsgid makedev
18 CFLAGS-gethostid.c = -fexceptions
20 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
21 sys/klog.h sys/kdaemon.h \
22 sys/user.h sys/procfs.h sys/prctl.h \
23 sys/kd.h sys/soundcard.h sys/vt.h \
24 sys/quota.h sys/fsuid.h \
25 scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
26 sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
27 bits/a.out.h sys/inotify.h
29 install-others += $(inst_includedir)/bits/syscall.h
31 tests += tst-clone
33 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
34 # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
35 # we generate a file that uses <bits/wordsize.h>.
36 $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
37 $(make-target-directory)
38 { \
39 echo '/* Generated at libc build time from kernel syscall list. */';\
40 echo ''; \
41 echo '#ifndef _SYSCALL_H'; \
42 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
43 echo '#endif'; \
44 echo ''; \
45 $(CC) -E -MD -MP -MF $(@:.h=.d)-t1 -MT '$(@:.d=.h) $(@:.h=.d)' \
46 -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \
47 $(addprefix -D,$(32bit-predefine)) -D_LIBC -dM | \
48 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
49 LC_ALL=C sort > $(@:.d=.h).new32; \
50 $(CC) -E -MD -MP -MF $(@:.h=.d)-t2 -MT '$(@:.d=.h) $(@:.h=.d)' \
51 -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \
52 $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
53 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
54 LC_ALL=C sort > $(@:.d=.h).new64; \
55 if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
56 cat $(@:.d=.h).new32; \
57 else \
58 echo '#include <bits/wordsize.h>'; \
59 echo ''; \
60 LC_ALL=C comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
61 echo '#if __WORDSIZE == 64'; \
62 LC_ALL=C comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
63 echo '#else'; \
64 LC_ALL=C comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
65 echo '#endif'; \
66 fi; \
67 rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
68 } > $(@:.d=.h).new
69 mv -f $(@:.d=.h).new $(@:.d=.h)
70 ifneq (,$(objpfx))
71 sed $(sed-remove-objpfx) $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
72 else
73 cat $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
74 endif
75 rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
76 mv -f $(@:.h=.d)-t3 $(@:.h=.d)
78 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
79 $(make-target-directory)
80 if test -r $@ && cmp -s $< $@; \
81 then echo 'bits/syscall.h unchanged'; \
82 else $(INSTALL_DATA) $< $@; fi
84 ifndef no_deps
85 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
86 -include $(objpfx)syscall-list.d
87 endif
88 generated += syscall-list.h syscall-list.d
89 endif
91 ifeq ($(subdir),time)
92 sysdep_headers += sys/timex.h
94 sysdep_routines += ntp_gettime
95 endif
97 ifeq ($(subdir),socket)
98 sysdep_headers += net/if_ppp.h net/ppp-comp.h \
99 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
100 net/if_slip.h net/if_packet.h net/if_shaper.h
101 sysdep_routines += cmsg_nxthdr sa_len
102 endif
104 ifeq ($(subdir),sunrpc)
105 sysdep_headers += nfs/nfs.h
106 endif
108 ifeq ($(subdir),termios)
109 sysdep_headers += termio.h
110 endif
112 ifeq ($(subdir),posix)
113 sysdep_headers += bits/initspin.h
115 sysdep_routines += exit-thread
116 endif
118 ifeq ($(subdir),inet)
119 sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
120 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
121 netrom/netrom.h netpacket/packet.h netrose/rose.h \
122 neteconet/ec.h
123 endif
125 # Don't compile the ctype glue code, since there is no old non-GNU C library.
126 inhibit-glue = yes
128 ifeq ($(subdir),dirent)
129 sysdep_routines += getdirentries getdirentries64
130 endif
132 ifeq ($(subdir),nis)
133 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
134 endif
136 ifeq ($(subdir),io)
137 sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
138 sync_file_range
139 endif
141 ifeq ($(subdir),elf)
142 sysdep-rtld-routines += dl-brk dl-sbrk
144 CPPFLAGS-lddlibc4 += -DNOT_IN_libc
145 endif
147 ifeq ($(subdir),rt)
148 CFLAGS-mq_send.c += -fexceptions
149 CFLAGS-mq_receive.c += -fexceptions
150 endif
152 ifeq ($(subdir),nscd)
153 CFLAGS-connections.c += -DHAVE_EPOLL -DHAVE_SENDFILE
154 CFLAGS-pwdcache.c += -DHAVE_SENDFILE
155 CFLAGS-grpcache.c += -DHAVE_SENDFILE
156 CFLAGS-hstcache.c += -DHAVE_SENDFILE
157 CFLAGS-aicache.c += -DHAVE_SENDFILE
158 CFLAGS-initgrcache.c += -DHAVE_SENDFILE
159 CFLAGS-gai.c += -DNEED_NETLINK
160 endif