# This makefile is used for "sqeezing" the components of the "MoosicApplet" program
# into a single file.
# 
# This makefile is also used for converting the POD documents for GMoosic into
# the manpage format. This requires GNU make, the install utility program, and
# the pod2man utility (the latter is generally included with Perl).

# Note that you will have to edit GNOME_MoosicApplet.server if you install
# MoosicApplet in a directory not in your PATH.
# In <oaf_server iid="OAFIID:GNOME_MoosicApplet_Factory" ... >
# specify the full path as the value for 'location'

# If the INSTALL_PREFIX is different from the Gnome installation prefix,
# add $(INSTALL_PREFIX)/lib/bonobo/servers to your BONOBO_ACTIVATION_PATH
# 
# To make the applet visible without BONOBO_ACTIVATION_PATH changes, see:
# http://mail.gnome.org/archives/desktop-devel-list/2003-January/msg00307.html

INSTALL_PREFIX = /usr

VERSION = 0.0.1
PROGRAMS = MoosicApplet

.PHONY: all
all: ${PROGRAMS}
	-

PY = applet.py applet_ui.py applet_config.py moosic_factory.py icons.py

MoosicApplet: $(PY) prefs-window.glade
	python squeezeTool -1 -o $@ -b applet $(PY) -d prefs-window.glade
	mv -f $@.py $@
	chmod 755 $@

.PHONY: dist
dist:
	python setup.py sdist --formats=gztar

.PHONY: clean
clean:
	rm -rf *~ *.pyc *.bak

.PHONY: manpages
manpages: $(PROGRAMS:=.1)
	-

%.1: %.pod
	pod2man --section 1 --release "GTK Moosic ${VERSION}" --center "" $< $@

.PHONY: install
install: all
	install -d $(INSTALL_PREFIX)
	install -d $(INSTALL_PREFIX)/bin
	install -m 755 $(PROGRAMS) $(INSTALL_PREFIX)/bin/
	install -d $(INSTALL_PREFIX)/lib
	install -d $(INSTALL_PREFIX)/lib/bonobo
	install -d $(INSTALL_PREFIX)/lib/bonobo/servers
	install -m 644 GNOME_MoosicApplet.server $(INSTALL_PREFIX)/lib/bonobo/servers/
