Makefile.rumpkern revision 1.130
1#	$NetBSD: Makefile.rumpkern,v 1.130 2013/08/22 15:53:05 matt Exp $
2#
3
4.include "${RUMPTOP}/Makefile.rump"
5
6.include <bsd.own.mk>
7
8LIB=		rump
9
10.PATH:	${RUMPTOP}/librump/rumpkern				\
11	${RUMPTOP}/../kern					\
12	${RUMPTOP}/../uvm					\
13	${RUMPTOP}/../conf					\
14	${RUMPTOP}/../dev					\
15	${RUMPTOP}/../secmodel					\
16	${RUMPTOP}/../secmodel/suser				\
17	${RUMPTOP}/../compat/common
18
19#
20# Source modules, first the ones specifically implemented for librump.
21# 
22SRCS+=	rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c	\
23	kobj_rename.c ltsleep.c scheduler.c			\
24	signals.c sleepq.c threads.c vm.c cprng_stub.c
25
26# optional hypervisor interfaces
27#SRCS+=	hyperstubs.c
28
29# Multiprocessor or uniprocessor locking.  TODO: select right
30# locking at runtime.
31SRCS+=	locks.c
32#SRCS+=	locks_up.c
33
34MKREPRO?=no
35
36.if ${MKREPRO} == "yes"
37_NVFLAGS=-r
38.else
39_NVFLAGS=
40.endif
41
42vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
43		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
44	${_MKMSG_CREATE} vers.c
45	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n ${_NVFLAGS}
46SRCS+=		vers.c
47CLEANFILES+=	vers.c version
48
49# use MI pmap for archs not conforming to kernel ABI
50.ifndef RUMPKMOD
51SRCS+=	pmap_stub.c
52.endif
53
54# autogenerated
55#
56SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
57
58# "auto"generated
59SRCS+=	devsw.c
60
61#
62# std kernel sources
63#
64# sys/kern
65SRCS+=	init_sysctl_base.c	\
66	kern_auth.c		\
67	kern_cfglock.c		\
68	kern_descrip.c		\
69	kern_event.c		\
70	kern_hook.c		\
71	kern_ksyms.c		\
72	kern_malloc.c		\
73	kern_module.c		\
74	kern_mutex_obj.c	\
75	kern_ntptime.c		\
76	kern_proc.c		\
77	kern_prot.c		\
78	kern_rate.c		\
79	kern_resource.c		\
80	kern_rndpool.c		\
81	kern_rndq.c		\
82	kern_rndsink.c		\
83	kern_stub.c		\
84	kern_syscall.c		\
85	kern_sysctl.c		\
86	kern_tc.c		\
87	kern_timeout.c		\
88	kern_uidinfo.c		\
89	kern_xxx.c		\
90	param.c			\
91	subr_devsw.c		\
92	subr_callback.c		\
93	subr_copy.c		\
94	subr_device.c		\
95	subr_evcnt.c		\
96	subr_extent.c		\
97	subr_hash.c		\
98	subr_humanize.c		\
99	subr_iostat.c		\
100	subr_kcpuset.c		\
101	subr_kobj.c		\
102	subr_log.c		\
103	subr_lwp_specificdata.c	\
104	subr_once.c		\
105	subr_percpu.c		\
106	subr_prf.c		\
107	subr_pserialize.c	\
108	subr_specificdata.c	\
109	subr_time.c		\
110	subr_vmem.c		\
111	subr_workqueue.c	\
112	subr_xcall.c		\
113	sys_descrip.c		\
114	sys_generic.c		\
115	sys_module.c		\
116	sys_pipe.c		\
117	sys_select.c		\
118	syscalls.c		\
119	uipc_sem.c
120
121# sys/uvm
122SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c
123
124# 4.4BSD secmodel.  selection is hardcoded for now
125SRCS+=	secmodel.c
126SRCS+=	secmodel_suser.c
127
128# the funny bit.  this doesn't really belong here, but helps with the
129# needs of kern_descrip.c.  And since it's a fully dynamic interface,
130# it doesn't pull in other gunk.
131SRCS+=	vnode_if.c
132
133# sys/dev
134SRCS+=	clock_subr.c
135
136# compat
137SRCS+=	kern_select_50.c
138
139# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
140# directly instead of the kmem/pool allocators backed by hypercalls.
141# Direct hypercalls may be a few percent faster, but don't emulate
142# all kernel corner cases as well (not to mention if you want to debug the
143# allocators themselves).
144.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
145SRCS+=		memalloc.c
146.else
147SRCS+=		subr_kmem.c subr_pool.c
148.endif
149
150.ifdef RUMP_LOCKDEBUG
151SRCS+=		subr_lockdebug.c
152.endif
153
154# no shlib_version because this is automatically in sync with lib/librump
155SHLIB_MAJOR=    0
156SHLIB_MINOR=    0
157
158CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
159CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
160AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
161
162#
163# If archdir exists, it is required to provide:
164# 1) kobj_reloc() and kobj_machdep()
165# 2) rump_cpu_bootstrap()
166# 3) ...?
167# 4) PROFIT!
168#
169
170#
171# Check if we are building compat.  In compat mode we need to provide
172# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
173# take MD stuff from the right arch.
174#
175.ifdef MLIBDIR
176ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
177LIBKERN_ARCH=	${MLIBDIR}
178.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
179ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
180.else
181ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
182.endif
183.if exists(${ARCHDIR})
184.include "${ARCHDIR}/Makefile.inc"
185.PATH:	${ARCHDIR}
186.else
187SRCS+=	kobj_stubs.c rumpcpu_generic.c
188.endif
189
190.if ${MACHINE} == "sun3"
191CPPFLAGS+=	-Dsun3
192.endif
193
194# include libkern source files
195KERNDIR=${RUMPTOP}/../lib/libkern
196.ifdef RUMPKMOD
197KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
198.endif
199.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
200
201# Some architectures require a little special massage with atomic
202# compare-and-swap.  This is because the kernel version is using
203# instructions or routines unavailable to us in userspace.
204#
205.if (${MACHINE_CPU} == "arm" && empty(ARMV6) && empty(ARMV7)) \
206    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
207    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
208    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
209CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
210SRCS+=		atomic_cas_generic.c
211#SRCS+=		rump_atomic_cas_up.c
212.endif
213
214.include <bsd.lib.mk>
215.include <bsd.klinks.mk>
216