1# Griffith makefile
2#
3# (c) 2005-2009 Vasco Nunes, Piotr Ozarowski
4#
5# $Id$
6
7PACKAGE=griffith
8LANGUAGES=$(shell cd i18n/&&ls -d *)
9VERSION=$(shell grep "^pversion" lib/version.py | cut -d \'  -f 2)
10TEMPLATES= $(shell cd export_templates >/dev/null; $(FIND) . -maxdepth 1 -mindepth 1 -type d -name "[^\.svn]*" -print)
11
12.PHONY: help clean install
13
14INSTALL ?= install
15MAKE ?= make
16RM ?= rm
17MSGFMT ?= msgfmt
18MSGMERGE ?= msgmerge
19XGETTEXT ?= xgettext
20FIND ?= find
21DOC2MAN ?= docbook2x-man
22
23PREFIX = $(DESTDIR)/usr/local
24BINDIR = $(PREFIX)/bin
25ETCDIR = $(PREFIX)/etc
26DATADIR = $(PREFIX)/share/griffith
27LIBDIR = $(DATADIR)/lib
28IMAGESDIR = $(DATADIR)/images
29GLADEDIR = $(DATADIR)/glade
30PLUGINSDIR = $(LIBDIR)/plugins
31MOVIEPLUGINSDIR = $(PLUGINSDIR)/movie
32EXPORTPLUGINSDIR = $(PLUGINSDIR)/export
33IMPORTPLUGINSDIR = $(PLUGINSDIR)/imp
34EXTENSIONSPLUGINSDIR = $(PLUGINSDIR)/extensions
35TPLDIR = $(DATADIR)/export_templates
36APPLICATIONSDIR = $(PREFIX)/share/applications
37ICONDIR = $(PREFIX)/share/pixmaps
38LOCALEDIR = $(PREFIX)/share/locale
39BASHCOMPDIR = $(ETCDIR)/bash_completion.d
40
41help:
42	@echo Usage:
43	@echo "make		- not used"
44	@echo "make clean	- delete built modules and object files"
45	@echo "make install	- install binaries into the official directories"
46	@echo "make uninstall	- uninstall binaries from the official directories"
47	@echo "make help	- prints this help"
48	@echo "make dist	- makes a distribution tarball"
49	@echo
50
51
52install:
53	@echo
54	@echo "installing Griffith"
55	@echo "^^^^^^^^^^^^^^^^^^^"
56	$(INSTALL) -m 755 -d $(BINDIR) $(DATADIR) $(LIBDIR) $(LIBDIR)/db \
57		$(PLUGINSDIR) $(MOVIEPLUGINSDIR) $(EXPORTPLUGINSDIR) $(IMPORTPLUGINSDIR) $(EXTENSIONSPLUGINSDIR) \
58		$(FONTSDIR) $(APPLICATIONSDIR) $(ICONDIR) $(TPLDIR) \
59		$(IMAGESDIR) $(GLADEDIR) $(ETCDIR) $(BASHCOMPDIR)
60	$(INSTALL) -m 755 griffith $(LIBDIR)
61	$(INSTALL) -m 644 lib/*.py $(LIBDIR)
62	$(INSTALL) -m 644 lib/db/*.py $(LIBDIR)/db/
63	$(INSTALL) -m 644 lib/plugins/*.py $(PLUGINSDIR)
64	$(INSTALL) -m 644 lib/plugins/movie/*.py $(MOVIEPLUGINSDIR)
65	$(INSTALL) -m 644 lib/plugins/export/*.py $(EXPORTPLUGINSDIR)
66	$(INSTALL) -m 644 lib/plugins/imp/*.py $(IMPORTPLUGINSDIR)
67	$(INSTALL) -m 644 lib/plugins/extensions/*.py $(EXTENSIONSPLUGINSDIR)
68	$(INSTALL) -m 644 glade/*.ui $(GLADEDIR)
69	$(INSTALL) -m 644 glade/*.png $(GLADEDIR)
70	$(INSTALL) -m 644 images/*.png $(IMAGESDIR)
71	$(INSTALL) -m 644 images/griffith.png $(ICONDIR)
72	$(INSTALL) -m 644 images/griffith.xpm $(ICONDIR)
73	$(INSTALL) -m 644 data/griffith.desktop $(APPLICATIONSDIR)
74	$(INSTALL) -m 644 data/bash_completion $(BASHCOMPDIR)/griffith
75
76	# installing language files
77	for lang in $(LANGUAGES); do \
78		${INSTALL} -m 755 -d $(LOCALEDIR)/$$lang/LC_MESSAGES; \
79		$(INSTALL) -m 644 i18n/$$lang/LC_MESSAGES/*.mo $(LOCALEDIR)/$$lang/LC_MESSAGES; \
80	done
81
82	# installing export templates:
83	for dir in $(TEMPLATES); do \
84		${INSTALL} -m 755 -d  ${TPLDIR}/$$dir; \
85		${FIND} export_templates/$$dir -maxdepth 1 -type f \
86			-exec ${INSTALL} -m 644 '{}' ${TPLDIR}/$$dir \;; \
87	done
88
89	if test -f $(PREFIX)/bin/griffith; then ${RM} $(PREFIX)/bin/griffith; fi
90
91	$(MAKE) -C docs install
92
93uninstall:
94	@echo
95	@echo "uninstalling Griffith"
96	@echo "^^^^^^^^^^^^^^^^^^^^^"
97	${RM} -r $(TPLDIR)
98	${RM} -r $(MOVIEPLUGINSDIR)
99	${RM} -r $(EXPORTPLUGINSDIR)
100	${RM} -r $(IMPORTPLUGINSDIR)
101	${RM} -r $(EXTENSIONSPLUGINSDIR)
102	${RM} -r $(PLUGINSDIR)
103	${RM} -r $(LIBDIR)
104	${RM} -r $(IMAGESDIR)
105	${RM} -r $(GLADEDIR)
106	${RM} -r $(DATADIR)
107	${RM} -r $(ICONDIR)/griffith.png
108	${RM} -r $(ICONDIR)/griffith.xpm
109	${RM} -r $(APPLICATIONSDIR)/griffith.desktop
110	for lang in $(LANGUAGES); do \
111		${RM} -r $(LOCALEDIR)/$$lang/LC_MESSAGES/griffith.mo; \
112	done
113	${RM} -r $(BINDIR)/griffith
114	${RM} -r $(BASHCOMPDIR)/griffith
115	$(MAKE) -C docs uninstall
116
117clean:
118	${FIND} . \( -iname '*\.py[co]' -or -iname '*~' -or -iname '*\.bak' \) -exec ${RM} '{}' \;
119
120dist: clean
121	@tar --exclude=*.svn* --exclude=*.tar* --exclude=debian -cf griffith.tar ./
122	@mkdir $(PACKAGE)-$(VERSION)
123	@tar -xf griffith.tar -C $(PACKAGE)-$(VERSION)
124	@${RM} griffith.tar
125	@tar -czf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) && echo File ./$(PACKAGE)-$(VERSION).tar.gz generated successfully
126	@${RM} -r $(PACKAGE)-$(VERSION)
127
128