Makefile.rumpkern revision 1.157
1#	$NetBSD: Makefile.rumpkern,v 1.157 2015/04/22 17:57:49 pooka Exp $
2#
3
4.include "${RUMPTOP}/Makefile.rump"
5
6.include <bsd.own.mk>
7
8LIB=		rump
9
10MAN=		rump.3 rump_lwproc.3
11
12.PATH:	${RUMPTOP}/librump/rumpkern				\
13	${RUMPTOP}/librump/rumpkern/arch/generic		\
14	${RUMPTOP}/../kern					\
15	${RUMPTOP}/../uvm					\
16	${RUMPTOP}/../conf					\
17	${RUMPTOP}/../dev					\
18	${RUMPTOP}/../crypto/nist_ctr_drbg			\
19	${RUMPTOP}/../crypto/rijndael				\
20	${RUMPTOP}/../crypto/cprng_fast				\
21	${RUMPTOP}/../secmodel					\
22	${RUMPTOP}/../secmodel/suser				\
23	${RUMPTOP}/../compat/common
24
25#
26# Source modules, first the ones specifically implemented for librump.
27# 
28SRCS+=	rump.c rumpcopy.c cons.c emul.c etfs_wrap.c intr.c	\
29	lwproc.c klock.c kobj_rename.c ltsleep.c scheduler.c	\
30	signals.c sleepq.c threads.c vm.c hyperentropy.c	\
31	accessors.c
32
33SRCS+=	rumpkern_syscalls.c
34
35# autogenerated into the correct namespace
36RUMPOBJ_NORENAME= rump_syscalls.o rump_syscalls.pico rump_syscalls.po
37
38.ifdef RUMP_KERNEL_IS_LIBC
39CPPFLAGS+= -DRUMP_KERNEL_IS_LIBC
40.endif
41
42# optional hypervisor interfaces
43#SRCS+=	hyperstubs.c
44
45# Multiprocessor or uniprocessor locking.  TODO: select right
46# locking at runtime.
47.if ${RUMP_LOCKS_UP:Uno} == "yes"
48SRCS+=	locks_up.c
49.else
50SRCS+=	locks.c
51.endif
52
53vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
54		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
55	${_MKMSG_CREATE} vers.c
56	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -r
57SRCS+=		vers.c
58CLEANFILES+=	vers.c version
59
60# autogenerated
61#
62SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
63
64# "auto"generated
65SRCS+=	devsw.c
66
67#
68# std kernel sources
69#
70# sys/kern
71SRCS+=	init_sysctl_base.c	\
72	kern_auth.c		\
73	kern_cfglock.c		\
74	kern_clock.c		\
75	kern_descrip.c		\
76	kern_event.c		\
77	kern_hook.c		\
78	kern_ksyms.c		\
79	kern_malloc.c		\
80	kern_module.c		\
81	kern_mutex_obj.c	\
82	kern_ntptime.c		\
83	kern_proc.c		\
84	kern_prot.c		\
85	kern_rate.c		\
86	kern_resource.c		\
87	kern_rndpool.c		\
88	kern_rndq.c		\
89	kern_rndsink.c		\
90	kern_stub.c		\
91	kern_syscall.c		\
92	kern_sysctl.c		\
93	kern_tc.c		\
94	kern_time.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_pcq.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
153SRCS+=	cprng_fast.c
154
155# compat
156.if !empty(RUMP_COMPAT:M50)
157SRCS+=	kern_select_50.c
158SRCS+=	kern_time_50.c
159SRCS+=	rndpseudo_50.c
160.endif
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
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.if defined(COMPAT_MACHINE_CPU) \
199    && exists(${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU})
200ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU}
201LIBKERN_ARCH=	${COMPAT_MACHINE_CPU}
202.elif defined(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