coverity appeasement
[minix.git] / kernel / Makefile
blob26fef605e205fac98248bb3e31b9c75982aef764
1 # Makefile for kernel
2 .include <bsd.own.mk>
4 PROG= kernel
6 .include "arch/${MACHINE_ARCH}/Makefile.inc"
8 SRCS+= clock.c cpulocals.c interrupt.c main.c proc.c system.c \
9 table.c utility.c usermapped_data.c
11 LINKERSCRIPT=${.CURDIR}/arch/${MACHINE_ARCH}/kernel.lds
13 DPADD+= ${LIBTIMERS} ${LIBSYS} ${LIBEXEC} $(LINKERSCRIPT)
14 LDADD+= -ltimers -lsys -lexec
16 CFLAGS += -D__kernel__
18 CPPFLAGS+= -fno-stack-protector -D_NETBSD_SOURCE -D_MINIX
19 LDFLAGS+= -T $(LINKERSCRIPT)
20 LDFLAGS+= -nostdlib -L${DESTDIR}/${LIBDIR}
21 LDADD+= -lminlib
22 DPADD+= ${LIBMINLIB}
23 .if !empty(CC:M*gcc)
24 LDADD+= -lgcc -lsys -lgcc -lminc
25 .elif !empty(CC:M*clang)
26 LDADD+= -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic -lminc
27 DPADD+= ${LIBC}
28 .endif
30 CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${MACHINE_ARCH}/include -I${NETBSDSRCDIR}
32 BINDIR= /usr/sbin
33 MAN=
35 .include "system/Makefile.inc"
37 .ifdef CONFIG_SMP
38 SRCS+= smp.c
39 .endif
41 .if ${USE_WATCHDOG} != "no"
42 SRCS+= watchdog.c
43 CPPFLAGS+= -DUSE_WATCHDOG
44 .endif
46 .if ${USE_MCONTEXT} != "no"
47 SRCS+= do_mcontext.c
48 CPPFLAGS+= -DUSE_MCONTEXT
49 .endif
51 # Extra debugging routines
52 .if ${USE_SYSDEBUG} != "no"
53 SRCS+= debug.c
54 CPPFLAGS+= -DUSE_SYSDEBUG
55 .endif
57 # These come last, so the profiling buffer is at the end of the data segment
58 SRCS+= profile.c do_sprofile.c
60 .if ${USE_LIVEUPDATE} != "no"
61 CPPFLAGS+= -DUSE_UPDATE
62 .endif
64 .if ${USE_STATECTL} != "no"
65 CPPFLAGS+= -DUSE_STATECTL
66 .endif
68 .if ${USE_TRACE} != "no"
69 CPPFLAGS+= -DUSE_TRACE
70 .endif
72 .include <bsd.prog.mk>
74 debug.d: extracted-errno.h extracted-mfield.h extracted-mtype.h
76 CLEANFILES+=extracted-errno.h extracted-mfield.h extracted-mtype.h procoffsets.h
78 extracted-errno.h: extract-errno.sh ../include/errno.h
79 ${_MKTARGET_CREATE}
80 cd ${.CURDIR} ; sh extract-errno.sh > ${.OBJDIR}/extracted-errno.h
82 extracted-mfield.h: extract-mfield.sh ../lib/libc/sys-minix/*.c ../lib/libsys/*.c
83 ${_MKTARGET_CREATE}
84 cd ${.CURDIR} ; sh extract-mfield.sh > ${.OBJDIR}/extracted-mfield.h
86 extracted-mtype.h: extract-mtype.sh ../include/minix/com.h
87 ${_MKTARGET_CREATE}
88 cd ${.CURDIR} ; sh extract-mtype.sh > ${.OBJDIR}/extracted-mtype.h
90 clean:
91 rm -f extracted-errno.h extracted-mfield.h extracted-mtype.h