xref: /freebsd/sys/modules/linux64/Makefile (revision d3b03d746b9f12c8e6e55ca6d9528247e3bb3a84)
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
24b2f58791SDmitry ChaginCLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o
25b2f58791SDmitry Chagin
26b2f58791SDmitry ChaginOBJS=	${VDSO}.so
27b2f58791SDmitry Chagin
28b2f58791SDmitry Chaginlinux_assym.h: linux_genassym.o
29b2f58791SDmitry Chagin	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
30b2f58791SDmitry Chagin
31b2f58791SDmitry Chaginlinux_locore.o: linux_locore.s linux_assym.h
32b2f58791SDmitry Chagin	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
33621a9c54SEd Maste	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc	\
3448bc159fSEd Maste	-Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s	\
35621a9c54SEd Maste	-Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib			\
36b2f58791SDmitry Chagin	    ${.IMPSRC} -o ${.TARGET}
37b2f58791SDmitry Chagin
38*d3b03d74SEd Maste.if ${MACHINE_CPUARCH} == "aarch64"
39*d3b03d74SEd MasteOBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64
40*d3b03d74SEd Maste.elif ${MACHINE_CPUARCH} == "amd64"
41*d3b03d74SEd MasteOBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64
42*d3b03d74SEd Maste.else
43*d3b03d74SEd Maste.error ${MACHINE_CPUARCH} not yet supported by linux64
44*d3b03d74SEd Maste.endif
45b2f58791SDmitry Chagin${VDSO}.so: linux_locore.o
46*d3b03d74SEd Maste	${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \
47*d3b03d74SEd Maste	    linux_locore.o ${.TARGET}
481a8ea9fbSDmitry Chagin	strip -N _binary_linux_locore_o_size ${.TARGET}
49b2f58791SDmitry Chagin
50fc2a8776SEd Mastelinux_support.o: assym.inc linux_assym.h
51b2f58791SDmitry Chagin	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
52b2f58791SDmitry Chagin	    ${.IMPSRC} -o ${.TARGET}
53b2f58791SDmitry Chagin
54b2f58791SDmitry Chaginlinux_genassym.o:
550e8b3ab3SEd Maste	${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC}
56b2f58791SDmitry Chagin
57b2f58791SDmitry Chagin.if !defined(KERNBUILDDIR)
58b2f58791SDmitry Chagin.if defined(DEBUG)
59b2f58791SDmitry ChaginCFLAGS+=-DDEBUG
60b2f58791SDmitry Chagin.endif
61b2f58791SDmitry Chagin.if defined(KTR)
62b2f58791SDmitry ChaginCFLAGS+=-DKTR
63b2f58791SDmitry Chagin.endif
64b2f58791SDmitry Chagin.endif
65b2f58791SDmitry Chagin
66b2f58791SDmitry Chagin.include <bsd.kmod.mk>
67