Makefile.rumpkern revision 1.159
1#	$NetBSD: Makefile.rumpkern,v 1.159 2015/04/23 14:49:26 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# Multiprocessor or uniprocessor locking.  TODO: select right
43# locking at runtime.
44.if ${RUMP_LOCKS_UP:Uno} == "yes"
45SRCS+=	locks_up.c
46.else
47SRCS+=	locks.c
48.endif
49
50vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
51		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
52	${_MKMSG_CREATE} vers.c
53	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -r
54SRCS+=		vers.c
55CLEANFILES+=	vers.c version
56
57# autogenerated
58#
59SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
60
61# "auto"generated
62SRCS+=	devsw.c
63
64#
65# std kernel sources
66#
67# sys/kern
68SRCS+=	init_sysctl_base.c	\
69	kern_auth.c		\
70	kern_cfglock.c		\
71	kern_clock.c		\
72	kern_descrip.c		\
73	kern_event.c		\
74	kern_hook.c		\
75	kern_ksyms.c		\
76	kern_malloc.c		\
77	kern_module.c		\
78	kern_mutex_obj.c	\
79	kern_ntptime.c		\
80	kern_proc.c		\
81	kern_prot.c		\
82	kern_rate.c		\
83	kern_resource.c		\
84	kern_rndpool.c		\
85	kern_rndq.c		\
86	kern_rndsink.c		\
87	kern_stub.c		\
88	kern_syscall.c		\
89	kern_sysctl.c		\
90	kern_tc.c		\
91	kern_time.c		\
92	kern_timeout.c		\
93	kern_uidinfo.c		\
94	kern_xxx.c		\
95	param.c			\
96	subr_devsw.c		\
97	subr_callback.c		\
98	subr_copy.c		\
99	subr_cprng.c		\
100	subr_device.c		\
101	subr_evcnt.c		\
102	subr_extent.c		\
103	subr_hash.c		\
104	subr_humanize.c		\
105	subr_iostat.c		\
106	subr_kcpuset.c		\
107	subr_kobj.c		\
108	subr_log.c		\
109	subr_lwp_specificdata.c	\
110	subr_once.c		\
111	subr_pcq.c		\
112	subr_percpu.c		\
113	subr_prf.c		\
114	subr_pserialize.c	\
115	subr_specificdata.c	\
116	subr_time.c		\
117	subr_vmem.c		\
118	subr_workqueue.c	\
119	subr_xcall.c		\
120	sys_descrip.c		\
121	sys_generic.c		\
122	sys_module.c		\
123	sys_pipe.c		\
124	sys_select.c		\
125	syscalls.c		\
126	uipc_sem.c
127
128# sys/uvm
129SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c uvm_swapstub.c
130
131# 4.4BSD secmodel.  selection is hardcoded for now
132SRCS+=	secmodel.c
133SRCS+=	secmodel_suser.c
134
135# the funny bit.  this doesn't really belong here, but helps with the
136# needs of kern_descrip.c.  And since it's a fully dynamic interface,
137# it doesn't pull in other gunk.
138SRCS+=	vnode_if.c
139
140# sys/dev
141SRCS+=	clock_subr.c
142
143# sys/dev/crypto
144# Note: these are here only for cprng.  More crypto algos for drivers
145# are available from the rumpkern_crypto component
146SRCS+=	nist_ctr_drbg.c
147SRCS+=	rijndael-alg-fst.c
148SRCS+=	rijndael-api-fst.c
149SRCS+=	rijndael.c
150SRCS+=	cprng_fast.c
151
152# compat
153.if !empty(RUMP_NBCOMPAT:M50)
154SRCS+=	kern_select_50.c
155SRCS+=	kern_time_50.c
156SRCS+=	rndpseudo_50.c
157.endif
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
178CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
179CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
180AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
181
182#
183# If archdir exists, it is required to provide:
184# 1) kobj_reloc() and kobj_machdep()
185# 2) rump_cpu_bootstrap()
186# 3) ...?
187# 4) PROFIT!
188#
189
190#
191# Check if we are building compat.  In compat mode we need to provide
192# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
193# take MD stuff from the right arch.
194#
195.if defined(COMPAT_MACHINE_CPU) \
196    && exists(${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU})
197ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU}
198LIBKERN_ARCH=	${COMPAT_MACHINE_CPU}
199.elif defined(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