1# $FreeBSD$ 2 3.if ${MACHINE_CPUARCH} == "amd64" 4SFX= 32 5CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 6.endif 7 8.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX} 9.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 10.PATH: ${SRCTOP}/sys/x86/linux 11.endif 12 13VDSO= linux${SFX}_vdso 14 15KMOD= linux 16SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.c \ 17 linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ 18 linux${SFX}_machdep.c linux_misc.c linux_signal.c \ 19 linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \ 20 linux${SFX}_sysvec.c linux_uid16.c linux_time.c \ 21 linux_timer.c linux_vdso.c \ 22 opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ 23 device_if.h bus_if.h 24.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 25SRCS+= linux_dummy_x86.c 26.endif 27.if ${MACHINE_CPUARCH} == "amd64" 28SRCS+= linux${SFX}_support.s 29.else 30SRCS+= linux_copyout.c 31.endif 32DPSRCS= assym.inc linux${SFX}_genassym.c 33 34# XXX: for assym.inc 35SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h 36.if ${MACHINE_CPUARCH} == "i386" 37SRCS+= opt_apic.h 38.endif 39 40OBJS= ${VDSO}.so 41 42.if ${MACHINE_CPUARCH} == "i386" 43SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c linux_mmap.c \ 44 linux_emul.c linux_errno.c opt_cpu.h linux.c 45.endif 46 47.if ${MACHINE_CPUARCH} == "i386" 48EXPORT_SYMS= 49EXPORT_SYMS+= linux_emul_path 50EXPORT_SYMS+= linux_get_osname 51EXPORT_SYMS+= linux_get_osrelease 52EXPORT_SYMS+= linux_ioctl_register_handler 53EXPORT_SYMS+= linux_ioctl_unregister_handler 54.endif 55 56CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \ 57 genassym.o 58 59linux${SFX}_assym.h: linux${SFX}_genassym.o 60 sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} 61 62linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc 63 ${CC} ${CCLDFLAGS} -x assembler-with-cpp -DLOCORE -m32 -shared -s \ 64 -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -nostdinc -nostdlib \ 65 -fno-omit-frame-pointer -fPIC \ 66 -Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}/${VDSO}.lds.s \ 67 -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common \ 68 ${.IMPSRC} -o ${.TARGET} 69 70.if ${MACHINE_CPUARCH} == "amd64" 71linux${SFX}_support.o: linux${SFX}_assym.h assym.inc 72 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ 73 ${.IMPSRC} -o ${.TARGET} 74 75${VDSO}.so: linux${SFX}_locore.o 76 ${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd \ 77 --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} 78 ${STRIPBIN} -N _binary_linux${SFX}_locore_o_size ${.TARGET} 79.else 80${VDSO}.so: linux${SFX}_locore.o 81 ${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd \ 82 --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} 83 ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} 84.endif 85 86linux${SFX}_genassym.o: offset.inc 87 ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC} 88 89.if !defined(KERNBUILDDIR) 90.warning Building Linuxulator outside of a kernel does not make sense 91.endif 92 93.include <bsd.kmod.mk> 94