Makefile.rumpkern revision 1.104
1#	$NetBSD: Makefile.rumpkern,v 1.104 2010/12/17 00:53:16 joerg Exp $
2#
3
4.include "${RUMPTOP}/Makefile.rump"
5
6LIB=		rump
7
8.PATH:	${RUMPTOP}/librump/rumpkern				\
9	${RUMPTOP}/../kern					\
10	${RUMPTOP}/../uvm					\
11	${RUMPTOP}/../conf					\
12	${RUMPTOP}/../dev					\
13	${RUMPTOP}/../secmodel/suser
14
15#
16# Source modules, first the ones specifically implemented for librump.
17# 
18SRCS=	rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c	\
19	kobj_rename.c ltsleep.c memalloc.c scheduler.c		\
20	signals.c sleepq.c threads.c vm.c
21SRCS+=	compat.c
22
23# Multiprocessor or uniprocessor locking.  TODO: select right
24# locking at runtime.
25SRCS+=	locks.c
26#SRCS+=	locks_up.c
27
28# Does the arch support multiple processors?
29.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
30RUMP_SMP=		# defined
31CPPFLAGS.rump.c+=	-DRUMP_SMP
32.endif
33
34MKREPRO?=no
35
36.if ${MKREPRO} == "yes"
37_NVFLAGS=-r
38.else
39_NVFLAGS=
40.endif
41
42vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh ${RUMPTOP}/../sys/param.h
43	${_MKMSG_CREATE} vers.c
44	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n ${_NVFLAGS}
45SRCS+=		vers.c
46CLEANFILES+=	vers.c version
47
48# use MI pmap for archs not conforming to kernel ABI
49.ifndef RUMPKMOD
50SRCS+=	pmap_stub.c
51.endif
52
53# autogenerated
54#
55SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
56
57# "auto"generated
58SRCS+=	devsw.c
59
60#
61# std kernel sources
62#
63# sys/kern
64SRCS+=	init_sysctl_base.c	\
65	kern_auth.c		\
66	kern_cfglock.c		\
67	kern_descrip.c		\
68	kern_event.c		\
69	kern_hook.c		\
70	kern_ksyms.c		\
71	kern_malloc_stdtype.c	\
72	kern_module.c		\
73	kern_mutex_obj.c	\
74	kern_ntptime.c		\
75	kern_proc.c		\
76	kern_prot.c		\
77	kern_rate.c		\
78	kern_resource.c		\
79	kern_stub.c		\
80	kern_syscall.c		\
81	kern_sysctl.c		\
82	kern_tc.c		\
83	kern_timeout.c		\
84	kern_uidinfo.c		\
85	kern_xxx.c		\
86	param.c			\
87	subr_devsw.c		\
88	subr_callback.c		\
89	subr_copy.c		\
90	subr_device.c		\
91	subr_evcnt.c		\
92	subr_extent.c		\
93	subr_hash.c		\
94	subr_humanize.c		\
95	subr_iostat.c		\
96	subr_kobj.c		\
97	subr_log.c		\
98	subr_lwp_specificdata.c	\
99	subr_once.c		\
100	subr_prf.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
112# sys/uvm
113SRCS+=	uvm_aobj.c uvm_readahead.c
114
115# 4.4BSD secmodel.  selection is hardcoded for now
116SRCS+=	secmodel_suser.c
117
118# the funny bit.  this doesn't really belong here, but helps with the
119# needs of kern_descrip.c.  And since it's a fully dynamic interface,
120# it doesn't pull in other gunk.
121SRCS+=	vnode_if.c
122
123# sys/dev
124SRCS+=	clock_subr.c
125
126# Flip the comment to the other line if you want to use malloc(3)
127# directly instead of the kernel allocators backed by malloc(3)/mmap(2).
128# Libc malloc is a few percent faster, but doesn't emulate all kernel
129# corner cases as well (not to mention if you want to debug the
130# allocators themselves).
131#CPPFLAGS+=	-DRUMP_USE_UNREAL_ALLOCATORS
132SRCS+=		subr_kmem.c subr_percpu.c subr_pool.c subr_vmem.c
133
134# no shlib_version because this is automatically in sync with lib/librump
135SHLIB_MAJOR=    0
136SHLIB_MINOR=    0
137
138CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern -I${RUMPTOP}/librump/rumpvfs
139CPPFLAGS+=	-I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpdev
140AFLAGS+=	-D_LOCORE -Wa,-fatal-warnings
141
142#
143# If archdir exists, it is required to provide:
144# 1) kobj_reloc() and kobj_machdep()
145# 2) rump_cpu_bootstrap()
146# 3) ...?
147# 4) PROFIT!
148#
149
150#
151# Check if we are building compat.  In compat mode we need to provide
152# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
153# take MD stuff from the right arch.
154#
155.ifdef MLIBDIR
156ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
157LIBKERN_ARCH=	${MLIBDIR}
158.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
159ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
160.else
161ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
162.endif
163.if exists(${ARCHDIR})
164.include "${ARCHDIR}/Makefile.inc"
165.PATH:	${ARCHDIR}
166.else
167SRCS+=	kobj_stubs.c rumpcpu_generic.c
168.endif
169
170.if ${MACHINE} == "sun3"
171CPPFLAGS+=	-Dsun3
172.endif
173
174# include libkern source files
175KERNDIR=${RUMPTOP}/../lib/libkern
176.ifdef RUMPKMOD
177KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
178.endif
179.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
180
181# Some architectures require a little special massage with atomic
182# compare-and-swap.  This is because the kernel version is using
183# instructions or routines unavailable to us in userspace.  We
184# use a very simple CAS routine which (correctly) assumes non-SMP
185# and no preemption.  If some of these archs later develop MP
186# support, switch them to use atomic_cas_generic.c
187#
188.if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \
189    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
190    || ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000"
191CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
192.ifdef RUMP_SMP
193SRCS+=		atomic_cas_generic.c
194.else
195SRCS+=		rump_atomic_cas_up.c
196.endif
197.endif
198
199.include <bsd.lib.mk>
200.include <bsd.klinks.mk>
201