Makefile.rumpkern revision 1.142
1#	$NetBSD: Makefile.rumpkern,v 1.142 2014/04/02 19:37:17 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 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
156
157# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
158# directly instead of the kmem/pool allocators backed by hypercalls.
159# Direct hypercalls may be a few percent faster, but don't emulate
160# all kernel corner cases as well (not to mention if you want to debug the
161# allocators themselves).
162.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
163SRCS+=		memalloc.c
164.else
165SRCS+=		subr_kmem.c subr_pool.c
166.endif
167
168.ifdef RUMP_LOCKDEBUG
169SRCS+=		subr_lockdebug.c
170.endif
171
172.if ${RUMP_KTRACE} == "yes"
173SRCS+=		kern_ktrace.c
174.endif
175
176# no shlib_version because this is automatically in sync with lib/librump
177SHLIB_MAJOR=    0
178SHLIB_MINOR=    0
179
180CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
181CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
182AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
183
184#
185# If archdir exists, it is required to provide:
186# 1) kobj_reloc() and kobj_machdep()
187# 2) rump_cpu_bootstrap()
188# 3) ...?
189# 4) PROFIT!
190#
191
192#
193# Check if we are building compat.  In compat mode we need to provide
194# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
195# take MD stuff from the right arch.
196#
197.ifdef MLIBDIR
198ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
199LIBKERN_ARCH=	${MLIBDIR}
200.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
201ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
202.else
203ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
204.endif
205.if !exists(${ARCHDIR})
206ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/generic
207.endif
208
209.include "${ARCHDIR}/Makefile.inc"
210.PATH:	${ARCHDIR}
211
212.if ${MACHINE} == "sun3"
213CPPFLAGS+=	-Dsun3
214.endif
215
216# include libkern source files
217KERNDIR=${RUMPTOP}/../lib/libkern
218.if "${_RUMP_NATIVEABI}" == "yes"
219KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
220.endif
221.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
222
223# Some architectures require a little special massage with atomic
224# compare-and-swap.  This is because the kernel version is using
225# instructions or routines unavailable to us in userspace.
226#
227.if (${MACHINE_CPU} == "arm" && "${FEAT_LDREX}" != "yes") \
228    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
229    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
230    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
231CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
232SRCS+=		atomic_cas_generic.c
233#SRCS+=		rump_atomic_cas_up.c
234.endif
235
236.include <bsd.lib.mk>
237.include <bsd.klinks.mk>
238