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