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