PageRenderTime 3468ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/sysdeps/unix/sysv/linux/Makefile

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