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