1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 10:37:58 +03:00
mal/basic/Makefile
Joel Martin 115e430d02 Basic: QBasic fixes/enabling. Recursive includes.
Enable QBasic console mode usage and fix bugs in newline handling
differences with C64 basic (cbm). To enable console mode for QBasic
programs, have basicpp.py prefix the output with the QB64 specific
console activation variables/functions.

One change to basicpp.py to make this change more straightfowards is
recursive includes so that includes can appear in more than just the
top level step files. This allows us to conditionally include the
right readline implementation. For QBasic in the special console mode
(instead of the default full-screen UI mode) we need to use the LINE
INPUT command in order to read input.
2017-09-14 23:50:15 -05:00

75 lines
1.9 KiB
Makefile

basic_MODE = cbm
BASICPP_OPTS = --mode $(basic_MODE)
QB64 = qb64
STEPS4_A = step4_if_fn_do.bas step5_tco.bas step6_file.bas \
step7_quote.bas step8_macros.bas step9_try.bas stepA_mal.bas
STEPS3_A = step3_env.bas $(STEPS4_A)
STEPS1_A = step1_read_print.bas step2_eval.bas $(STEPS3_A)
STEPS0_A = step0_repl.bas $(STEPS1_A)
$(STEPS0_A): readline.in.bas readline_line.in.bas readline_char.in.bas
$(STEPS1_A): debug.in.bas mem.in.bas types.in.bas reader.in.bas printer.in.bas
$(STEPS3_A): env.in.bas
$(STEPS4_A): core.in.bas
all: $(STEPS0_A)
step%.bas: step%.in.bas
./basicpp.py $(BASICPP_OPTS) $< > $@
tests/%.bas: tests/%.in.bas
./basicpp.py $(BASICPP_OPTS) $< > $@
# QBasic specific compilation rule
step%: step%.bas
$(QB64) -x $(abspath $<) -o $(abspath $@)
# CBM/C64 image rules
%.prg: %.bas
cat $< | tr "A-Z" "a-z" > $<.tmp
#cat $< | sed 's/["]\@<!\<\w\+\>["]\@!/\L&/g' > $<.tmp
petcat -w2 -nc -o $@ $<.tmp
#rm $<.tmp
mal.prg: stepA_mal.prg
cp $< $@
.args.mal.prg: .args.mal
petcat -text -w2 -o $@ $<
core.mal.prg: ../core.mal
petcat -text -w2 -o $@ $<
mal.d64: mal.prg .args.mal.prg core.mal.prg
c1541 -format "mal,01" d64 $@ \
-attach $@ \
-write $< mal \
-write .args.mal.prg .args.mal \
-write core.mal.prg core.mal
# Clean and Stats rules
.PHONY: clean stats
clean:
rm -f $(STEPS0_A) $(subst .bas,,$(STEPS0_A)) *.d64 *.prg qb64
rm -rf ./internal
SOURCES_LISP = env.in.bas core.in.bas stepA_mal.in.bas
SOURCES = readline.in.bas readline_line.in.bas readline_char.in.bas \
types.in.bas reader.in.bas printer.in.bas $(SOURCES_LISP)
stats: $(SOURCES)
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*#|^[[:space:]]*REM |^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
stats-lisp: $(SOURCES_LISP)
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*#|^[[:space:]]*REM |^[[:space:]]*$$" $^ | wc` "[comments/blanks]"