Makefile revision 1.43
1#	$NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos 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
33CPPFLAGS +=-DLOCKDEBUG
34CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
35SRCS += subr_lockdebug.c
36
37.if ${REALCRASH} != "no"	# {
38
39S=		${.CURDIR}/../../sys
40
41CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
42CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER
43CPPFLAGS+=	-UDB_MACHINE_COMMANDS
44
45# ddb files from kernel
46.PATH:	$S/ddb
47SRCS+=	db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c
48SRCS+=  db_autoconf.c
49SRCS+=	db_access.c db_elf.c db_examine.c
50SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
51SRCS+=	db_sym.c db_variables.c db_write_cmd.c
52
53.PATH:	${S}/arch/${MACHINE}/${MACHINE}
54.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
55SRCS+=	db_disasm.c
56
57.PATH:  $S/kern
58SRCS+=	kern_timeout.c
59CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
60
61CPPFLAGS+=	-I${S}/arch
62
63. if    ${MACHINE} == "amd64" \
64     || ${MACHINE} == "i386"
65MACHINE_FAMILY = x86
66. elif  ${MACHINE} == "sparc64"
67MACHINE_FAMILY = sparc
68. else
69MACHINE_FAMILY = ${MACHINE_CPU}
70. endif
71
72.if ${MACHINE_CPU} == "arm"
73.PATH:	${S}/arch/arm/arm32
74SRCS+=disassem.c cpufunc_asm.S
75.endif
76.if ${MACHINE_CPU} == "aarch64"
77SRCS+=disasm.c
78.endif
79
80.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}
81
82# crash main source
83SRCS+=	crash.c
84
85# arch.c
86.PATH:	${.CURDIR}/arch
87. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
88SRCS+=	${MACHINE_FAMILY}.c
89. else
90SRCS+=	generic.c
91. endif
92
93COPTS.db_output.c += -Wno-format-nonliteral
94
95.if ${MKREPRO} == "yes"
96.       if ${MKREPRO_TIMESTAMP:U0} != 0
97NVFLAGS+=-r ${MKREPRO_TIMESTAMP}
98.       else
99NVFLAGS+=-R
100.       endif
101.endif
102
103# vers.c
104SRCS+=	vers.c
105vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
106	${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
107CLEANFILES+=	vers.c version
108
109.else				# } {
110
111SRCS+=	unsupported.c
112
113.endif				# }
114
115.if  ${MACHINE} == "sparc" \
116    || ${MACHINE} == "sparc64"
117COPTS.kern_timeout.c += -Wno-stack-protector
118.endif
119
120.include "../../compat/exec.mk"
121
122COPTS.db_command.c+=	${GCC_NO_CAST_FUNCTION_TYPE}
123
124.include <bsd.prog.mk>
125.include <bsd.klinks.mk>
126