xref: /freebsd/sys/modules/linux64/Makefile (revision 3a970562d7f8b2506f7bcbe378e3c02a408425d7)
1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux
4
5VDSO=	linux_vdso
6
7KMOD=	linux64
8SRCS=	linux_fork.c linux_dummy.c linux_file.c linux_event.c \
9	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
10	linux_machdep.c linux_misc.c linux_signal.c \
11	linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
12	linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
13	opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \
14	vnode_if.h device_if.h bus_if.h assym.s \
15	linux_support.s
16DPSRCS=	linux_genassym.c
17
18# XXX: for assym.s
19SRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
20.if ${MACHINE_CPUARCH} == "i386"
21SRCS+=	opt_apic.h
22.endif
23
24CLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o
25
26OBJS=	${VDSO}.so
27
28linux_assym.h: linux_genassym.o
29	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
30
31linux_locore.o: linux_locore.s linux_assym.h
32	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
33	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc	\
34	-Wl,-T${.CURDIR}/../../${MACHINE_CPUARCH}/linux/${VDSO}.lds.s	\
35	-Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib			\
36	    ${.IMPSRC} -o ${.TARGET}
37
38${VDSO}.so: linux_locore.o
39	${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd		\
40	    -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET}
41
42linux_support.o: assym.s linux_assym.h
43	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
44	    ${.IMPSRC} -o ${.TARGET}
45
46linux_genassym.o:
47	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
48
49.if !defined(KERNBUILDDIR)
50.if defined(DEBUG)
51CFLAGS+=-DDEBUG
52.endif
53.if defined(KTR)
54CFLAGS+=-DKTR
55.endif
56.endif
57
58.include <bsd.kmod.mk>
59