Adding old-school presence so I can get presence support working in Empathy, wahooo
[theonering] / Makefile
1 PROJECT_NAME=theonering
2 SOURCE_PATH=src
3 SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")
4 PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
5 DATA_TYPES=*.ini *.map *.glade *.png
6 DATA=$(foreach type, $(DATA_TYPES), $(shell find $(SOURCE_PATH) -iname "$(type)"))
7 OBJ=$(SOURCE:.py=.pyc)
8 BUILD_PATH=./build
9 TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
10 TODO_FILE=./TODO
11
12 DEBUGGER=winpdb
13 UNIT_TEST=nosetests --with-doctest -w .
14 SYNTAX_TEST=support/test_syntax.py
15 STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
16 LINT_RC=./support/pylint.rc
17 LINT=pylint --rcfile=$(LINT_RC)
18 PROFILE_GEN=python -m cProfile -o .profile
19 PROFILE_VIEW=python -m pstats .profile
20 TODO_FINDER=support/todo.py
21 CTAGS=ctags-exuberant
22
23 .PHONY: all run profile debug test build lint tags todo clean distclean
24
25 all: test
26
27 run: $(OBJ)
28         $(SOURCE_PATH)/telepathy-theonering
29
30 profile: $(OBJ)
31         $(PROFILE_GEN) $(PROGRAM)
32         $(PROFILE_VIEW)
33
34 debug: $(OBJ)
35         $(DEBUGGER) $(PROGRAM)
36
37 test: $(OBJ)
38         $(UNIT_TEST)
39
40 package: $(OBJ)
41         rm -Rf $(BUILD_PATH)
42
43         mkdir -p $(BUILD_PATH)/generic
44         cp $(SOURCE_PATH)/constants.py  $(BUILD_PATH)/generic
45         $(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/generic/$(subst /,-,$(file)) ; )
46         $(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/generic/$(subst /,-,$(file)) ; )
47         cp support/$(PROJECT_NAME).manager $(BUILD_PATH)/generic
48         cp support/$(PROJECT_NAME).profile $(BUILD_PATH)/generic
49         cp support/org.freedesktop.Telepathy.ConnectionManager.$(PROJECT_NAME).service $(BUILD_PATH)/generic
50         cp support/icons/*-$(PROJECT_NAME).png $(BUILD_PATH)/generic/
51         cp support/builddeb.py $(BUILD_PATH)/generic
52         cp support/py2deb.py $(BUILD_PATH)/generic
53         cp support/fake_py2deb.py $(BUILD_PATH)/generic
54
55         mkdir -p $(BUILD_PATH)/chinook
56         cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/chinook
57         cd $(BUILD_PATH)/chinook ; python builddeb.py chinook
58         mkdir -p $(BUILD_PATH)/diablo
59         cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/diablo
60         cd $(BUILD_PATH)/diablo ; python builddeb.py diablo
61         mkdir -p $(BUILD_PATH)/fremantle
62         cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/fremantle
63         cd $(BUILD_PATH)/fremantle ; python builddeb.py fremantle
64         mkdir -p $(BUILD_PATH)/mer
65         cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/mer
66         cd $(BUILD_PATH)/mer ; python builddeb.py mer
67         mkdir -p $(BUILD_PATH)/debian
68         cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/debian
69         cd $(BUILD_PATH)/debian ; python builddeb.py debian
70
71 upload: package
72         dput fremantle-extras-builder $(BUILD_PATH)/fremantle/$(PROJECT_NAME)*.changes
73         dput diablo-extras-builder $(BUILD_PATH)/diablo/$(PROJECT_NAME)*.changes
74         dput chinook-extras-builder $(BUILD_PATH)/chinook/$(PROJECT_NAME)*.changes
75         cp $(BUILD_PATH)/debian/*.deb www/$(PROJECT_NAME).deb
76
77 lint: $(OBJ)
78         $(foreach file, $(SOURCE), $(LINT) $(file) ; )
79
80 tags: $(TAG_FILE) 
81
82 todo: $(TODO_FILE)
83
84 clean:
85         rm -Rf $(OBJ)
86         rm -Rf $(BUILD_PATH)
87         rm -Rf $(TODO_FILE)
88
89 distclean:
90         rm -Rf $(OBJ)
91         rm -Rf $(BUILD_PATH)
92         rm -Rf $(TAG_FILE)
93         find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
94         find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
95         find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
96         find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f
97
98 $(TAG_FILE): $(OBJ)
99         mkdir -p $(dir $(TAG_FILE))
100         $(CTAGS) -o $(TAG_FILE) $(SOURCE)
101
102 $(TODO_FILE): $(SOURCE)
103         @- $(TODO_FINDER) $(SOURCE) > $(TODO_FILE)
104
105 %.pyc: %.py
106         $(SYNTAX_TEST) $<
107
108 #Makefile Debugging
109 #Target to print any variable, can be added to the dependencies of any other target
110 #Userfule flags for make, -d, -p, -n
111 print-%: ; @$(error $* is $($*) ($(value $*)) (from $(origin $*)))