Makefile 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. include $(firstword $(wildcard $(sysdirs:=/sysctl.mk)))
  13. sysdep_routines += clone umount umount2 readahead \
  14. setfsuid setfsgid epoll_pwait signalfd \
  15. eventfd eventfd_read eventfd_write prlimit \
  16. personality epoll_wait tee vmsplice splice \
  17. open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get
  18. CFLAGS-gethostid.c = -fexceptions
  19. CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
  20. CFLAGS-vmsplice.c = -fexceptions -fasynchronous-unwind-tables
  21. CFLAGS-splice.c = -fexceptions -fasynchronous-unwind-tables
  22. CFLAGS-open_by_handle_at.c = -fexceptions -fasynchronous-unwind-tables
  23. CFLAGS-sync_file_range.c = -fexceptions -fasynchronous-unwind-tables
  24. CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
  25. sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
  26. sys/klog.h \
  27. sys/user.h sys/prctl.h \
  28. sys/kd.h sys/soundcard.h sys/vt.h \
  29. sys/quota.h sys/fsuid.h \
  30. scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
  31. sys/raw.h sys/personality.h sys/epoll.h \
  32. bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
  33. sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
  34. bits/signalfd.h bits/timerfd.h bits/epoll.h \
  35. bits/socket_type.h bits/syscall.h bits/sysctl.h \
  36. bits/mman-linux.h bits/mman-shared.h bits/ptrace-shared.h \
  37. bits/siginfo-arch.h bits/siginfo-consts-arch.h \
  38. bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
  39. bits/procfs-prregset.h bits/mman-map-flags-generic.h \
  40. bits/msq-pad.h bits/sem-pad.h bits/shmlba.h bits/shm-pad.h \
  41. bits/termios-struct.h bits/termios-c_cc.h \
  42. bits/termios-c_iflag.h bits/termios-c_oflag.h \
  43. bits/termios-baud.h bits/termios-c_cflag.h \
  44. bits/termios-c_lflag.h bits/termios-tcflow.h \
  45. bits/termios-misc.h
  46. tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  47. tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
  48. test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
  49. tst-rlimit-infinity tst-ofdlocks
  50. tests-internal += tst-ofdlocks-compat
  51. # Generate the list of SYS_* macros for the system calls (__NR_*
  52. # macros). The file syscall-names.list contains all possible system
  53. # call names, and the generated header file produces SYS_* macros for
  54. # the __NR_* macros which are actually defined.
  55. generated += bits/syscall.h
  56. $(objpfx)bits/syscall.h: \
  57. ../sysdeps/unix/sysv/linux/gen-syscall-h.awk \
  58. ../sysdeps/unix/sysv/linux/syscall-names.list
  59. $(make-target-directory)
  60. LC_ALL=C $(AWK) -f $^ > $@-tmp
  61. $(move-if-change) $@-tmp $@
  62. before-compile += $(objpfx)bits/syscall.h
  63. # All macros defined by <sys/syscall.h>. Include <bits/syscall.h>
  64. # explicitly because <sys/sycall.h> skips it if _LIBC is defined.
  65. $(objpfx)tst-syscall-list-macros.list: \
  66. $(objpfx)bits/syscall.h ../sysdeps/unix/sysv/linux/sys/syscall.h
  67. printf '#include <linux/version.h>\n\
  68. #include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \
  69. $(CC) -E -o $@-tmp $(CFLAGS) $(CPPFLAGS) -x c - -dM
  70. $(move-if-change) $@-tmp $@
  71. # __NR_* system call names. Used by the test below.
  72. $(objpfx)tst-syscall-list-nr.list: \
  73. ../sysdeps/unix/sysv/linux/filter-nr-syscalls.awk \
  74. $(objpfx)tst-syscall-list-macros.list
  75. LC_ALL=C $(AWK) -f $^ > $@-tmp
  76. $(move-if-change) $@-tmp $@
  77. # SYS_* system call names. Used by the test below.
  78. $(objpfx)tst-syscall-list-sys.list: $(objpfx)tst-syscall-list-macros.list
  79. LC_ALL=C $(AWK) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@-tmp
  80. $(move-if-change) $@-tmp $@
  81. tests-special += $(objpfx)tst-syscall-list.out
  82. $(objpfx)tst-syscall-list.out: \
  83. ../sysdeps/unix/sysv/linux/tst-syscall-list.sh \
  84. $(objpfx)tst-syscall-list-macros.list \
  85. $(objpfx)tst-syscall-list-nr.list \
  86. $(objpfx)tst-syscall-list-sys.list
  87. $(BASH) $^ $(AWK) > $@; $(evaluate-test)
  88. # Separate object file for access to the constant from the UAPI header.
  89. $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
  90. $(objpfx)tst-pkey: $(shared-thread-library)
  91. tests-special += $(objpfx)tst-mman-consts.out
  92. $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
  93. PYTHONPATH=../scripts \
  94. $(PYTHON) ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
  95. --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
  96. -DMODULE_NAME=testsuite, \
  97. $(CPPFLAGS))" \
  98. < /dev/null > $@ 2>&1; $(evaluate-test)
  99. endif # $(subdir) == misc
  100. ifeq ($(subdir),time)
  101. sysdep_headers += sys/timex.h bits/timex.h
  102. sysdep_routines += ntp_gettime ntp_gettimex
  103. endif
  104. ifeq ($(subdir),signal)
  105. tests-special += $(objpfx)tst-signal-numbers.out
  106. # Depending on signal.o* is a hack. What we actually want is a dependency
  107. # on signal.h and everything it includes. That's impractical to write
  108. # in this context, but signal.c includes signal.h and not much else so it'll
  109. # be conservatively correct.
  110. $(objpfx)tst-signal-numbers.out: \
  111. ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
  112. $(objpfx)signal.o*
  113. PYTHONPATH=../scripts \
  114. $(PYTHON) ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
  115. --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
  116. -DMODULE_NAME=testsuite, \
  117. $(CPPFLAGS))" \
  118. < /dev/null > $@ 2>&1; $(evaluate-test)
  119. endif
  120. ifeq ($(subdir),socket)
  121. sysdep_headers += net/if_ppp.h net/ppp-comp.h \
  122. net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
  123. net/if_slip.h net/if_packet.h net/if_shaper.h
  124. sysdep_routines += cmsg_nxthdr
  125. CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
  126. CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
  127. endif
  128. ifeq ($(subdir),sunrpc)
  129. sysdep_headers += nfs/nfs.h
  130. endif
  131. ifeq ($(subdir),termios)
  132. sysdep_headers += termio.h
  133. endif
  134. ifeq ($(subdir),posix)
  135. sysdep_headers += bits/initspin.h
  136. sysdep_routines += sched_getcpu oldglob getcpu
  137. tests += tst-affinity tst-affinity-pid
  138. tests-static := tst-affinity-static
  139. tests += $(tests-static)
  140. CFLAGS-fork.c = $(libio-mtsafe)
  141. CFLAGS-getpid.o = -fomit-frame-pointer
  142. CFLAGS-getpid.os = -fomit-frame-pointer
  143. endif
  144. ifeq ($(subdir),inet)
  145. sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
  146. netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
  147. netrom/netrom.h netpacket/packet.h netrose/rose.h \
  148. neteconet/ec.h netiucv/iucv.h
  149. sysdep_routines += netlink_assert_response
  150. endif
  151. # Don't compile the ctype glue code, since there is no old non-GNU C library.
  152. inhibit-glue = yes
  153. ifeq ($(subdir),dirent)
  154. sysdep_routines += getdirentries getdirentries64
  155. tests-internal += tst-readdir64-compat
  156. endif
  157. ifeq ($(subdir),nis)
  158. CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
  159. endif
  160. ifeq ($(subdir),io)
  161. sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
  162. sync_file_range fallocate fallocate64 \
  163. close_nocancel fcntl_nocancel nanosleep_nocancel \
  164. open_nocancel open64_nocancel \
  165. openat_nocancel openat64_nocancel \
  166. pause_nocancel read_nocancel waitpid_nocancel \
  167. write_nocancel statx_cp
  168. sysdep_headers += bits/fcntl-linux.h
  169. tests += tst-fallocate tst-fallocate64
  170. endif
  171. ifeq ($(subdir),elf)
  172. sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
  173. dl-fxstatat64
  174. libof-lddlibc4 = lddlibc4
  175. others += pldd
  176. install-bin += pldd
  177. $(objpfx)pldd: $(objpfx)xmalloc.o
  178. endif
  179. ifeq ($(subdir),rt)
  180. CFLAGS-mq_send.c += -fexceptions
  181. CFLAGS-mq_receive.c += -fexceptions
  182. endif
  183. ifeq ($(subdir),nscd)
  184. sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_INOTIFY -DHAVE_NETLINK
  185. CFLAGS-gai.c += -DNEED_NETLINK
  186. endif
  187. ifeq ($(subdir),nptl)
  188. tests += tst-align-clone tst-getpid1 \
  189. tst-thread-affinity-pthread tst-thread-affinity-pthread2 \
  190. tst-thread-affinity-sched
  191. tests-internal += tst-setgetname
  192. endif