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