Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux
  2. .if ${MACHINE_CPUARCH} == "amd64"
  3. .PATH: ${SRCTOP}/sys/x86/linux
  4. .endif
  5. KMOD= linux64
  6. SRCS= linux_dummy_machdep.c \
  7. linux_elf64.c \
  8. linux_event.c \
  9. linux_file.c \
  10. linux_fork.c \
  11. linux_futex.c \
  12. linux_getcwd.c \
  13. linux_ioctl.c \
  14. linux_ipc.c \
  15. linux_machdep.c \
  16. linux_misc.c \
  17. linux_ptrace.c \
  18. linux_rseq.c \
  19. linux_signal.c \
  20. linux_socket.c \
  21. linux_stats.c \
  22. linux_syscalls.c \
  23. linux_sysctl.c \
  24. linux_sysent.c \
  25. linux_sysvec.c \
  26. linux_time.c \
  27. linux_vdso.c \
  28. linux_timer.c \
  29. linux_xattr.c \
  30. opt_ktrace.h \
  31. opt_inet6.h \
  32. opt_posix.h \
  33. bus_if.h \
  34. device_if.h \
  35. vnode_if.h \
  36. linux_support.S \
  37. linux_vdso_inc.S
  38. .if ${MACHINE_CPUARCH} == "amd64"
  39. SRCS+= linux_dummy_x86.c
  40. .endif
  41. DPSRCS= assym.inc linux_genassym.c
  42. # XXX: for assym.inc
  43. SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
  44. CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \
  45. genassym.o linux_vdso_gtod.o linux_vdso.so.o
  46. linux_assym.h: linux_genassym.o
  47. sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
  48. .if ${MACHINE_CPUARCH} == "amd64"
  49. VDSOFLAGS=-mcmodel=small -msoft-float
  50. VDSODEPS=linux_vdso_gettc_x86.inc
  51. .elif ${MACHINE_CPUARCH} == "aarch64"
  52. # The Linux uses tiny memory model, but our ld does not know about
  53. # some of relocation types which is generated by cc
  54. VDSOFLAGS=-mgeneral-regs-only -mcmodel=small -ffixed-x18
  55. .endif
  56. linux_locore.o: linux_assym.h assym.inc
  57. ${CC} -c -x assembler-with-cpp -DLOCORE \
  58. -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \
  59. -nostdinc -fasynchronous-unwind-tables \
  60. -fno-omit-frame-pointer -foptimize-sibling-calls \
  61. -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \
  62. ${.IMPSRC} -o ${.TARGET}
  63. linux_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS}
  64. ${CC} -c -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \
  65. -nostdinc -fasynchronous-unwind-tables \
  66. -fno-omit-frame-pointer -foptimize-sibling-calls \
  67. -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \
  68. ${.IMPSRC} -o ${.TARGET}
  69. linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o
  70. ${LD} --shared --eh-frame-hdr -soname=linux-vdso.so.1 \
  71. --no-undefined --hash-style=both -warn-common -nostdlib \
  72. --strip-debug -s --build-id=sha1 -Bsymbolic \
  73. -T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \
  74. -o ${.TARGET} ${.ALLSRC:M*.o}
  75. linux_vdso_inc.o: linux_vdso.so.o
  76. linux_support.o: linux_support.S assym.inc linux_assym.h
  77. ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
  78. ${.ALLSRC:M*.S:u} -o ${.TARGET}
  79. linux_genassym.o: offset.inc
  80. ${CC} -c ${CFLAGS:N-flto*:N-fno-common:N-fsanitize*:N-fno-sanitize*} \
  81. -fcommon ${.IMPSRC}
  82. .if !defined(KERNBUILDDIR)
  83. .warning Building Linuxulator outside of a kernel does not make sense
  84. .endif
  85. EXPORT_SYMS= YES
  86. .include <bsd.kmod.mk>