mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Support -P/--preinclude to pre-INCLUDE a file (#1043)
Fixes #1041 Co-authored-by: ISSOtm <eldredhabert0@gmail.com>
This commit is contained in:
3
test/asm/preinclude.asm
Normal file
3
test/asm/preinclude.asm
Normal file
@@ -0,0 +1,3 @@
|
||||
warn "main {__FILE__}"
|
||||
def v3 = v1 + v2
|
||||
println "{d:v1} + {d:v2} = {d:v3}"
|
||||
4
test/asm/preinclude.err
Normal file
4
test/asm/preinclude.err
Normal file
@@ -0,0 +1,4 @@
|
||||
warning: preinclude.asm(0) -> preinclude.inc(1): [-Wuser]
|
||||
pre-include "preinclude.inc"
|
||||
warning: preinclude.asm(1): [-Wuser]
|
||||
main "preinclude.asm"
|
||||
1
test/asm/preinclude.flags
Normal file
1
test/asm/preinclude.flags
Normal file
@@ -0,0 +1 @@
|
||||
-Weverything -P preinclude.inc
|
||||
11
test/asm/preinclude.inc
Normal file
11
test/asm/preinclude.inc
Normal file
@@ -0,0 +1,11 @@
|
||||
warn "pre-include {__FILE__}"
|
||||
|
||||
def v1 = 12
|
||||
rept 3
|
||||
println "rept 3"
|
||||
endr
|
||||
|
||||
def v2 = 34
|
||||
for i, 3
|
||||
println "for {d:i}/3"
|
||||
endr
|
||||
7
test/asm/preinclude.out
Normal file
7
test/asm/preinclude.out
Normal file
@@ -0,0 +1,7 @@
|
||||
rept 3
|
||||
rept 3
|
||||
rept 3
|
||||
for 0/3
|
||||
for 1/3
|
||||
for 2/3
|
||||
12 + 34 = 46
|
||||
@@ -76,6 +76,11 @@ if ! diff --strip-trailing-cr syntax-error.err $errput; then
|
||||
fi
|
||||
|
||||
for i in *.asm; do
|
||||
flags=${i%.asm}.flags
|
||||
RGBASMFLAGS=-Weverything
|
||||
if [ -f $flags ]; then
|
||||
RGBASMFLAGS="$(head -n 1 "$flags")" # Allow other lines to serve as comments
|
||||
fi
|
||||
for variant in '' '.pipe'; do
|
||||
echo "${bold}${green}${i%.asm}${variant}...${rescolors}${resbold}"
|
||||
desired_errname=${i%.asm}.err
|
||||
@@ -83,7 +88,7 @@ for i in *.asm; do
|
||||
desired_errname=${i%.asm}.simple.err
|
||||
fi
|
||||
if [ -z "$variant" ]; then
|
||||
$RGBASM -Weverything -o $o $i > $output 2> $errput
|
||||
$RGBASM $RGBASMFLAGS -o $o $i > $output 2> $errput
|
||||
desired_output=${i%.asm}.out
|
||||
desired_errput=$desired_errname
|
||||
else
|
||||
@@ -97,7 +102,7 @@ for i in *.asm; do
|
||||
# stdin redirection makes the input an unseekable pipe - a scenario
|
||||
# that's harder to deal with and was broken when the feature was
|
||||
# first implemented.
|
||||
cat $i | $RGBASM -Weverything -o $o - > $output 2> $errput
|
||||
cat $i | $RGBASM $RGBASMFLAGS -o $o - > $output 2> $errput
|
||||
|
||||
# Use two otherwise unused files for temp storage
|
||||
desired_output=$input
|
||||
|
||||
Reference in New Issue
Block a user