Makefile revision 1.45
11.45Smrg#	$NetBSD: Makefile,v 1.45 2020/08/17 04:15:33 mrg Exp $
21.1Sad
31.7SchristosPROG=		crash
41.7SchristosMAN=		crash.8
51.3SchristosRUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
61.1Sad
71.12SjoergCWARNFLAGS.clang+=	-Wno-format
81.12Sjoerg
91.14SskrllLDADD+=	-lutil -lkvm -ledit -lterminfo
101.7SchristosDPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
111.1Sad
121.27Sskrll.include <bsd.own.mk>
131.27Sskrll
141.1Sad# some ddb kernel components need limited modifications.  for now,
151.1Sad# punt if not noted as implemented here.
161.10Smrg.if    ${MACHINE} == "amd64" \
171.25Sskrll    || ${MACHINE} == "hppa" \
181.10Smrg    || ${MACHINE} == "i386" \
191.32Smrg    || ${MACHINE} == "sparc" \
201.16Smlelstv    || ${MACHINE} == "sparc64" \
211.38Sskrll    || ${MACHINE_CPU} == "arm" \
221.41Sjakllsch    || ${MACHINE_CPU} == "aarch64" \
231.45Smrg    || ${MACHINE_CPU} == "mips" \
241.16Smlelstv    || ${MACHINE_ARCH} == "m68k"
251.17SchristosSRCS+=	db_trace.c
261.45Smrg.if ${MACHINE_CPU} == "mips"
271.45SmrgSRCS+=	db_interface.c mips_stacktrace.c
281.45SmrgCPPFLAGS+=	-DDDB
291.45Smrg.elif ${MACHINE_ARCH} != "m68k"
301.17SchristosSRCS+=	db_machdep.c
311.21Schristos.endif
321.10SmrgREALCRASH=yes
331.1Sad.else
341.10SmrgREALCRASH=no
351.10Smrg.endif
361.10Smrg
371.10Smrg.if ${REALCRASH} != "no"	# {
381.1Sad
391.7SchristosS=		${.CURDIR}/../../sys
401.1Sad
411.1SadCPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
421.1SadCPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER
431.31SchristosCPPFLAGS+=	-UDB_MACHINE_COMMANDS
441.1Sad
451.1Sad# ddb files from kernel
461.1Sad.PATH:	$S/ddb
471.1SadSRCS+=	db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c
481.39SmlelstvSRCS+=  db_autoconf.c
491.1SadSRCS+=	db_access.c db_elf.c db_examine.c
501.1SadSRCS+=	db_expr.c db_lex.c db_output.c db_print.c
511.1SadSRCS+=	db_sym.c db_variables.c db_write_cmd.c
521.1Sad
531.7Schristos.PATH:	${S}/arch/${MACHINE}/${MACHINE}
541.15Sskrll.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
551.10SmrgSRCS+=	db_disasm.c
561.7Schristos
571.28Schristos.PATH:  $S/kern
581.28SchristosSRCS+=	kern_timeout.c
591.29SchristosCPPFLAGS.kern_timeout.c += -DCRASH -DDDB
601.28Schristos
611.44SrinCPPFLAGS +=-DLOCKDEBUG
621.44SrinSRCS += subr_lockdebug.c
631.44SrinCPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
641.44Srin
651.17SchristosCPPFLAGS+=	-I${S}/arch
661.17Schristos
671.10Smrg. if    ${MACHINE} == "amd64" \
681.10Smrg     || ${MACHINE} == "i386"
691.11SchristosMACHINE_FAMILY = x86
701.32Smrg. elif  ${MACHINE} == "sparc64"
711.24SchristosMACHINE_FAMILY = sparc
721.11Schristos. else
731.27SskrllMACHINE_FAMILY = ${MACHINE_CPU}
741.10Smrg. endif
751.10Smrg
761.27Sskrll.if ${MACHINE_CPU} == "arm"
771.17Schristos.PATH:	${S}/arch/arm/arm32
781.22SskrllSRCS+=disassem.c cpufunc_asm.S
791.17Schristos.endif
801.41Sjakllsch.if ${MACHINE_CPU} == "aarch64"
811.41SjakllschSRCS+=disasm.c
821.41Sjakllsch.endif
831.1Sad
841.17Schristos.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}
851.16Smlelstv
861.1Sad# crash main source
871.1SadSRCS+=	crash.c
881.1Sad
891.1Sad# arch.c
901.1Sad.PATH:	${.CURDIR}/arch
911.11Schristos. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
921.11SchristosSRCS+=	${MACHINE_FAMILY}.c
931.7Schristos. else
941.1SadSRCS+=	generic.c
951.7Schristos. endif
961.1Sad
971.13SchristosCOPTS.db_output.c += -Wno-format-nonliteral
981.13Schristos
991.40Schristos.if ${MKREPRO} == "yes"
1001.40Schristos.       if ${MKREPRO_TIMESTAMP:U0} != 0
1011.40SchristosNVFLAGS+=-r ${MKREPRO_TIMESTAMP}
1021.40Schristos.       else
1031.40SchristosNVFLAGS+=-R
1041.40Schristos.       endif
1051.40Schristos.endif
1061.40Schristos
1071.1Sad# vers.c
1081.1SadSRCS+=	vers.c
1091.23Sapbvers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
1101.40Schristos	${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
1111.1SadCLEANFILES+=	vers.c version
1121.1Sad
1131.10Smrg.else				# } {
1141.10Smrg
1151.10SmrgSRCS+=	unsupported.c
1161.10Smrg
1171.10Smrg.endif				# }
1181.1Sad
1191.36Schristos.if  ${MACHINE} == "sparc" \
1201.36Schristos    || ${MACHINE} == "sparc64"
1211.34SchristosCOPTS.kern_timeout.c += -Wno-stack-protector
1221.36Schristos.endif
1231.34Schristos
1241.33Smrg.include "../../compat/exec.mk"
1251.33Smrg
1261.42SmrgCOPTS.db_command.c+=	${GCC_NO_CAST_FUNCTION_TYPE}
1271.42Smrg
1281.1Sad.include <bsd.prog.mk>
1291.1Sad.include <bsd.klinks.mk>
130