.SUFFIXES: .mlz .scr .pt3 .out .zsm .tap .bas
# Generic makefile for ZX stuff, built with SjASMPlus


## define the name of the main sourcefile,
## the code address of it
## and the resulting tapefile.

TAPNAME=tapefile
SOURCE=sourcefile
CODEADD=32768

LOADER=loader


ZSM=sjasmplus
INC=--inc=\zx\source\_routines
COMPRESS=megalz
DECOMP=\zx\source\_routines\depack.zh

$(TAPNAME):	$(TAPNAME).tap

$(TAPNAME).tap:	$(LOADER).tap $(SOURCE).tap
	copy /b $(LOADER).tap+$(SOURCE).tap $(TAPNAME).tap



## Additional rules can go in here
## but they're not really needed :)








## Rule to build BASIC running at LINE0
.bas.tap:
	bas2tap -c -a0 -s$* $? $@

## Rule to compress a screen$
.scr.mlz:
	$(COMPRESS) $? $@

## Rule to compress a PT3 Song
.pt3.mlz:
	$(COMPRESS) $? $@

## Rule to build a ZX Spectrum source file
.zsm.out:
	$(ZSM) $(INC) --nologo --lst=$*.lst --sym=$*.sym --exp=$*.exp --raw=$@ $*.zsm

.out.tap:
	bintap $? $@ $*.c $(CODEADD)

clean:
	-del $(TAPNAME).tap $(LOADER).tap $(SOURCE).tap *.mlz *.out *.lst *.sym *.exp 
