Makefile revision 1.38
1#	$NetBSD: Makefile,v 1.38 2018/01/24 09:04:46 skrll 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_access.c db_elf.c db_examine.c
44SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
45SRCS+=	db_sym.c db_variables.c db_write_cmd.c
46
47.PATH:	${S}/arch/${MACHINE}/${MACHINE}
48.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
49SRCS+=	db_disasm.c
50
51.PATH:  $S/kern
52SRCS+=	kern_timeout.c
53CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
54
55CPPFLAGS+=	-I${S}/arch
56
57. if    ${MACHINE} == "amd64" \
58     || ${MACHINE} == "i386"
59MACHINE_FAMILY = x86
60. elif  ${MACHINE} == "sparc64"
61MACHINE_FAMILY = sparc
62. else
63MACHINE_FAMILY = ${MACHINE_CPU}
64. endif
65
66.if ${MACHINE_CPU} == "arm"
67.PATH:	${S}/arch/arm/arm32
68SRCS+=disassem.c cpufunc_asm.S
69.endif
70
71.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}
72
73# crash main source
74SRCS+=	crash.c
75
76# arch.c
77.PATH:	${.CURDIR}/arch
78. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
79SRCS+=	${MACHINE_FAMILY}.c
80. else
81SRCS+=	generic.c
82. endif
83
84COPTS.db_output.c += -Wno-format-nonliteral
85
86# vers.c
87SRCS+=	vers.c
88vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
89	${HOST_SH} ${S}/conf/newvers.sh -r -n
90CLEANFILES+=	vers.c version
91
92.else				# } {
93
94SRCS+=	unsupported.c
95
96.endif				# }
97
98.if  ${MACHINE} == "sparc" \
99    || ${MACHINE} == "sparc64"
100COPTS.kern_timeout.c += -Wno-stack-protector
101.endif
102
103.include "../../compat/exec.mk"
104
105.include <bsd.prog.mk>
106.include <bsd.klinks.mk>
107