Makefile.rumpkern revision 1.156
1#	$NetBSD: Makefile.rumpkern,v 1.156 2015/04/22 16:49:42 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
156SRCS+=	kern_select_50.c
157SRCS+=	kern_time_50.c
158SRCS+=	rndpseudo_50.c
159
160# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
161# directly instead of the kmem/pool allocators backed by hypercalls.
162# Direct hypercalls may be a few percent faster, but don't emulate
163# all kernel corner cases as well (not to mention if you want to debug the
164# allocators themselves).
165.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
166SRCS+=		memalloc.c
167.else
168SRCS+=		subr_kmem.c subr_pool.c
169.endif
170
171.ifdef RUMP_LOCKDEBUG
172SRCS+=		subr_lockdebug.c
173.endif
174
175.if ${RUMP_KTRACE} == "yes"
176SRCS+=		kern_ktrace.c
177.endif
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.if defined(COMPAT_MACHINE_CPU) \
197    && exists(${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU})
198ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU}
199LIBKERN_ARCH=	${COMPAT_MACHINE_CPU}
200.elif defined(MLIBDIR)
201ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
202LIBKERN_ARCH=	${MLIBDIR}
203.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
204ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
205.else
206ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
207.endif
208.if !exists(${ARCHDIR})
209ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/generic
210.endif
211
212.include "${ARCHDIR}/Makefile.inc"
213.PATH:	${ARCHDIR}
214
215.if ${MACHINE} == "sun3"
216CPPFLAGS+=	-Dsun3
217.endif
218
219# include libkern source files
220KERNDIR=${RUMPTOP}/../lib/libkern
221.if "${_RUMP_NATIVEABI}" == "yes"
222KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
223.endif
224.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
225
226# Some architectures require a little special massage with atomic
227# compare-and-swap.  This is because the kernel version is using
228# instructions or routines unavailable to us in userspace.
229#
230.if (${MACHINE_CPU} == "arm" && "${FEAT_LDREX}" != "yes") \
231    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
232    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
233    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
234CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
235SRCS+=		atomic_cas_generic.c
236#SRCS+=		rump_atomic_cas_up.c
237.endif
238
239.include <bsd.lib.mk>
240.include <bsd.klinks.mk>
241