Makefile.rumpkern revision 1.118
1#	$NetBSD: Makefile.rumpkern,v 1.118 2012/06/22 12:45:43 rmind 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# Flip the comment to the other line if you want to use malloc(3)
132# directly instead of the kernel allocators backed by malloc(3)/mmap(2).
133# Libc malloc is a few percent faster, but doesn't emulate all kernel
134# corner cases as well (not to mention if you want to debug the
135# allocators themselves).
136#CPPFLAGS+=	-DRUMP_USE_UNREAL_ALLOCATORS
137SRCS+=		subr_kmem.c subr_percpu.c subr_pool.c subr_vmem.c
138
139.ifdef RUMP_LOCKDEBUG
140SRCS+=		subr_lockdebug.c
141.endif
142
143# no shlib_version because this is automatically in sync with lib/librump
144SHLIB_MAJOR=    0
145SHLIB_MINOR=    0
146
147CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
148CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
149AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
150
151#
152# If archdir exists, it is required to provide:
153# 1) kobj_reloc() and kobj_machdep()
154# 2) rump_cpu_bootstrap()
155# 3) ...?
156# 4) PROFIT!
157#
158
159#
160# Check if we are building compat.  In compat mode we need to provide
161# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
162# take MD stuff from the right arch.
163#
164.ifdef MLIBDIR
165ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
166LIBKERN_ARCH=	${MLIBDIR}
167.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
168ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
169.else
170ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
171.endif
172.if exists(${ARCHDIR})
173.include "${ARCHDIR}/Makefile.inc"
174.PATH:	${ARCHDIR}
175.else
176SRCS+=	kobj_stubs.c rumpcpu_generic.c
177.endif
178
179.if ${MACHINE} == "sun3"
180CPPFLAGS+=	-Dsun3
181.endif
182
183# include libkern source files
184KERNDIR=${RUMPTOP}/../lib/libkern
185.ifdef RUMPKMOD
186KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
187.endif
188.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
189
190# Some architectures require a little special massage with atomic
191# compare-and-swap.  This is because the kernel version is using
192# instructions or routines unavailable to us in userspace.
193#
194.if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \
195    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
196    || ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000"
197CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
198SRCS+=		atomic_cas_generic.c
199#SRCS+=		rump_atomic_cas_up.c
200.endif
201
202.include <bsd.lib.mk>
203.include <bsd.klinks.mk>
204