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