3 .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux
4 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
5 .PATH: ${SRCTOP}/sys/x86/linux
11 SRCS= 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 \
19 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
20 SRCS+= linux_dummy_x86.c
22 DPSRCS= assym.inc linux_genassym.c
25 SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
26 .if ${MACHINE_CPUARCH} == "i386"
30 CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \
35 linux_assym.h: linux_genassym.o
36 sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
38 linux_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}
45 .if ${MACHINE_CPUARCH} == "aarch64"
46 OBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64
47 .elif ${MACHINE_CPUARCH} == "amd64"
48 OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64
50 .error ${MACHINE_CPUARCH} not yet supported by linux64
52 ${VDSO}.so: linux_locore.o
53 ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \
54 linux_locore.o ${.TARGET}
55 ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET}
57 linux_support.o: assym.inc linux_assym.h
58 ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
59 ${.IMPSRC} -o ${.TARGET}
61 linux_genassym.o: offset.inc
62 ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC}
64 .if !defined(KERNBUILDDIR)
65 .warning Building Linuxulator outside of a kernel does not make sense
68 .include <bsd.kmod.mk>