xref: /freebsd/sys/modules/linux64/Makefile (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
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_apic.h opt_hwpmc_hooks.h
20
21CLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o
22
23OBJS=	${VDSO}.so
24
25linux_assym.h: linux_genassym.o
26	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
27
28linux_locore.o: linux_locore.s linux_assym.h
29	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
30	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc 	\
31	-Wl,-T${.CURDIR}/../../${MACHINE_CPUARCH}/linux/${VDSO}.lds.s	\
32	-Wl,-soname=${VDSO}.so.1,-fPIC,-warn-common -nostdlib		\
33	    ${.IMPSRC} -o ${.TARGET}
34
35${VDSO}.so: linux_locore.o
36	${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd		\
37	    -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET}
38
39linux_support.o: assym.s linux_assym.h
40	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
41	    ${.IMPSRC} -o ${.TARGET}
42
43linux_genassym.o:
44	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
45
46.if !defined(KERNBUILDDIR)
47.if defined(DEBUG)
48CFLAGS+=-DDEBUG
49.endif
50.if defined(KTR)
51CFLAGS+=-DKTR
52.endif
53.endif
54
55.include <bsd.kmod.mk>
56