Makefile.rumpkern revision 1.146
1#	$NetBSD: Makefile.rumpkern,v 1.146 2014/04/27 15:15:13 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 etfs_wrap.c intr.c	\
26	lwproc.c klock.c kobj_rename.c ltsleep.c scheduler.c	\
27	signals.c sleepq.c threads.c vm.c hyperentropy.c	\
28	accessors.c
29
30SRCS+=	rumpkern_syscalls.c
31
32# autogenerated into the correct namespace
33RUMPOBJ_NORENAME= rump_syscalls.o rump_syscalls.pico rump_syscalls.po
34
35.ifdef RUMP_KERNEL_IS_LIBC
36CPPFLAGS+= -DRUMP_KERNEL_IS_LIBC
37.endif
38
39# optional hypervisor interfaces
40#SRCS+=	hyperstubs.c
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
50MKREPRO?=no
51
52.if ${MKREPRO} == "yes"
53_NVFLAGS=-r
54.else
55_NVFLAGS=
56.endif
57
58vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
59		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
60	${_MKMSG_CREATE} vers.c
61	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n ${_NVFLAGS}
62SRCS+=		vers.c
63CLEANFILES+=	vers.c version
64
65# autogenerated
66#
67SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
68
69# "auto"generated
70SRCS+=	devsw.c
71
72#
73# std kernel sources
74#
75# sys/kern
76SRCS+=	init_sysctl_base.c	\
77	kern_auth.c		\
78	kern_cfglock.c		\
79	kern_descrip.c		\
80	kern_event.c		\
81	kern_hook.c		\
82	kern_ksyms.c		\
83	kern_malloc.c		\
84	kern_module.c		\
85	kern_mutex_obj.c	\
86	kern_ntptime.c		\
87	kern_proc.c		\
88	kern_prot.c		\
89	kern_rate.c		\
90	kern_resource.c		\
91	kern_rndpool.c		\
92	kern_rndq.c		\
93	kern_rndsink.c		\
94	kern_stub.c		\
95	kern_syscall.c		\
96	kern_sysctl.c		\
97	kern_tc.c		\
98	kern_time.c		\
99	kern_timeout.c		\
100	kern_uidinfo.c		\
101	kern_xxx.c		\
102	param.c			\
103	subr_devsw.c		\
104	subr_callback.c		\
105	subr_copy.c		\
106	subr_cprng.c		\
107	subr_device.c		\
108	subr_evcnt.c		\
109	subr_extent.c		\
110	subr_hash.c		\
111	subr_humanize.c		\
112	subr_iostat.c		\
113	subr_kcpuset.c		\
114	subr_kobj.c		\
115	subr_log.c		\
116	subr_lwp_specificdata.c	\
117	subr_once.c		\
118	subr_percpu.c		\
119	subr_prf.c		\
120	subr_pserialize.c	\
121	subr_specificdata.c	\
122	subr_time.c		\
123	subr_vmem.c		\
124	subr_workqueue.c	\
125	subr_xcall.c		\
126	sys_descrip.c		\
127	sys_generic.c		\
128	sys_module.c		\
129	sys_pipe.c		\
130	sys_select.c		\
131	syscalls.c		\
132	uipc_sem.c
133
134# sys/uvm
135SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c uvm_swapstub.c
136
137# 4.4BSD secmodel.  selection is hardcoded for now
138SRCS+=	secmodel.c
139SRCS+=	secmodel_suser.c
140
141# the funny bit.  this doesn't really belong here, but helps with the
142# needs of kern_descrip.c.  And since it's a fully dynamic interface,
143# it doesn't pull in other gunk.
144SRCS+=	vnode_if.c
145
146# sys/dev
147SRCS+=	clock_subr.c
148
149# sys/dev/crypto
150# Note: these are here only for cprng.  More crypto algos for drivers
151# are available from the rumpkern_crypto component
152SRCS+=	nist_ctr_drbg.c
153SRCS+=	rijndael-alg-fst.c
154SRCS+=	rijndael-api-fst.c
155SRCS+=	rijndael.c	
156
157# compat
158SRCS+=	kern_select_50.c
159SRCS+=	kern_time_50.c
160
161# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
162# directly instead of the kmem/pool allocators backed by hypercalls.
163# Direct hypercalls may be a few percent faster, but don't emulate
164# all kernel corner cases as well (not to mention if you want to debug the
165# allocators themselves).
166.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
167SRCS+=		memalloc.c
168.else
169SRCS+=		subr_kmem.c subr_pool.c
170.endif
171
172.ifdef RUMP_LOCKDEBUG
173SRCS+=		subr_lockdebug.c
174.endif
175
176.if ${RUMP_KTRACE} == "yes"
177SRCS+=		kern_ktrace.c
178.endif
179
180# no shlib_version because this is automatically in sync with lib/librump
181SHLIB_MAJOR=    0
182SHLIB_MINOR=    0
183
184CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
185CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
186AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
187
188#
189# If archdir exists, it is required to provide:
190# 1) kobj_reloc() and kobj_machdep()
191# 2) rump_cpu_bootstrap()
192# 3) ...?
193# 4) PROFIT!
194#
195
196#
197# Check if we are building compat.  In compat mode we need to provide
198# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
199# take MD stuff from the right arch.
200#
201.ifdef MLIBDIR
202ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
203LIBKERN_ARCH=	${MLIBDIR}
204.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
205ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
206.else
207ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
208.endif
209.if !exists(${ARCHDIR})
210ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/generic
211.endif
212
213.include "${ARCHDIR}/Makefile.inc"
214.PATH:	${ARCHDIR}
215
216.if ${MACHINE} == "sun3"
217CPPFLAGS+=	-Dsun3
218.endif
219
220# include libkern source files
221KERNDIR=${RUMPTOP}/../lib/libkern
222.if "${_RUMP_NATIVEABI}" == "yes"
223KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
224.endif
225.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
226
227# Some architectures require a little special massage with atomic
228# compare-and-swap.  This is because the kernel version is using
229# instructions or routines unavailable to us in userspace.
230#
231.if (${MACHINE_CPU} == "arm" && "${FEAT_LDREX}" != "yes") \
232    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
233    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
234    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
235CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
236SRCS+=		atomic_cas_generic.c
237#SRCS+=		rump_atomic_cas_up.c
238.endif
239
240.include <bsd.lib.mk>
241.include <bsd.klinks.mk>
242