ALLEGRO_DAT = dat
BACK_IMAGE_NAME = lw5back
BACK_IMAGE_EXT = pcx
BACK_IMAGE_FILE = $(BACK_IMAGE_NAME).$(BACK_IMAGE_EXT)
BACK_IMAGE_CONVERTED = $(BACK_IMAGE_NAME).converted.$(BACK_IMAGE_EXT)
PALETTE = palette.pcx

all: back.dat

back.dat: $(BACK_IMAGE_CONVERTED) $(PALETTE)
	@rm -f $@
	@echo Creating $@
	@$(ALLEGRO_DAT) -a -t bmp $@ $(BACK_IMAGE_CONVERTED)
	@$(ALLEGRO_DAT) -a -t pal $@ $(PALETTE)

clean:
	@rm -f $(BACK_IMAGE_CONVERTED) $(PALETTE) *dat

distclean:
	@rm -f Makefile

$(BACK_IMAGE_CONVERTED): $(BACK_IMAGE_FILE)
	@echo Converting $< to $@
	@cp $< $@
	@../../utils/liquidwarcol -s 0 46 $@

$(PALETTE): $(BACK_IMAGE_CONVERTED)
	@cp $< $@

