SYSTEM := $(shell uname -s)
CC := vc +aosppc
AS := ppc-amigaos-as
RM := rm -f

CFLAGS := -O3 -Iinclude -DALL_REACTION_CLASSES -DALL_REACTION_MACROS -D__USE_INLINE__ -DCATCOMP_NUMBERS
ASFLAGS := -mregnames
LINK := 
LIBS := -lraauto -lauto

TARGET := PlayCDDA
VERSION := 1
OBJS := locale.o playcdda_gui.o scsicmd.o diskchange.o \
	speedbar.o images.o amiupdate.o swab2.o

all: ../PlayCDDA/$(TARGET)

../PlayCDDA/$(TARGET): $(OBJS)
ifeq ($(SYSTEM),AmigaOS)
	$(CC) $(LINK) -o $(amigapath $@) $^ $(LIBS)
else
	$(CC) $(LINK) -o $@ $^ $(LIBS)
endif

playcdda_gui.o: $(TARGET)_rev.h
locale.o: include/locale.h include/catalog.h
locale.o: CFLAGS += -DCATCOMP_BLOCK
include/catalog.h: catalogs/playcdda.cd
ifeq ($(SYSTEM),AmigaOS)
	catcomp $< nocode cfile $@
else
	unixcat $< --cfile=$@
endif

clean:
	$(RM) $(OBJS)

revision:
	bumprev $(VERSION) $(TARGET)
