1# $FreeBSD$ 2 3.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux 4.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 5.PATH: ${SRCTOP}/sys/x86/linux 6.endif 7 8VDSO= linux_vdso 9 10KMOD= linux64 11SRCS= linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \ 12 linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ 13 linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \ 14 linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \ 15 linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \ 16 opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ 17 vnode_if.h device_if.h bus_if.h \ 18 linux_support.s 19.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 20SRCS+= linux_dummy_x86.c 21.endif 22DPSRCS= assym.inc linux_genassym.c 23 24# XXX: for assym.inc 25SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h 26.if ${MACHINE_CPUARCH} == "i386" 27SRCS+= opt_apic.h 28.endif 29 30CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ 31 genassym.o 32 33OBJS= ${VDSO}.so 34 35linux_assym.h: linux_genassym.o 36 sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} 37 38linux_locore.o: linux_locore.asm linux_assym.h 39 ${CC} ${CCLDFLAGS} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ 40 -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -fPIC -nostdinc \ 41 -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ 42 -Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib \ 43 ${.IMPSRC} -o ${.TARGET} 44 45.if ${MACHINE_CPUARCH} == "aarch64" 46OBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64 47.elif ${MACHINE_CPUARCH} == "amd64" 48OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64 49.else 50.error ${MACHINE_CPUARCH} not yet supported by linux64 51.endif 52${VDSO}.so: linux_locore.o 53 ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \ 54 linux_locore.o ${.TARGET} 55 ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} 56 57linux_support.o: assym.inc linux_assym.h 58 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 59 ${.IMPSRC} -o ${.TARGET} 60 61linux_genassym.o: offset.inc 62 ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC} 63 64.if !defined(KERNBUILDDIR) 65.warning Building Linuxulator outside of a kernel does not make sense 66.endif 67 68.include <bsd.kmod.mk> 69