#!/bin/bash

BASE = /usr

default:
	@echo "You need so specify an action. Available actions:"
	@echo "clean"
	@echo "install"
	@echo "uninstall "
	@echo "tarball"
	@echo "update"
	@echo "check-dependencies"
	@echo "install-mediainfo"

clean:
	find . -name "*.pyc" -delete
	find . -name "*~"    -delete

root:
ifneq ($(shell whoami), root)
	@echo "\n**** ERROR: You must be root\n"
	@exit 1
endif

install: root
	mkdir -p $(BASE)/local/lib/python2.6/site-packages
	python setup.py install --prefix=$(BASE)/local
	rm -rf build
	rm -rf dist
	rm -rf WatchVideo.egg-info
	chmod +x ./utils/install-desktop-entry.sh
	./utils/install-desktop-entry.sh $(BASE)
    
uninstall: root
	rm -rf $(BASE)/local/lib/python2.6/dist-packages/WatchVideo*
	rm -f $(BASE)/local/bin/watchvideo_*
	rm -f $(BASE)/share/applications/watchvideo*
	rm -f $(BASE)/share/pixmaps/watchvideo*

tarball:
	python setup.py sdist
	mv dist/WatchVideo* .
	rm -rf dist
	rm -rf WatchVideo.egg-info

update:
	./src_ui/update

check-dependencies:
	@chmod +x ./utils/check-dependencies.sh
	@./utils/check-dependencies.sh
 
install-mediainfo:
	@chmod +x ./utils/install-mediainfo.sh
	@./utils/install-mediainfo.sh
	
	
