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