PREFIX = /usr/local
CFLAGS = `get-wings-flags --cflags` `libcdaudio-config --cflags`
LDFLAGS = `get-wings-flags --ldflags` `libcdaudio-config --ldadd`
LIBS = `get-wings-flags --libs` `libcdaudio-config --libs`
CC = gcc -O2

all: CDPlayer

CDPlayer: cdplayer.o
	$(CC) -o CDPlayer cdplayer.o $(LIBS) $(LDFLAGS) -lWMaker
	strip CDPlayer

hacked: hacked.o
	$(CC) -o CDPlayer hacked.o $(LIBS) $(LDFLAGS) -lWMaker
	strip CDPlayer

cdplayer.o: cdplayer.c
	$(CC) -c cdplayer.c -o cdplayer.o $(CFLAGS)

hacked.o: cdplayer.c
	$(CC) -c cdplayer.c -o hacked.o $(CFLAGS) -DSHUFFLE_REPEAT_HACK

install:
	mkdir -p $(PREFIX)/GNUstep/Apps/CDPlayer.app
	install -c CDPlayer $(PREFIX)/GNUstep/Apps/CDPlayer.app/CDPlayer

uninstall:
	rm -rf $(PREFIX)/GNUstep/Apps/CDPlayer.app

clean:
	rm -rf *.o CDPlayer
