File: Makefile.debian

package info (click to toggle)
magicor 1.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 24,272 kB
  • ctags: 672
  • sloc: python: 6,332; makefile: 75
file content (103 lines) | stat: -rw-r--r-- 3,950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Installation build file for Magicor.
#
# Copyright 2006  Peter Gebauer. Licensed as Public Domain.
# (see LICENSE for more info)
#
# Valid targets:
#
# install			Install everything in specified paths.
# uninstall			Remove everything from specified paths. (use with care!)
# clean				Clean the build root from temporary files.
# dist				Create source and data tarballs.

# Do not change this unless you know what you're doing.
PYTHON_VERSION=$(shell python -c "import sys; print sys.version[:3]")
#PYTHON_VERSION=2.5

# The prefix is added as a prefix (duh) to all other paths as default.
PREFIX=$(DESTDIR)
# Where the magicor package will be installed, including final directory.
PYTHON_LIB=$(PREFIX)/usr/lib/python$(PYTHON_VERSION)/site-packages/magicor
# Where the executable scripts will be installed.
BIN_PATH=$(PREFIX)/usr/games
# Where the shared data will be stored.
SHARE_PATH=$(PREFIX)/usr/share/games/magicor
# Where to find the system-wide config file.
CONFIG=$(PREFIX)/etc
# Docbook XSL stylesheet to use
DOCBOOK_STYLESHEET=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl
# Options (string parameters) passed to the XSLT processor
#DOCBOOK_OPTIONS=--stringparam name value
# Docbook processing command
DOCBOOK_PROCESS=xsltproc -o $@ $(DOCBOOK_OPTIONS) $(DOCBOOK_STYLESHEET) $<

# For developers, change version with Magicor version number
VERSION=1.1

.PHONY: all
all:
	@echo "Environment:"
	@echo "Detected Python     $(PYTHON_VERSION)"
	@echo "Library path set to $(PYTHON_LIB)"
	@echo "Binary path set to  $(BIN_PATH)"
	@echo "Data path set to    $(SHARE_PATH)"
	@echo "Default config in   $(CONFIG)"
	@echo
	@echo "Docbook process (optional doc-target):"
	@echo $(DOCBOOK_PROCESS)
	@echo
	@echo "Valid targets: install, uninstall, clean, doc"
	@echo

.PHONY: install
install:
	@if [ -z "$(PYTHON_VERSION)" ]; then echo "Could not detect Python version, please edit the Makefile and set PYTHON_VERSION manually"; exit 1; fi
	mkdir -p $(PYTHON_LIB)
	cp -fr magicor/* $(PYTHON_LIB)
	mkdir -p $(BIN_PATH)
	cat Magicor.py | python scripts/replacer.py "###CONFIG_PATH###" /etc/magicor.conf > $(BIN_PATH)/magicor
	mkdir -p $(CONFIG)
	cat etc/magicor.conf | python scripts/replacer.py "###SHARE_PATH###" /usr/share/games/magicor > $(CONFIG)/magicor.conf
	cat Magicor-LevelEditor.py | python scripts/replacer.py "###CONFIG_PATH###" /etc/magicor-editor.conf > $(BIN_PATH)/magicor-editor
	cat etc/magicor-editor.conf | python scripts/replacer.py "###SHARE_PATH###" /usr/share/games/magicor > $(CONFIG)/magicor-editor.conf
	chmod a+x $(BIN_PATH)/magicor
	chmod a+x $(BIN_PATH)/magicor-editor
	mkdir -p $(SHARE_PATH)
	cp -fr data/* $(SHARE_PATH)
	@echo "Done. If everything wen't well you can now run '$(BIN_PATH)/magicor'"

.PHONY: uninstall
uninstall:
	rm -Rf $(PYTHON_LIB)
	rm -Rf $(SHARE_PATH)
	rm -f $(BIN_PATH)/magicor*

.PHONY: clean
clean:
	find . -name "*.pyc" | xargs rm -f
	find . -name "*.bak" | xargs rm -f
	find . -name "*~" | xargs rm -f
	rm -Rf dist
	rm -f magicor-*.tar.gz
	rm -f *.cdbs-config_list

.PHONY: dist
dist:
	rm -Rf dist/magicor-$(VERSION)
	mkdir -p dist/magicor-$(VERSION)
	rsync -Cavr --include=*.py magicor dist/magicor-$(VERSION)/
	rsync -Cavr --include=*.py scripts dist/magicor-$(VERSION)/
	cp -f *.py dist/magicor-$(VERSION)/
	rsync -Cavr etc dist/magicor-$(VERSION)/
	cp -f README INSTALL LICENSE COPYRIGHT Makefile dist/magicor-$(VERSION)/
	rsync -Cavr --exclude=levels data dist/magicor-$(VERSION)/
	rsync -Cav data/levels/*.lvl dist/magicor-$(VERSION)/data/levels/
	tar -cvzf magicor-$(VERSION).tar.gz -C dist magicor-$(VERSION)
	rsync -Cavr data/levels/* dist/magicor-$(VERSION)/data/levels/
	sync
	for f in $$(find dist/magicor-$(VERSION)/data/levels/  -maxdepth 1 -mindepth 1 -type d -printf "%f "); do tar -cvzf magicor-levels-$$f-$(VERSION).tar.gz -C dist/magicor-$(VERSION)/data/levels $$f; done
.PHONY: doc
doc: doc/manual.xhtml

mdoc/manual.xhtml: doc/manual.docbook
	$(DOCBOOK_PROCESS)