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