Makefile.rumpkern revision 1.133
1#	$NetBSD: Makefile.rumpkern,v 1.133 2013/12/09 16:54:20 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_ktrace.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_timeout.c		\
96	kern_uidinfo.c		\
97	kern_xxx.c		\
98	param.c			\
99	subr_devsw.c		\
100	subr_callback.c		\
101	subr_copy.c		\
102	subr_device.c		\
103	subr_evcnt.c		\
104	subr_extent.c		\
105	subr_hash.c		\
106	subr_humanize.c		\
107	subr_iostat.c		\
108	subr_kcpuset.c		\
109	subr_kobj.c		\
110	subr_log.c		\
111	subr_lwp_specificdata.c	\
112	subr_once.c		\
113	subr_percpu.c		\
114	subr_prf.c		\
115	subr_pserialize.c	\
116	subr_specificdata.c	\
117	subr_time.c		\
118	subr_vmem.c		\
119	subr_workqueue.c	\
120	subr_xcall.c		\
121	sys_descrip.c		\
122	sys_generic.c		\
123	sys_module.c		\
124	sys_pipe.c		\
125	sys_select.c		\
126	syscalls.c		\
127	uipc_sem.c
128
129# sys/uvm
130SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c
131
132# 4.4BSD secmodel.  selection is hardcoded for now
133SRCS+=	secmodel.c
134SRCS+=	secmodel_suser.c
135
136# the funny bit.  this doesn't really belong here, but helps with the
137# needs of kern_descrip.c.  And since it's a fully dynamic interface,
138# it doesn't pull in other gunk.
139SRCS+=	vnode_if.c
140
141# sys/dev
142SRCS+=	clock_subr.c
143
144# compat
145SRCS+=	kern_select_50.c
146
147# Set RUMP_UNREAL_ALLOCATORS to "yes" to use memory allocation hypercalls
148# directly instead of the kmem/pool allocators backed by hypercalls.
149# Direct hypercalls may be a few percent faster, but don't emulate
150# all kernel corner cases as well (not to mention if you want to debug the
151# allocators themselves).
152.if defined(RUMP_UNREAL_ALLOCATORS) && ${RUMP_UNREAL_ALLOCATORS} == "yes"
153SRCS+=		memalloc.c
154.else
155SRCS+=		subr_kmem.c subr_pool.c
156.endif
157
158.ifdef RUMP_LOCKDEBUG
159SRCS+=		subr_lockdebug.c
160.endif
161
162# no shlib_version because this is automatically in sync with lib/librump
163SHLIB_MAJOR=    0
164SHLIB_MINOR=    0
165
166CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
167CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
168AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
169
170#
171# If archdir exists, it is required to provide:
172# 1) kobj_reloc() and kobj_machdep()
173# 2) rump_cpu_bootstrap()
174# 3) ...?
175# 4) PROFIT!
176#
177
178#
179# Check if we are building compat.  In compat mode we need to provide
180# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
181# take MD stuff from the right arch.
182#
183.ifdef MLIBDIR
184ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
185LIBKERN_ARCH=	${MLIBDIR}
186.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
187ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
188.else
189ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
190.endif
191.if exists(${ARCHDIR})
192.include "${ARCHDIR}/Makefile.inc"
193.PATH:	${ARCHDIR}
194.else
195SRCS+=	kobj_stubs.c rumpcpu_generic.c
196.endif
197
198.if ${MACHINE} == "sun3"
199CPPFLAGS+=	-Dsun3
200.endif
201
202# include libkern source files
203KERNDIR=${RUMPTOP}/../lib/libkern
204.ifdef RUMPKMOD
205KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
206.endif
207.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
208
209# Some architectures require a little special massage with atomic
210# compare-and-swap.  This is because the kernel version is using
211# instructions or routines unavailable to us in userspace.
212#
213.if (${MACHINE_CPU} == "arm" && empty(ARMV6) && empty(ARMV7)) \
214    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
215    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
216    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
217CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
218SRCS+=		atomic_cas_generic.c
219#SRCS+=		rump_atomic_cas_up.c
220.endif
221
222.include <bsd.lib.mk>
223.include <bsd.klinks.mk>
224