# YouGrabber
#
# A lightweight, command line YouTube.com video downloader, made from scratch
# in ANSI C.
#
# Copyright (C) 2006-2008 Quetzy Garcia, <quetzyg@users.sourceforge.net>
# For news and updates, see <http://yougrabber.sourceforge.net/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

CC = gcc
OUT = yg
MAN = $(OUT).1
CFG = $(OUT).conf.example

PREFIX = /usr
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/man/man1
DOCDIR = $(PREFIX)/share/doc

CFLAGS = -g -W -Wall -O2 -ansi `pkg-config --cflags glib-2.0` \
         `curl-config --cflags`

LIBS = -lm -lpthread -lncurses `pkg-config --libs glib-2.0` \
       `curl-config --libs`

OBJECTS = common.o config.o download.o interface.o main.o

$(OUT) : $(OBJECTS)
	$(CC) $(CFLAGS) $(OBJECTS) -o $(OUT) $(LIBS)

	@echo -e "\nBuild complete!"
	@echo -e "\nNow as root type: 'make install'\n"

clean :
	rm -rf *.o
	rm -rf $(OUT)

install :
	install -D -c -m 755 $(OUT) $(BINDIR)/$(OUT)
	install -D -c -m 644 ../man/$(MAN) $(MANDIR)/$(MAN)
	install -D -c -m 644 ../$(CFG) $(DOCDIR)/yougrabber/$(CFG)

	@echo -e "\nInstall complete!"
	@echo -e "\nTo run the program type '$(OUT)'\n"

uninstall :
	rm -rf $(BINDIR)/$(OUT)
	rm -rf $(MANDIR)/$(MAN)
	rm -rf $(DOCDIR)/$(OUT)

.PHONY : clean

.PHONY : install

.PHONY : uninstall

