# You can define in which directory cmp3 initializes. Just set INIT_DIR
# to where ever you keep your mp3's. If you don't have just one directory, 
# perhaps "." would be a good choice. (This will start off at whatever 
# directory you are currently in)
# The importance of setting MPG123_LOC correctly cannot be understated.
# Additional parameters to mpg123 can be sent from here by setting 
# EXEC_PARAMS correctly. A downsample and mono line is given.

# MUST set these correctly!
INIT_DIR="/mp3"
MPG123_LOC="/usr/bin/mpg123"
INSTALL_DIR= "/usr/local/bin"

## Define this if you want downsampleing and mono output (usually for 486's)
#EXEC_PARAMS= -DEXEC_PARAMS="\"-2\",\"-m\""
## Define this for bufferring
EXEC_PARAMS= -DEXEC_PARAMS="\"-b\",\"1024\""
## Define this to have an ass playlist repository in an existing directory
ASSREPOSITORY= -DASS_LOC="\"/usr/local/lib/cmp3\""

# Please don't change these if you want it to work properly
VERSION= "1.5"
PARAMS= -DEXEC_LOC="\$(MPG123_LOC)\" $(EXEC_PARAMS) 
LIBS= -lncurses #-lgpm
OPTS= 
OBJS= playfunc.o player.o manager.o listmanip.o
CC= gcc

all: cmp3
	@echo -e "\n\nCmp3 is ready! Please read the README before proceeding.\n"

force:  clean cmp3

clean: 
	rm -f *.o *~ DEADJOE core cmp3

cmp3: $(OBJS)
	$(CC) $(OPTS) $(OBJS) $(LIBS) -o cmp3

playfunc.o: common.h player.h playfunc.c
	$(CC) $(OPTS) -c playfunc.c

player.o: common.h player.h player.c
	$(CC) $(OPTS) -DSTART_DIR="\$(INIT_DIR)\" $(ASSREPOSITORY) -c player.c

manager.o: manager.h common.h manager.c
	$(CC) $(OPTS) $(PARAMS) -c manager.c
	
listmanip.o: common.h player.h listmanip.c
	$(CC) $(OPTS) $(ASSREPOSITORY) -c listmanip.c

tar: cmp3 clean
	cd ..; tar zcf cmp3-$(VERSION).tar.gz cmp3-$(VERSION)/;

install: cmp3
	install -c -s cmp3 $(INSTALL_DIR)/cmp3
