Skip to content

Commit

Permalink
[bndbuild] Update the jinja example to use conditionnal build
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty/Benediction committed Jul 14, 2024
1 parent fea3a00 commit dbe2487
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
38 changes: 34 additions & 4 deletions cpclib-bndbuild/tests/jinja/bndbuild.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
{% set source = "test.asm" %}
#!/bndbuild
# bndbuild -DCPCADDR=<myip> m4 if you want a specific address for the M4
# bndbuild -DASSEMBLER=rasm m4 if you want to assemble with rasm (needs to be on the PATH) instead of basm
# bndbuild DASSEMBLER=rasm --dot | dot -Tpng | display if you want to see the dependency tree for rasm-based construction

{%- if not CPCADDR -%}
{%- set CPCADDR = "192.168.1.26" -%}
{%- endif -%}
{{ASSEMBLER}}

{%- if not ASSEMBLER -%}
{%- set ASSEMBLER = "basm" -%}
{%- endif -%}
{{ASSEMBLER}}

{%- macro assemble(base) -%}
{%- if ASSEMBLER == "rasm" -%}
extern rasm {{base}}
{%- elif ASSEMBLER == "basm" -%}
basm {{base}}
{%- else -%}
{{- fail("wrong ASSEMBER value: " + ASSEMBLER) }}
{%- endif -%}
{%- endmacro -%}

{%- set source = "test.asm" -%}
{%- set prog = "TEST" %}

- dep: {{source}}
tgt: test.o
cmd: basm {{source}} -o test.o
tgt: {{prog}}
cmd: {{assemble(source)}}

- tgt: distclean
cmd: -rm test.o
cmd: -rm {{prog}}

- dep: {{prog}}
tgt: m4
cmd: xfer {{CPCADDR}} -y {{prog}}
24 changes: 22 additions & 2 deletions cpclib-bndbuild/tests/jinja/test.asm
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
org 0x100
jp $
org 0x1000
run $
beginning
ld hl, data
loop
ld a, (hl)
or a : jp z, $
call 0xbb5a
inc hl
jp loop

data
db "HELLO WORLD FROM "
ifdef BASM
db "basm"
else
db "rasm"
endif
db 0

save "TEST", beginning, $-beginning, AMSDOS

0 comments on commit dbe2487

Please sign in to comment.