.SILENT:

all: dir player about mpg123 extract frame mp3 text kill path done

dir:
	echo "Creating Directory"
	mkdir -p "$$HOME/bin/linplayer"
player: player.c
	echo "Making player!"
	cc player.c -lcurses -o $$HOME/bin/linplayer/player.rpl
about: about.c string_dlist.h
	echo "Preparing about player!"
	cc about.c -lcurses -lpthread -o $$HOME/bin/linplayer/about.rpl
mpg123: mpg123.rpl
	echo "Copying required files"
	cp mpg123.rpl $$HOME/bin/linplayer/
	chmod 711 $$HOME/bin/linplayer/mpg123.rpl
extract: rlxtract
	cp rlxtract $$HOME/bin/linplayer/
	chmod 711 $$HOME/bin/linplayer/rlxtract
frame: rlframe
	cp rlframe $$HOME/bin/linplayer/
	chmod 711 $$HOME/bin/linplayer/rlframe
kill: killer
	cp killer $$HOME/bin/linplayer/
	chmod 711 $$HOME/bin/linplayer/killer
mp3: mp3.txt
	(echo "player_dir=$$HOME/bin/linplayer"; cat mp3.txt) > $$HOME/bin/linplayer/mp3
	chmod 711 $$HOME/bin/linplayer/mp3
text: about.txt
	cp about.txt $$HOME/bin/linplayer/
path:
	echo "Updating ~/.bashrc to set the PATH variable"
	echo 'PATH=$$HOME/bin/linplayer:$$PATH' >> $$HOME/.bashrc
done:
	echo "Finished Installation Succesfully!"

uninstall:
	echo "Uninstalling the Lin-Player !"
	/bin/rm -r $$HOME/bin/linplayer
