1283424Sdchagin# $FreeBSD: stable/11/sys/modules/linux64/Makefile 360494 2020-04-30 13:48:58Z kevans $
2283424Sdchagin
3319182Sngie.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_ARCH}/linux
4283424Sdchagin
5283424SdchaginVDSO=	linux_vdso
6283424Sdchagin
7283424SdchaginKMOD=	linux64
8283441SdchaginSRCS=	linux_fork.c linux_dummy.c linux_file.c linux_event.c \
9283424Sdchagin	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
10316363Strasz	linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \
11283424Sdchagin	linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
12283424Sdchagin	linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
13291153Smarkj	opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \
14283424Sdchagin	vnode_if.h device_if.h bus_if.h assym.s \
15283424Sdchagin	linux_support.s
16283424SdchaginDPSRCS=	linux_genassym.c
17283424Sdchagin
18283424Sdchagin# XXX: for assym.s
19303679SbdrewerySRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
20303679Sbdrewery.if ${MACHINE_CPUARCH} == "i386"
21303679SbdrewerySRCS+=	opt_apic.h
22303679Sbdrewery.endif
23283424Sdchagin
24283424SdchaginCLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o
25283424Sdchagin
26283424SdchaginOBJS=	${VDSO}.so
27283424Sdchagin
28283424Sdchaginlinux_assym.h: linux_genassym.o
29283424Sdchagin	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
30283424Sdchagin
31283424Sdchaginlinux_locore.o: linux_locore.s linux_assym.h
32283424Sdchagin	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
33352023Simp	-pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -fPIC -nostdinc	\
34319182Sngie	-Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux/${VDSO}.lds.s	\
35296057Semaste	-Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib			\
36283424Sdchagin	    ${.IMPSRC} -o ${.TARGET}
37283424Sdchagin
38283424Sdchagin${VDSO}.so: linux_locore.o
39283506Srodrigc	${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd		\
40283424Sdchagin	    -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET}
41319574Sdchagin	strip -N _binary_linux_locore_o_size ${.TARGET}
42283424Sdchagin
43283424Sdchaginlinux_support.o: assym.s linux_assym.h
44283424Sdchagin	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
45283424Sdchagin	    ${.IMPSRC} -o ${.TARGET}
46283424Sdchagin
47283424Sdchaginlinux_genassym.o:
48360494Skevans	${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC}
49283424Sdchagin
50283424Sdchagin.if !defined(KERNBUILDDIR)
51283424Sdchagin.if defined(DEBUG)
52283424SdchaginCFLAGS+=-DDEBUG
53283424Sdchagin.endif
54283424Sdchagin.if defined(KTR)
55283424SdchaginCFLAGS+=-DKTR
56283424Sdchagin.endif
57283424Sdchagin.endif
58283424Sdchagin
59283424Sdchagin.include <bsd.kmod.mk>
60