Skip to content

Commit 5aa6642

Browse files
author
djevangelia
committed
Enable setting DEBUG_MODE for C through build.py
1 parent 2900fed commit 5aa6642

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

ASM/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ CFLAGS = -O1 -G0 -fno-reorder-blocks -march=vr4300 -mtune=vr4300 -mabi=32 -mno-g
88
-mexplicit-relocs
99
CPPFLAGS = -DF3DEX_GBI_2
1010

11+
ifdef DEBUG_MODE
12+
CFLAGS += -DDEBUG_MODE=1
13+
endif
14+
1115
OUTDIR := build
1216
OBJDIR := build/bin
1317
SRCDIR := c

ASM/build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
parser.add_argument('--dump-obj', action='store_true', help="Dumps extra object info for debugging purposes. Does nothing with --no-compile-c")
1919
parser.add_argument('--diff-only', action='store_true', help="Creates diff output without running armips")
2020
parser.add_argument('--mips-binutils-prefix', type=str, default="mips64-", help="Use a different prefix for N64 toolchain")
21+
parser.add_argument('--debug-c', action='store_true', help="Define DEBUG_MODE 1 for C modules")
2122

2223
args = parser.parse_args()
2324
pj64_sym_path = args.pj64sym
2425
compile_c = not args.no_compile_c
2526
dump_obj = args.dump_obj
2627
diff_only = args.diff_only
2728
mips_binutils_prefix = args.mips_binutils_prefix
29+
debug_c = args.debug_c
2830

2931
root_dir = os.path.dirname(os.path.realpath(__file__))
3032
tools_dir = os.path.join(root_dir, 'tools')
@@ -47,6 +49,8 @@
4749
if compile_c:
4850
clist = ['make']
4951
clist.append(f'MIPS_BINUTILS_PREFIX={mips_binutils_prefix}')
52+
if debug_c:
53+
clist.append(f'DEBUG_MODE=1')
5054
if dump_obj:
5155
clist.append('RUN_OBJDUMP=1')
5256
try:

ASM/c/debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#ifndef DEBUG_H
22
#define DEBUG_H
33

4+
#ifndef DEBUG_MODE
45
#define DEBUG_MODE 0
6+
#endif
57

68
#include "z64.h"
79
#include "gfx.h"

0 commit comments

Comments
 (0)