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