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

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

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

UTILS := xfdDecrunch xfdLibInfo xfdList xfdScan xfdUnlink

.PHONY: all
all: $(UTILS)

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

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

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

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

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

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

.PHONY: install
install: $(UTILS)
	copy $(UTILS) SYS:C

.PHONY: dist
dist: $(UTILS)
	$(CP) $(UTILS) $(BINDIR)/c

