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