Makefile.rumpkern revision 1.175
1#	$NetBSD: Makefile.rumpkern,v 1.175 2019/05/13 17:49:05 bad Exp $
2#
3
4IOCONFDIR:=	${.PARSEDIR}
5IOCONF=		MAINBUS.ioconf
6
7LIB=		rump
8COMMENT=	Rump kernel base
9
10MAN=		rump.3 rump_lwproc.3
11
12.PATH:	${RUMPTOP}/librump/rumpkern				\
13	${RUMPTOP}/librump/rumpkern/arch/generic		\
14	${RUMPTOP}/../kern					\
15	${RUMPTOP}/../uvm					\
16	${RUMPTOP}/../conf					\
17	${RUMPTOP}/../dev					\
18	${RUMPTOP}/../crypto/nist_ctr_drbg			\
19	${RUMPTOP}/../crypto/rijndael				\
20	${RUMPTOP}/../crypto/cprng_fast				\
21	${RUMPTOP}/../secmodel					\
22	${RUMPTOP}/../secmodel/suser				\
23	${RUMPTOP}/../compat/common
24
25#
26# Source modules, first the ones specifically implemented for librump.
27# 
28SRCS+=	rump.c rumpcopy.c cons.c emul.c etfs_wrap.c intr.c	\
29	lwproc.c klock.c kobj_rename.c ltsleep.c scheduler.c	\
30	signals.c sleepq.c threads.c vm.c hyperentropy.c	\
31	accessors.c
32
33SRCS+=	rump_autoconf.c rumpkern_syscalls.c
34
35# autogenerated into the correct namespace
36RUMPOBJ_NORENAME= rump_syscalls.o rump_syscalls.pico rump_syscalls.po
37
38.ifdef RUMP_KERNEL_IS_LIBC
39CPPFLAGS+= -DRUMP_KERNEL_IS_LIBC
40.endif
41
42# Multiprocessor or uniprocessor locking.  TODO: select right
43# locking at runtime.
44.if ${RUMP_LOCKS_UP:Uno} == "yes"
45SRCS+=	locks_up.c
46.else
47SRCS+=	locks.c
48.endif
49
50vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
51		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
52	${_MKMSG_CREATE} vers.c
53	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -R
54SRCS+=		vers.c
55CLEANFILES+=	vers.c version
56
57# autogenerated
58#
59SRCS+=	rump_syscalls.c rumpkern_if_wrappers.c
60
61# "auto"generated
62SRCS+=	devsw.c
63
64#
65# std kernel sources
66#
67# sys/kern
68SRCS+=	init_sysctl_base.c	\
69	compat_stub.c		\
70	kern_auth.c		\
71	kern_cfglock.c		\
72	kern_clock.c		\
73	kern_descrip.c		\
74	kern_event.c		\
75	kern_hook.c		\
76	kern_ksyms.c		\
77	kern_malloc.c		\
78	kern_module.c		\
79	kern_mutex_obj.c	\
80	kern_ntptime.c		\
81	kern_proc.c		\
82	kern_prot.c		\
83	kern_rate.c		\
84	kern_reboot.c		\
85	kern_resource.c		\
86	kern_rndpool.c		\
87	kern_rndq.c		\
88	kern_rndsink.c		\
89	kern_rwlock_obj.c	\
90	kern_scdebug.c		\
91	kern_stub.c		\
92	kern_ssp.c		\
93	kern_syscall.c		\
94	kern_sysctl.c		\
95	kern_tc.c		\
96	kern_threadpool.c	\
97	kern_time.c		\
98	kern_timeout.c		\
99	kern_uidinfo.c		\
100	param.c			\
101	subr_autoconf.c		\
102	subr_callback.c		\
103	subr_copy.c		\
104	subr_cprng.c		\
105	subr_device.c		\
106	subr_devsw.c		\
107	subr_evcnt.c		\
108	subr_extent.c		\
109	subr_hash.c		\
110	subr_humanize.c		\
111	subr_iostat.c		\
112	subr_kcpuset.c		\
113	subr_kmem.c		\
114	subr_kobj.c		\
115	subr_localcount.c	\
116	subr_log.c		\
117	subr_lwp_specificdata.c	\
118	subr_once.c		\
119	subr_pcq.c		\
120	subr_percpu.c		\
121	subr_pool.c		\
122	subr_prf.c		\
123	subr_pserialize.c	\
124	subr_psref.c		\
125	subr_specificdata.c	\
126	subr_time.c		\
127	subr_thmap.c		\
128	subr_vmem.c		\
129	subr_workqueue.c	\
130	subr_xcall.c		\
131	sys_descrip.c		\
132	sys_generic.c		\
133	sys_module.c		\
134	sys_pipe.c		\
135	sys_select.c		\
136	syscalls.c		\
137	uipc_sem.c
138
139# sys/uvm
140SRCS+=	uvm_aobj.c uvm_readahead.c uvm_object.c uvm_swapstub.c
141
142# 4.4BSD secmodel.  selection is hardcoded for now
143SRCS+=	secmodel.c
144SRCS+=	secmodel_suser.c
145
146# the funny bit.  this doesn't really belong here, but helps with the
147# needs of kern_descrip.c.  And since it's a fully dynamic interface,
148# it doesn't pull in other gunk.
149SRCS+=	vnode_if.c
150
151# sys/dev
152SRCS+=	clock_subr.c
153
154# sys/dev/crypto
155# Note: these are here only for cprng.  More crypto algos for drivers
156# are available from the rumpkern_crypto component
157SRCS+=	nist_ctr_drbg.c
158SRCS+=	rijndael-alg-fst.c
159SRCS+=	rijndael-api-fst.c
160SRCS+=	rijndael.c
161SRCS+=	cprng_fast.c
162
163.include "${RUMPTOP}/Makefile.rump"
164.include <bsd.own.mk>
165
166# compat
167.if !empty(RUMP_NBCOMPAT:M50)
168SRCS+=	kern_select_50.c
169SRCS+=	kern_time_50.c
170SRCS+=	rndpseudo_50.c
171.endif
172
173
174.ifdef RUMP_LOCKDEBUG
175SRCS+=		subr_lockdebug.c
176.endif
177
178.if ${RUMP_KTRACE} == "yes"
179SRCS+=		kern_ktrace.c
180.endif
181
182CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern
183AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
184
185#
186# If archdir exists, it is required to provide:
187# 1) kobj_reloc() and kobj_machdep()
188# 2) rump_cpu_bootstrap()
189# 3) ...?
190# 4) PROFIT!
191#
192
193#
194# Check if we are building compat.  In compat mode we need to provide
195# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
196# take MD stuff from the right arch.
197#
198.if defined(COMPAT_MACHINE_CPU) \
199    && exists(${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU})
200ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${COMPAT_MACHINE_CPU}
201LIBKERN_ARCH=	${COMPAT_MACHINE_CPU}
202.elif defined(MLIBDIR)
203ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MLIBDIR}
204LIBKERN_ARCH=	${MLIBDIR}
205.elif exists(${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU})
206ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_CPU}
207.else
208ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
209.endif
210.if !exists(${ARCHDIR})
211ARCHDIR=	${RUMPTOP}/librump/rumpkern/arch/generic
212.endif
213
214.include "${ARCHDIR}/Makefile.inc"
215.PATH:	${ARCHDIR}
216
217.if ${MACHINE} == "sun3"
218CPPFLAGS+=	-Dsun3
219.endif
220
221# include libkern source files
222KERNDIR=${RUMPTOP}/../lib/libkern
223.if "${_RUMP_NATIVEABI}" == "yes"
224KERNMISCCPPFLAGS+=	-D_RUMPKERNEL
225.endif
226.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
227
228# Some architectures require a little special massage with atomic
229# compare-and-swap.  This is because the kernel version is using
230# instructions or routines unavailable to us in userspace.
231#
232.if (${MACHINE_CPU} == "arm" && "${FEAT_LDREX}" != "yes") \
233    || ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "hppa" \
234    || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
235    || ${MACHINE_ARCH} == "vax" || ${MACHINE_ARCH} == "m68000"
236CPPFLAGS+=	-I${RUMPTOP}/../../common/lib/libc/atomic
237SRCS+=		atomic_cas_generic.c
238#SRCS+=		rump_atomic_cas_up.c
239.endif
240
241.include <bsd.lib.mk>
242.include <bsd.klinks.mk>
243