148bc159fSEd Maste.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux 288588c4bSDmitry Chagin.if ${MACHINE_CPUARCH} == "amd64" 3e9b13c66SConrad Meyer.PATH: ${SRCTOP}/sys/x86/linux 4e9b13c66SConrad Meyer.endif 5b2f58791SDmitry Chagin 6b2f58791SDmitry ChaginKMOD= linux64 733178488SMitchell HorneSRCS= linux_dummy_machdep.c \ 833178488SMitchell Horne linux_elf64.c \ 933178488SMitchell Horne linux_event.c \ 1033178488SMitchell Horne linux_file.c \ 1133178488SMitchell Horne linux_fork.c \ 1233178488SMitchell Horne linux_futex.c \ 1333178488SMitchell Horne linux_getcwd.c \ 1433178488SMitchell Horne linux_ioctl.c \ 1533178488SMitchell Horne linux_ipc.c \ 1633178488SMitchell Horne linux_machdep.c \ 1733178488SMitchell Horne linux_misc.c \ 1833178488SMitchell Horne linux_ptrace.c \ 1933178488SMitchell Horne linux_rseq.c \ 2033178488SMitchell Horne linux_signal.c \ 2133178488SMitchell Horne linux_socket.c \ 2233178488SMitchell Horne linux_stats.c \ 23f396f9b6SMitchell Horne linux_syscalls.c \ 2433178488SMitchell Horne linux_sysctl.c \ 2533178488SMitchell Horne linux_sysent.c \ 2633178488SMitchell Horne linux_sysvec.c \ 2733178488SMitchell Horne linux_time.c \ 2833178488SMitchell Horne linux_vdso.c \ 2933178488SMitchell Horne linux_timer.c \ 3022dca7acSDmitry Chagin linux_xattr.c \ 311a37caebSWarner Losh opt_ktrace.h \ 32*f11c79fcSWarner Losh opt_inet6.h \ 3333178488SMitchell Horne opt_posix.h \ 3433178488SMitchell Horne bus_if.h \ 3533178488SMitchell Horne device_if.h \ 3633178488SMitchell Horne vnode_if.h \ 37bed65d85SAndrew Turner linux_support.S \ 38bed65d85SAndrew Turner linux_vdso_inc.S 3988588c4bSDmitry Chagin.if ${MACHINE_CPUARCH} == "amd64" 402b378d59SDmitry ChaginSRCS+= linux_dummy_x86.c 41e9b13c66SConrad Meyer.endif 42fc2a8776SEd MasteDPSRCS= assym.inc linux_genassym.c 43b2f58791SDmitry Chagin 44fc2a8776SEd Maste# XXX: for assym.inc 45ce859641SBryan DrewerySRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h 46b2f58791SDmitry Chagin 477c28c7e8SDmitry ChaginCLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ 489931033bSDmitry Chagin genassym.o linux_vdso_gtod.o linux_vdso.so.o 49b2f58791SDmitry Chagin 50b2f58791SDmitry Chagin 51b2f58791SDmitry Chaginlinux_assym.h: linux_genassym.o 52b2f58791SDmitry Chagin sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} 53b2f58791SDmitry Chagin 549931033bSDmitry Chagin.if ${MACHINE_CPUARCH} == "amd64" 55b0fa09a0SDmitry ChaginVDSOFLAGS=-mcmodel=small -msoft-float 569931033bSDmitry ChaginVDSODEPS=linux_vdso_gettc_x86.inc 579931033bSDmitry Chagin.elif ${MACHINE_CPUARCH} == "aarch64" 589931033bSDmitry Chagin# The Linux uses tiny memory model, but our ld does not know about 599931033bSDmitry Chagin# some of relocation types which is generated by cc 609931033bSDmitry ChaginVDSOFLAGS=-mgeneral-regs-only -mcmodel=small -ffixed-x18 619931033bSDmitry Chagin.endif 629931033bSDmitry Chagin 639931033bSDmitry Chaginlinux_locore.o: linux_assym.h assym.inc 649931033bSDmitry Chagin ${CC} -c -x assembler-with-cpp -DLOCORE \ 659931033bSDmitry Chagin -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \ 669931033bSDmitry Chagin -nostdinc -fasynchronous-unwind-tables \ 679931033bSDmitry Chagin -fno-omit-frame-pointer -foptimize-sibling-calls \ 689931033bSDmitry Chagin -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ 69b2f58791SDmitry Chagin ${.IMPSRC} -o ${.TARGET} 70b2f58791SDmitry Chagin 719931033bSDmitry Chaginlinux_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS} 729931033bSDmitry Chagin ${CC} -c -fPIC -pipe -O2 -Werror ${VDSOFLAGS} \ 739931033bSDmitry Chagin -nostdinc -fasynchronous-unwind-tables \ 749931033bSDmitry Chagin -fno-omit-frame-pointer -foptimize-sibling-calls \ 759931033bSDmitry Chagin -fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \ 769931033bSDmitry Chagin ${.IMPSRC} -o ${.TARGET} 779931033bSDmitry Chagin 789931033bSDmitry Chaginlinux_vdso.so.o: linux_locore.o linux_vdso_gtod.o 799931033bSDmitry Chagin ${LD} --shared --eh-frame-hdr -soname=linux-vdso.so.1 \ 809931033bSDmitry Chagin --no-undefined --hash-style=both -warn-common -nostdlib \ 819931033bSDmitry Chagin --strip-debug -s --build-id=sha1 -Bsymbolic \ 829931033bSDmitry Chagin -T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \ 839931033bSDmitry Chagin -o ${.TARGET} ${.ALLSRC:M*.o} 849931033bSDmitry Chagin 85bed65d85SAndrew Turnerlinux_vdso_inc.o: linux_vdso.so.o 86b2f58791SDmitry Chagin 8735548e48SEd Mastelinux_support.o: linux_support.S assym.inc linux_assym.h 88b2f58791SDmitry Chagin ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 8935548e48SEd Maste ${.ALLSRC:M*.S:u} -o ${.TARGET} 90b2f58791SDmitry Chagin 91ccca101fSBryan Drewerylinux_genassym.o: offset.inc 9212a6257aSAndrew Turner ${CC} -c ${NOSAN_CFLAGS:N-flto*:N-fno-common} -fcommon ${.IMPSRC} 93b2f58791SDmitry Chagin 946e4cf32eSDmitry Chagin.if !defined(KERNBUILDDIR) 956e4cf32eSDmitry Chagin.warning Building Linuxulator outside of a kernel does not make sense 966e4cf32eSDmitry Chagin.endif 976e4cf32eSDmitry Chagin 985bb3134aSKonstantin BelousovEXPORT_SYMS= YES 995bb3134aSKonstantin Belousov 100b2f58791SDmitry Chagin.include <bsd.kmod.mk> 101