###############################################################################
# Makefile for BUM
# Copyright: (C) 2005 Fabio Marzocca <thesaltydog@gmail.com>
#
###############################################################################
.PHONY: all install  clean

# System programs
TEST = /usr/bin/test
MSGFMT = /usr/bin/msgfmt

# Where to install stuff
PREFIX = $(DESTDIR)/usr
BINDIR = $(PREFIX)/bin
PIXDIR = $(PREFIX)/share/pixmaps/bum
LIBDIR = $(PREFIX)/share/bum
MANDIR = $(PREFIX)/share/man/man8
APPSDIR = $(PREFIX)/share/applications

LOCDIR = $(PREFIX)/share/locale
# .po files
PO_LIST = de it fr es nl ru mk tr

# Rules

all:
	/bin/echo "No compilation needed......"


install: 
	$(TEST) -d $(BINDIR) || install -d $(BINDIR) ;
	install -m 0755  bum $(BINDIR)/bum
	$(TEST) -d $(PIXDIR) || install -d $(PIXDIR) ;
	cp -Rp pixmaps/* $(PIXDIR)/
	$(TEST) -d $(LIBDIR) || install -d $(LIBDIR) ;
	cp *.pm $(LIBDIR)/
	$(TEST) -d $(MANDIR) || install -d $(MANDIR) ;
	pod2man -s 8 bum	| gzip -9c > bum.8.gz
	install -m 0644 bum.8.gz $(MANDIR)/bum.8.gz
	$(TEST) -d $(APPSDIR) || install -d $(APPSDIR) ;
	install -m 0644 bum.desktop $(APPSDIR)/bum.desktop
	
	#LOCALIZATION
	$(TEST) -x $(MSGFMT) || $(ECHO) "msgfmt required to install BUM" && exit
	@for lang_po in $(PO_LIST); do \
		$(TEST) -d $(LOCDIR)/$$lang_po/LC_MESSAGES || install -d $(LOCDIR)/$$lang_po/LC_MESSAGES ; \
		$(MSGFMT)  -o po/$$lang_po.mo po/bum.$$lang_po.po; \
		install -m 0644 po/$$lang_po.mo $(LOCDIR)/$$lang_po/LC_MESSAGES/bum.mo ; \
	done

clean: 
	rm -f bum.8.gz
	rm -f po/*.mo
	rm -f *~


