1b2f58791SDmitry Chagin# $FreeBSD$ 2b2f58791SDmitry Chagin 348bc159fSEd Maste.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux 4b2f58791SDmitry Chagin 5b2f58791SDmitry ChaginVDSO= linux_vdso 6b2f58791SDmitry Chagin 7b2f58791SDmitry ChaginKMOD= linux64 8e16fe1c7SDmitry ChaginSRCS= linux_fork.c linux_dummy.c linux_file.c linux_event.c \ 9b2f58791SDmitry Chagin linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ 10d82de054SEdward Tomasz Napierala linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \ 11b2f58791SDmitry Chagin linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \ 12b2f58791SDmitry Chagin linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \ 136469bdcdSBrooks Davis opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ 1485059bc4SEd Maste vnode_if.h device_if.h bus_if.h \ 15b2f58791SDmitry Chagin linux_support.s 16fc2a8776SEd MasteDPSRCS= assym.inc linux_genassym.c 17b2f58791SDmitry Chagin 18fc2a8776SEd Maste# XXX: for assym.inc 19ce859641SBryan DrewerySRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h 20ce859641SBryan Drewery.if ${MACHINE_CPUARCH} == "i386" 21ce859641SBryan DrewerySRCS+= opt_apic.h 22ce859641SBryan Drewery.endif 23b2f58791SDmitry Chagin 247c28c7e8SDmitry ChaginCLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ 257c28c7e8SDmitry Chagin genassym.o 26b2f58791SDmitry Chagin 27b2f58791SDmitry ChaginOBJS= ${VDSO}.so 28b2f58791SDmitry Chagin 29b2f58791SDmitry Chaginlinux_assym.h: linux_genassym.o 30b2f58791SDmitry Chagin sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} 31b2f58791SDmitry Chagin 32*305b9efeSEd Mastelinux_locore.o: linux_locore.asm linux_assym.h 33b2f58791SDmitry Chagin ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ 34621a9c54SEd Maste -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc \ 3548bc159fSEd Maste -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ 36621a9c54SEd Maste -Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib \ 37b2f58791SDmitry Chagin ${.IMPSRC} -o ${.TARGET} 38b2f58791SDmitry Chagin 39d3b03d74SEd Maste.if ${MACHINE_CPUARCH} == "aarch64" 40d3b03d74SEd MasteOBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64 41d3b03d74SEd Maste.elif ${MACHINE_CPUARCH} == "amd64" 42d3b03d74SEd MasteOBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64 43d3b03d74SEd Maste.else 44d3b03d74SEd Maste.error ${MACHINE_CPUARCH} not yet supported by linux64 45d3b03d74SEd Maste.endif 46b2f58791SDmitry Chagin${VDSO}.so: linux_locore.o 47d3b03d74SEd Maste ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \ 48d3b03d74SEd Maste linux_locore.o ${.TARGET} 491a8ea9fbSDmitry Chagin strip -N _binary_linux_locore_o_size ${.TARGET} 50b2f58791SDmitry Chagin 51fc2a8776SEd Mastelinux_support.o: assym.inc linux_assym.h 52b2f58791SDmitry Chagin ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 53b2f58791SDmitry Chagin ${.IMPSRC} -o ${.TARGET} 54b2f58791SDmitry Chagin 55ccca101fSBryan Drewerylinux_genassym.o: offset.inc 560e8b3ab3SEd Maste ${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC} 57b2f58791SDmitry Chagin 586e4cf32eSDmitry Chagin.if !defined(KERNBUILDDIR) 596e4cf32eSDmitry Chagin.warning Building Linuxulator outside of a kernel does not make sense 606e4cf32eSDmitry Chagin.endif 616e4cf32eSDmitry Chagin 62b2f58791SDmitry Chagin.include <bsd.kmod.mk> 63