summaryrefslogtreecommitdiff
path: root/usr.sbin/crash/Makefile
blob: 125b9648c66bc285a213e0b58b283aa1964cd014 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#	$NetBSD: Makefile,v 1.25 2014/02/24 07:23:44 skrll Exp $

PROG=		crash
MAN=		crash.8
RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel

CWARNFLAGS.clang+=	-Wno-format

LDADD+=	-lutil -lkvm -ledit -lterminfo
DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}

# some ddb kernel components need limited modifications.  for now,
# punt if not noted as implemented here.
.if    ${MACHINE} == "amd64" \
    || ${MACHINE} == "hppa" \
    || ${MACHINE} == "i386" \
    || ${MACHINE} == "sparc64" \
    || (${MACHINE_ARCH} == "arm" && ${MACHINE} != "acorn26") \
    || ${MACHINE_ARCH} == "m68k"
SRCS+=	db_trace.c
.if ${MACHINE_ARCH} != "m68k"
SRCS+=	db_machdep.c
.endif
REALCRASH=yes
.else
REALCRASH=no
.endif

.if ${REALCRASH} != "no"	# {

S=		${.CURDIR}/../../sys

CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER
CPPFLAGS+=	-UDB_MACHINE_COMMANDS

# ddb files from kernel
.PATH:	$S/ddb
SRCS+=	db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c
SRCS+=	db_access.c db_elf.c db_examine.c
SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
SRCS+=	db_sym.c db_variables.c db_write_cmd.c

.PATH:	${S}/arch/${MACHINE}/${MACHINE}
.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
SRCS+=	db_disasm.c

CPPFLAGS+=	-I${S}/arch

. if    ${MACHINE} == "amd64" \
     || ${MACHINE} == "i386"
MACHINE_FAMILY = x86
. elif  ${MACHINE_ARCH} == "m68k" \
     || ${MACHINE_ARCH} == "arm"
MACHINE_FAMILY = ${MACHINE_ARCH}
. elif    ${MACHINE} == "sparc64" \
     || ${MACHINE} == "sparc64"
MACHINE_FAMILY = sparc
. else
MACHINE_FAMILY = ${MACHINE}
. endif

.if ${MACHINE_ARCH} == "arm"
.PATH:	${S}/arch/arm/arm32
SRCS+=disassem.c cpufunc_asm.S
.endif

.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}

# crash main source
SRCS+=	crash.c

# arch.c
.PATH:	${.CURDIR}/arch
. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
SRCS+=	${MACHINE_FAMILY}.c
. else
SRCS+=	generic.c
. endif

COPTS.db_output.c += -Wno-format-nonliteral

# vers.c
SRCS+=	vers.c
vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
	${HOST_SH} ${S}/conf/newvers.sh -r -n
CLEANFILES+=	vers.c version

.else				# } {

SRCS+=	unsupported.c

.endif				# }

.include <bsd.prog.mk>
.include <bsd.klinks.mk>