ifeq ($(BUILDFOR),erla)
include ../Config.mk

CFLAGS = $(FW_CFLAGS_3RDPARTY) -g
LDFLAGS = $(FW_LDFLAGS_3RDPARTY)
else
CFLAGS = -g -Wall
LDFLAGS = -g
endif

TARGETS=cellsplit lrle_engine rle_greycomp rle_reduce \
	rle_runaccum rle_format rle_decode downsample down2bmp
OBJECTS=cellsplit.o lrle_engine.o rle_greycomp.o rle_reduce.o \
	rle_runaccum.o rle_format.o rle_decode.o downsample.o down2bmp.o

all: $(TARGETS)

$(OBJECTS): %.o: %.c
	$(CC) -Wall -c $(CFLAGS) $< -o $@

clean:
	rm -f $(TARGETS) *.o

cellsplit: cellsplit.o rle_util.o

lrle_engine: lrle_engine.o rle_util.o

rle_greycomp: rle_greycomp.o rle_util.o

rle_reduce: rle_reduce.o rle_util.o

rle_runaccum: rle_runaccum.o rle_util.o

rle_format: rle_format.o rle_util.o

downsample: downsample.o rle_util.o

down2bmp: down2bmp.o rle_util.o

$(OBJECTS): bmp.h rle_util.h

ifeq ($(BUILDFOR),erla)
install: all
	$(INSTALL) -d $(DESTDIR)/bin.debug
	$(INSTALL) -m 755 $(TARGETS) $(DESTDIR)/bin.debug/
endif
