]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/modules/linux/Makefile
sys/{x86,amd64}: remove one of doubled ;s
[FreeBSD/FreeBSD.git] / sys / modules / linux / Makefile
1 # $FreeBSD$
2
3 .if ${MACHINE_CPUARCH} == "amd64"
4 SFX= 32
5 CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
6 .endif
7
8 .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}
9
10 VDSO=   linux${SFX}_vdso
11
12 KMOD=   linux
13 SRCS=   linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.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_posix.h opt_usb.h vnode_if.h \
20         device_if.h bus_if.h
21 .if ${MACHINE_CPUARCH} == "amd64"
22 SRCS+=  linux${SFX}_support.s
23 .else
24 SRCS+=  linux_copyout.c
25 .endif
26 DPSRCS= assym.inc linux${SFX}_genassym.c
27
28 # XXX: for assym.inc
29 SRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
30 .if ${MACHINE_CPUARCH} == "i386"
31 SRCS+=  opt_apic.h
32 .endif
33
34 OBJS=   ${VDSO}.so
35
36 .if ${MACHINE_CPUARCH} == "i386"
37 SRCS+=  linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c linux_mmap.c \
38         linux_emul.c linux_errno.c opt_cpu.h linux.c
39 .endif
40
41 .if ${MACHINE_CPUARCH} == "i386"
42 EXPORT_SYMS=
43 EXPORT_SYMS+=   linux_emul_path
44 EXPORT_SYMS+=   linux_get_osname
45 EXPORT_SYMS+=   linux_get_osrelease
46 EXPORT_SYMS+=   linux_ioctl_register_handler
47 EXPORT_SYMS+=   linux_ioctl_unregister_handler
48 .endif
49
50 CLEANFILES=     linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \
51                 genassym.o
52
53 linux${SFX}_assym.h: linux${SFX}_genassym.o
54         sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
55
56 linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc
57         ${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s                    \
58         -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib     \
59         -fno-omit-frame-pointer -fPIC                                           \
60         -Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}/${VDSO}.lds.s        \
61         -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common            \
62             ${.IMPSRC} -o ${.TARGET}
63
64 .if ${MACHINE_CPUARCH} == "amd64"
65 linux${SFX}_support.o: linux${SFX}_assym.h assym.inc
66         ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
67             ${.IMPSRC} -o ${.TARGET}
68
69 ${VDSO}.so: linux${SFX}_locore.o
70         ${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd                   \
71             --binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
72         strip -N _binary_linux${SFX}_locore_o_size ${.TARGET}
73 .else
74 ${VDSO}.so: linux${SFX}_locore.o
75         ${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd                     \
76             --binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
77         strip -N _binary_linux_locore_o_size ${.TARGET}
78 .endif
79
80 linux${SFX}_genassym.o: offset.inc
81         ${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC}
82
83 .if !defined(KERNBUILDDIR)
84 .warning Building Linuxulator outside of a kernel does not make sense
85 .endif
86
87 .include <bsd.kmod.mk>