Update.
[platform/upstream/linaro-glibc.git] / sysdeps / unix / sysv / linux / Makefile
1 ifeq ($(subdir),csu)
2 CFLAGS-init-first.c = -fkeep-inline-functions
3
4 sysdep_routines += errno-loc
5 endif
6
7 ifeq ($(subdir),db2)
8 CPPFLAGS += -DHAVE_LLSEEK=1
9 endif
10
11 ifeq ($(subdir),misc)
12 sysdep_routines += sysctl clone llseek getresuid getresgid
13
14 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
15                   sys/io.h sys/klog.h sys/kdaemon.h \
16                   sys/user.h sys/sysmacros.h sys/procfs.h sys/prctl.h \
17                   sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \
18                   sys/quota.h sys/fsuid.h bits/mman.h \
19                   scsi/sg.h scsi/scsi.h sys/pci.h sys/ultrasound.h
20
21 install-others += $(inst_includedir)/bits/syscall.h
22
23 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
24 $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
25         rm -f $(@:.h=.d)
26         { \
27          echo '/* Generated at libc build time from kernel syscall list.  */';\
28          echo ''; \
29          echo '#ifndef _SYSCALL_H'; \
30          echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
31          echo '#endif'; \
32          echo ''; \
33          SUNPRO_DEPENDENCIES='$(@:.h=.d) $(patsubst $(objpfx)%,$$(objpfx)%,\
34                                                     $(@:.d=.h) $(@:.h=.d))' \
35          $(CC) -E -x c $< -D_LIBC -dM | \
36          sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'; \
37         } > $(@:.d=.h).new
38         mv -f $(@:.d=.h).new $(@:.d=.h)
39
40 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
41         $(make-target-directory)
42         if test -r $@ && cmp -s $< $@; \
43         then echo 'bits/syscall.h unchanged'; \
44         else $(INSTALL_DATA) $< $@; fi
45
46 ifndef no_deps
47 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
48 -include $(objpfx)syscall-list.d
49 endif
50 generated += syscall-list.h syscall-list.d
51 endif
52
53 ifeq ($(subdir),time)
54 sysdep_headers += sys/timex.h
55 endif
56
57 ifeq ($(subdir),socket)
58 sysdep_headers += net/if.h net/if_ppp.h net/ppp-comp.h \
59                   net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
60                   net/if_slip.h net/if_packet.h
61 sysdep_routines += cmsg_nxthdr sa_len
62 endif
63
64 ifeq ($(subdir),sunrpc)
65 sysdep_headers += nfs/nfs.h
66 endif
67
68 ifeq ($(subdir),termios)
69 sysdep_headers += termio.h
70 endif
71
72 ifeq ($(subdir),stdio-common)
73 # Just disable the auto generation in sysdeps/generic
74 inhibit-siglist := yes
75 endif
76
77 ifeq ($(subdir),inet)
78 sysdep_headers += netinet/in_systm.h netinet/udp.h \
79                   netinet/if_fddi.h netinet/if_tr.h netinet/igmp.h \
80                   netinet/ip_fw.h  netinet/ip_icmp.h netipx/ipx.h \
81                   sys/socketvar.h netash/ash.h netax25/ax25.h netatalk/at.h \
82                   netrom/netrom.h netpacket/packet.h netrose/rose.h
83 endif
84
85 # Don't compile the ctype glue code, since there is no old non-GNU C library.
86 inhibit-glue = yes
87
88 # Tell sysdeps/posix/Makefile that we create stdio_lim.h differently.
89 inhibit-stdio_lim = yes
90
91 $(common-objpfx)bits/stdio_%.h $(common-objpfx)bits/stdio_%.d: \
92  $(..)sysdeps/unix/sysv/linux/stdio_%.h.in
93         rm -f $(@:.h=.d) $(@:.d=.h)-t
94         echo '#include <linux/limits.h>' | \
95         SUNPRO_DEPENDENCIES='$(@:.h=.d) \
96                              $(patsubst $(common-objpfx)%,$$(common-objpfx)%,\
97                                         $(@:.d=.h) $(@:.h=.d))' \
98         $(CC) -E -dM - > $(@:.d=.h)-t
99         fopen_max=`sed -n 's/^#define OPEN_MAX //p' $(@:.d=.h)-t`; \
100         filename_max=`sed -n 's/^#define PATH_MAX //p' $(@:.d=.h)-t`; \
101         if test -n "$$fopen_max" && test -n "$$filename_max"; then \
102                 sed -e "s/DEFAULT_FOPEN_MAX/$$fopen_max/" \
103                     -e "s/DEFAULT_FILENAME_MAX/$$filename_max/" $< \
104                     > $(@:.d=.h).new && \
105                 mv -f $(@:.d=.h).new $(@:.d=.h); \
106         else exit 1; fi
107 # Remove this last so that it can be examined if something went wrong.
108         rm -f $(@:.d=.h)-t
109 ifndef no_deps
110 # Get the list of dependencies (probably /usr/include/linux/limits.h).
111 -include $(common-objpfx)bits/stdio_lim.d
112 endif
113
114 ifeq ($(subdir),signal)
115 sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \
116                    rt_sigqueueinfo rt_sigaction rt_sigpending
117 endif
118
119 ifeq ($(subdir),dirent)
120 sysdep_routines += getdents64
121 endif
122
123 ifeq ($(subdir),nis)
124 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
125 endif
126
127 common-generated += bits/stdio_lim.h bits/stdio_lim.d