1# $NetBSD: Makefile,v 1.39 2018/03/04 07:15:37 mlelstv 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# vers.c 88SRCS+= vers.c 89vers.c: ${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS} 90 ${HOST_SH} ${S}/conf/newvers.sh -r -n 91CLEANFILES+= vers.c version 92 93.else # } { 94 95SRCS+= unsupported.c 96 97.endif # } 98 99.if ${MACHINE} == "sparc" \ 100 || ${MACHINE} == "sparc64" 101COPTS.kern_timeout.c += -Wno-stack-protector 102.endif 103 104.include "../../compat/exec.mk" 105 106.include <bsd.prog.mk> 107.include <bsd.klinks.mk> 108