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