1 # $NetBSD: Makefile,v 1.37 2017/07/21 20:58:44 nakayama Exp $ 2 3 PROG= crash 4 MAN= crash.8 5 RUMPKERNEL= yes # XXX: Avoid -mcmodel=kernel 6 7 CWARNFLAGS.clang+= -Wno-format 8 9 LDADD+= -lutil -lkvm -ledit -lterminfo 10 DPADD+= ${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" && ${MACHINE} != "acorn26") \ 22 || ${MACHINE_ARCH} == "m68k" 23 SRCS+= db_trace.c 24 .if ${MACHINE_ARCH} != "m68k" 25 SRCS+= db_machdep.c 26 .endif 27 REALCRASH=yes 28 .else 29 REALCRASH=no 30 .endif 31 32 .if ${REALCRASH} != "no" # { 33 34 S= ${.CURDIR}/../../sys 35 36 CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing 37 CPPFLAGS+= -DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER 38 CPPFLAGS+= -UDB_MACHINE_COMMANDS 39 40 # ddb files from kernel 41 .PATH: $S/ddb 42 SRCS+= db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c 43 SRCS+= db_access.c db_elf.c db_examine.c 44 SRCS+= db_expr.c db_lex.c db_output.c db_print.c 45 SRCS+= 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} 49 SRCS+= db_disasm.c 50 51 .PATH: $S/kern 52 SRCS+= kern_timeout.c 53 CPPFLAGS.kern_timeout.c += -DCRASH -DDDB 54 55 CPPFLAGS+= -I${S}/arch 56 57 . if ${MACHINE} == "amd64" \ 58 || ${MACHINE} == "i386" 59 MACHINE_FAMILY = x86 60 . elif ${MACHINE} == "sparc64" 61 MACHINE_FAMILY = sparc 62 . else 63 MACHINE_FAMILY = ${MACHINE_CPU} 64 . endif 65 66 .if ${MACHINE_CPU} == "arm" 67 .PATH: ${S}/arch/arm/arm32 68 SRCS+=disassem.c cpufunc_asm.S 69 .endif 70 71 .PATH: ${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY} 72 73 # crash main source 74 SRCS+= crash.c 75 76 # arch.c 77 .PATH: ${.CURDIR}/arch 78 . if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c)) 79 SRCS+= ${MACHINE_FAMILY}.c 80 . else 81 SRCS+= generic.c 82 . endif 83 84 COPTS.db_output.c += -Wno-format-nonliteral 85 86 # vers.c 87 SRCS+= vers.c 88 vers.c: ${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS} 89 ${HOST_SH} ${S}/conf/newvers.sh -r -n 90 CLEANFILES+= vers.c version 91 92 .else # } { 93 94 SRCS+= unsupported.c 95 96 .endif # } 97 98 .if ${MACHINE} == "sparc" \ 99 || ${MACHINE} == "sparc64" 100 COPTS.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