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