Makefile.rumpkern revision 1.134
1#	$NetBSD: Makefile.rumpkern,v 1.134 2013/12/09 17:57:11 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}/../kern					\
12	${RUMPTOP}/../uvm					\
13	${RUMPTOP}/../conf					\
14	${RUMPTOP}/../dev					\
15	${RUMPTOP}/../secmodel					\
16	${RUMPTOP}/../secmodel/suser				\
17	${RUMPTOP}/../compat/common
18
19#
20# Source modules, first the ones specifically implemented for librump.
21# 
22SRCS+=	rump.c rumpcopy.c cons.c emul.c intr.c lwproc.c klock.c	\
23	kobj_rename.c ltsleep.c scheduler.c			\
24	signals.c sleepq.c threads.c vm.c cprng_stub.c
25
26# autogenerated into the correct namespace
27RUMPOBJ_NORENAME= rump_syscalls.*o
28
29.ifdef RUMP_KERNEL_IS_LIBC
30CPPFLAGS+= -DRUMP_KERNEL_IS_LIBC
31.endif
32
33# optional hypervisor interfaces
34#SRCS+=	hyperstubs.c
35
36# Multiprocessor or uniprocessor locking.  TODO: select right
37# locking at runtime.
38SRCS+=	locks.c
39#SRCS+=	locks_up.c
40
41MKREPRO?=no
42
43.if ${MKREPRO} == "yes"
44_NVFLAGS=-r
45.else
46_NVFLAGS=
47.endif
48
49vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
50		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
51	${_MKMSG_CREATE} vers.c
52	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n ${_NVFLAGS}
53SRCS+=		vers.c
54CLEANFILES+=	vers.c version
55
56# use MI pmap for archs not conforming to kernel ABI
57.ifndef RUMPKMOD
58SRCS+=	pmap_stub.c
59.endif
60
61# autogenerated
62#
63SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
64
65# "auto"generated
66SRCS+=	devsw.c
67
68#
69# std kernel sources
70#
71# sys/kern
72SRCS+=	init_sysctl_base.c	\
73	kern_auth.c		\
74	kern_cfglock.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_timeout.c		\
95	kern_uidinfo.c		\
96	kern_xxx.c		\
97	param.c			\
98	subr_devsw.c		\
99	subr_callback.c		\
100	subr_copy.c		\
101	subr_device.c		\
102	subr_evcnt.c		\
103	subr_extent.c		\
104	subr_hash.c		\
105	subr_humanize.c		\
106	subr_iostat.c		\
107	subr_kcpuset.c		\
108	subr_kobj.c		\
109	subr_log.c		\
110	subr_lwp_specificdata.c	\
111	subr_once.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
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# compat
144SRCS+=	kern_select_50.c
145
146# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
147# directly instead of the kmem/pool allocators backed by hypercalls.
148# Direct hypercalls may be a few percent faster, but don't emulate
149# all kernel corner cases as well (not to mention if you want to debug the
150# allocators themselves).
151.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
152SRCS+=		memalloc.c
153.else
154SRCS+=		subr_kmem.c subr_pool.c
155.endif
156
157.ifdef RUMP_LOCKDEBUG
158SRCS+=		subr_lockdebug.c
159.endif
160
161.if ${RUMP_KTRACE} == "yes"
162SRCS+=		kern_ktrace.c
163.endif
164
165# no shlib_version because this is automatically in sync with lib/librump
166SHLIB_MAJOR=    0
167SHLIB_MINOR=    0
168
169CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
170CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
171AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
172
173#
174# If archdir exists, it is required to provide:
175# 1) kobj_reloc() and kobj_machdep()
176# 2) rump_cpu_bootstrap()
177# 3) ...?
178# 4) PROFIT!
179#
180
181#
182# Check if we are building compat.  In compat mode we need to provide
183# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
184# take MD stuff from the right arch.
185#
186.ifdef MLIBDIR
187ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
188LIBKERN_ARCH=	${MLIBDIR}
189.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
190ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
191.else
192ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
193.endif
194.if exists(${ARCHDIR})
195.include "${ARCHDIR}/Makefile.inc"
196.PATH:	${ARCHDIR}
197.else
198SRCS+=	kobj_stubs.c rumpcpu_generic.c
199.endif
200
201.if ${MACHINE} == "sun3"
202CPPFLAGS+=	-Dsun3
203.endif
204
205# include libkern source files
206KERNDIR=${RUMPTOP}/../lib/libkern
207.ifdef RUMPKMOD
208KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
209.endif
210.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
211
212# Some architectures require a little special massage with atomic
213# compare-and-swap.  This is because the kernel version is using
214# instructions or routines unavailable to us in userspace.
215#
216.if (${MACHINE_CPU} == "arm" && empty(ARMV6) && empty(ARMV7)) \
217    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
218    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
219    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
220CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
221SRCS+=		atomic_cas_generic.c
222#SRCS+=		rump_atomic_cas_up.c
223.endif
224
225.include <bsd.lib.mk>
226.include <bsd.klinks.mk>
227