Makefile.rumpkern revision 1.143
1#	$NetBSD: Makefile.rumpkern,v 1.143 2014/04/04 18:20:28 njoly 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_time.c		\
96	kern_timeout.c		\
97	kern_uidinfo.c		\
98	kern_xxx.c		\
99	param.c			\
100	subr_devsw.c		\
101	subr_callback.c		\
102	subr_copy.c		\
103	subr_cprng.c		\
104	subr_device.c		\
105	subr_evcnt.c		\
106	subr_extent.c		\
107	subr_hash.c		\
108	subr_humanize.c		\
109	subr_iostat.c		\
110	subr_kcpuset.c		\
111	subr_kobj.c		\
112	subr_log.c		\
113	subr_lwp_specificdata.c	\
114	subr_once.c		\
115	subr_percpu.c		\
116	subr_prf.c		\
117	subr_pserialize.c	\
118	subr_specificdata.c	\
119	subr_time.c		\
120	subr_vmem.c		\
121	subr_workqueue.c	\
122	subr_xcall.c		\
123	sys_descrip.c		\
124	sys_generic.c		\
125	sys_module.c		\
126	sys_pipe.c		\
127	sys_select.c		\
128	syscalls.c		\
129	uipc_sem.c
130
131# sys/uvm
132SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c uvm_swapstub.c
133
134# 4.4BSD secmodel.  selection is hardcoded for now
135SRCS+=	secmodel.c
136SRCS+=	secmodel_suser.c
137
138# the funny bit.  this doesn't really belong here, but helps with the
139# needs of kern_descrip.c.  And since it's a fully dynamic interface,
140# it doesn't pull in other gunk.
141SRCS+=	vnode_if.c
142
143# sys/dev
144SRCS+=	clock_subr.c
145
146# sys/dev/crypto
147# Note: these are here only for cprng.  More crypto algos for drivers
148# are available from the rumpkern_crypto component
149SRCS+=	nist_ctr_drbg.c
150SRCS+=	rijndael-alg-fst.c
151SRCS+=	rijndael-api-fst.c
152SRCS+=	rijndael.c	
153
154# compat
155SRCS+=	kern_select_50.c
156SRCS+=	kern_time_50.c
157
158# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
159# directly instead of the kmem/pool allocators backed by hypercalls.
160# Direct hypercalls may be a few percent faster, but don't emulate
161# all kernel corner cases as well (not to mention if you want to debug the
162# allocators themselves).
163.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
164SRCS+=		memalloc.c
165.else
166SRCS+=		subr_kmem.c subr_pool.c
167.endif
168
169.ifdef RUMP_LOCKDEBUG
170SRCS+=		subr_lockdebug.c
171.endif
172
173.if ${RUMP_KTRACE} == "yes"
174SRCS+=		kern_ktrace.c
175.endif
176
177# no shlib_version because this is automatically in sync with lib/librump
178SHLIB_MAJOR=    0
179SHLIB_MINOR=    0
180
181CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
182CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
183AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
184
185#
186# If archdir exists, it is required to provide:
187# 1) kobj_reloc() and kobj_machdep()
188# 2) rump_cpu_bootstrap()
189# 3) ...?
190# 4) PROFIT!
191#
192
193#
194# Check if we are building compat.  In compat mode we need to provide
195# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
196# take MD stuff from the right arch.
197#
198.ifdef MLIBDIR
199ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
200LIBKERN_ARCH=	${MLIBDIR}
201.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
202ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
203.else
204ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
205.endif
206.if !exists(${ARCHDIR})
207ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/generic
208.endif
209
210.include "${ARCHDIR}/Makefile.inc"
211.PATH:	${ARCHDIR}
212
213.if ${MACHINE} == "sun3"
214CPPFLAGS+=	-Dsun3
215.endif
216
217# include libkern source files
218KERNDIR=${RUMPTOP}/../lib/libkern
219.if "${_RUMP_NATIVEABI}" == "yes"
220KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
221.endif
222.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
223
224# Some architectures require a little special massage with atomic
225# compare-and-swap.  This is because the kernel version is using
226# instructions or routines unavailable to us in userspace.
227#
228.if (${MACHINE_CPU} == "arm" && "${FEAT_LDREX}" != "yes") \
229    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
230    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
231    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
232CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
233SRCS+=		atomic_cas_generic.c
234#SRCS+=		rump_atomic_cas_up.c
235.endif
236
237.include <bsd.lib.mk>
238.include <bsd.klinks.mk>
239