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