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