CROSS := ppc-amigaos
CC    := $(CROSS)-gcc
STRIP := $(CROSS)-strip
RM    := rm -f
CP    := cp -p --remove-destination

BINDIR := ../../release/xfdmaster/bin

CFLAGS     := -mcrt=clib2 -O2 -g -Wall -Werror -Wwrite-strings -Wno-multichar -Wno-deprecated-declarations -I../include
LDFLAGS    := -mcrt=clib2 -N -nostartfiles
LIBS       := 
STRIPFLAGS := -R.comment -KxfdForeMan

SLAVES := BZip2 CPic GZip MMCMP PacPic SZDD

.PHONY: all
all: $(SLAVES)

BZip2: BZip2.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

CPic: CPic.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

GZip: GZip.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

MMCMP: MMCMP.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

PacPic: PacPic.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

SZDD: SZDD.o
	$(CC) $(LDFLAGS) -o $@.debug $^ $(LIBS)
	$(STRIP) $(STRIPFLAGS) -o $@ $@.debug

.PHONY: clean
clean:
	$(RM) $(SLAVES) *.debug *.o

.PHONY: install
install: $(SLAVES)
	copy $(SLAVES) SYS:Libs/xfd

.PHONY: dist
dist: $(SLAVES)
	$(CP) $(SLAVES) $(BINDIR)/libs/xfd

