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