
# Makefile for Atari 8-bit binary load files

# Don't edit this file unless you find a bug in it. Configuration for
# your setup should be done in "config.mak"

# See BUILD.txt for instructions.

include config.mak

all: $(BIN)

# fancy ctags invocation: doesn't produce any errors or warnings if
# ctags isn't installed.
$(BIN): $(PROJ).$(DASM_EXT) equates.inc
	@ctags --language-force=asm -h.inc $(PROJ).$(DASM_EXT) equates.inc \
								  2>/dev/null || true
	dasm $(PROJ).$(DASM_EXT) -o$(BIN) -l$(PROJ).list -s$(PROJ).syms -f3 -v1

ifeq ($(HAVE_SIO2PC), yes)
TEST_CMD=$(SIO2PC_CMD)
else
TEST_CMD=$(EMU_CMD)
endif

ifeq ($(HAVE_AXE), yes)
disk: all
	axe -w $(BIN) $(PROJ).atr

# Can't do anything fancy for binload: it uses both stdout and stderr
# for its output, so I can't redirect to /dev/null. If the user doesn't
# have binload, he'll see an error message, but the build won't fail.
test: disk
	@binload $(BIN) || true
	$(TEST_CMD) $(PROJ).atr
else
test: all
	@binload $(BIN) || true
	$(TEST_CMD) $(BIN)
endif
