Makefile revision 1.42
1#	$NetBSD: Makefile,v 1.42 2019/10/13 07:28:18 mrg Exp $
2
3PROG=		crash
4MAN=		crash.8
5RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
6
7CWARNFLAGS.clang+=	-Wno-format
8
9LDADD+=	-lutil -lkvm -ledit -lterminfo
10DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
11
12.include <bsd.own.mk>
13
14# some ddb kernel components need limited modifications.  for now,
15# punt if not noted as implemented here.
16.if    ${MACHINE} == "amd64" \
17    || ${MACHINE} == "hppa" \
18    || ${MACHINE} == "i386" \
19    || ${MACHINE} == "sparc" \
20    || ${MACHINE} == "sparc64" \
21    || ${MACHINE_CPU} == "arm" \
22    || ${MACHINE_CPU} == "aarch64" \
23    || ${MACHINE_ARCH} == "m68k"
24SRCS+=	db_trace.c
25.if ${MACHINE_ARCH} != "m68k"
26SRCS+=	db_machdep.c
27.endif
28REALCRASH=yes
29.else
30REALCRASH=no
31.endif
32
33.if ${REALCRASH} != "no"	# {
34
35S=		${.CURDIR}/../../sys
36
37CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
38CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER
39CPPFLAGS+=	-UDB_MACHINE_COMMANDS
40
41# ddb files from kernel
42.PATH:	$S/ddb
43SRCS+=	db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c
44SRCS+=  db_autoconf.c
45SRCS+=	db_access.c db_elf.c db_examine.c
46SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
47SRCS+=	db_sym.c db_variables.c db_write_cmd.c
48
49.PATH:	${S}/arch/${MACHINE}/${MACHINE}
50.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
51SRCS+=	db_disasm.c
52
53.PATH:  $S/kern
54SRCS+=	kern_timeout.c
55CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
56
57CPPFLAGS+=	-I${S}/arch
58
59. if    ${MACHINE} == "amd64" \
60     || ${MACHINE} == "i386"
61MACHINE_FAMILY = x86
62. elif  ${MACHINE} == "sparc64"
63MACHINE_FAMILY = sparc
64. else
65MACHINE_FAMILY = ${MACHINE_CPU}
66. endif
67
68.if ${MACHINE_CPU} == "arm"
69.PATH:	${S}/arch/arm/arm32
70SRCS+=disassem.c cpufunc_asm.S
71.endif
72.if ${MACHINE_CPU} == "aarch64"
73SRCS+=disasm.c
74.endif
75
76.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}
77
78# crash main source
79SRCS+=	crash.c
80
81# arch.c
82.PATH:	${.CURDIR}/arch
83. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
84SRCS+=	${MACHINE_FAMILY}.c
85. else
86SRCS+=	generic.c
87. endif
88
89COPTS.db_output.c += -Wno-format-nonliteral
90
91.if ${MKREPRO} == "yes"
92.       if ${MKREPRO_TIMESTAMP:U0} != 0
93NVFLAGS+=-r ${MKREPRO_TIMESTAMP}
94.       else
95NVFLAGS+=-R
96.       endif
97.endif
98
99# vers.c
100SRCS+=	vers.c
101vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
102	${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
103CLEANFILES+=	vers.c version
104
105.else				# } {
106
107SRCS+=	unsupported.c
108
109.endif				# }
110
111.if  ${MACHINE} == "sparc" \
112    || ${MACHINE} == "sparc64"
113COPTS.kern_timeout.c += -Wno-stack-protector
114.endif
115
116.include "../../compat/exec.mk"
117
118COPTS.db_command.c+=	${GCC_NO_CAST_FUNCTION_TYPE}
119
120.include <bsd.prog.mk>
121.include <bsd.klinks.mk>
122