xref: /freebsd/sys/modules/linux/Makefile (revision 884a2a699669ec61e2366e3e358342dbc94be24a)
1# $FreeBSD$
2
3.if ${MACHINE_CPUARCH} == "amd64"
4SFX= 32
5CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
6.endif
7
8.if ${CC:T:Mclang} == "clang"
9# XXX: clang integrated-as doesn't grok .codeNN directives yet
10CFLAGS+=	${.IMPSRC:T:Mlinux32_locore.s:C/^.+$/-no-integrated-as/}
11.endif
12
13.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}
14
15KMOD=	linux
16SRCS=	linux_fork.c linux${SFX}_dummy.c linux_emul.c linux_file.c \
17	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
18	linux${SFX}_machdep.c linux_mib.c linux_misc.c linux_signal.c \
19	linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \
20	linux${SFX}_sysvec.c linux_uid16.c linux_util.c linux_time.c \
21	opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \
22	device_if.h bus_if.h assym.s
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=	linux${SFX}_locore.o linux${SFX}_support.o
31
32.if ${MACHINE_CPUARCH} == "i386"
33SRCS+=	linux_ptrace.c imgact_linux.c opt_cpu.h
34.endif
35
36EXPORT_SYMS=
37EXPORT_SYMS+=	linux_emul_path
38EXPORT_SYMS+=	linux_get_osname
39EXPORT_SYMS+=	linux_get_osrelease
40EXPORT_SYMS+=	linux_ifname
41EXPORT_SYMS+=	linux_ioctl_register_handler
42EXPORT_SYMS+=	linux_ioctl_unregister_handler
43
44CLEANFILES=	linux${SFX}_assym.h linux${SFX}_genassym.o
45
46linux${SFX}_assym.h: linux${SFX}_genassym.o
47.if exists(@)
48linux${SFX}_assym.h: @/kern/genassym.sh
49.endif
50	sh @/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
51
52linux${SFX}_locore.o: linux${SFX}_locore.s linux${SFX}_assym.h
53	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
54	    ${.IMPSRC} -o ${.TARGET}
55
56linux${SFX}_support.o: linux${SFX}_support.s assym.s linux${SFX}_assym.h
57	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
58	    ${.IMPSRC} -o ${.TARGET}
59
60linux${SFX}_genassym.o: linux${SFX}_genassym.c linux.h @ machine
61	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
62
63.if !defined(KERNBUILDDIR)
64opt_inet6.h:
65	echo "#define INET6 1" > ${.TARGET}
66.if defined(KTR)
67CFLAGS+=	-DKTR
68.endif
69.endif
70
71.include <bsd.kmod.mk>
72