4 SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")
6 LOCALE_FILES=$(shell find $(LOCALE_PATH) -iname "*.mo")
7 PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
11 TEXT_DOMAIN=$(PROJECT_NAME)
12 POTFILES=$(wildcard src/quicknoteclasses/*.py)
14 UNIT_TEST=nosetests --with-doctest -w .
15 SYNTAX_TEST=support/test_syntax.py
16 STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
17 LINT_RC=./support/pylint.rc
18 LINT=pylint --rcfile=$(LINT_RC)
19 PROFILE_GEN=python -m cProfile -o .profile
20 PROFILE_VIEW=python -m pstats .profile
21 TODO_FINDER=support/todo.py
24 .PHONY: all run profile debug test lint tags todo clean distclean install update_po build_mo
32 $(PROFILE_GEN) $(PROGRAM)
36 $(DEBUGGER) $(PROGRAM)
41 package: clean $(OBJ) all
42 dpkg-buildpackage -rfakeroot
43 dpkg -i ../$(PROJECT_NAME)_$(PROJECT_VERSION)_all.deb
45 update_po: po/templates.pot
46 @for lang in $(basename $(notdir $(wildcard po/*.po))); do \
47 msgmerge -U --strict --no-wrap po/$$lang.po po/templates.pot; \
50 po/templates.pot: $(POTFILES)
51 xgettext --language=Python --strict --no-wrap --output=$@ $(POTFILES)
54 @for lang in $(basename $(notdir $(wildcard po/*.po))); do \
55 mkdir -p locale/$$lang/LC_MESSAGES; \
56 msgfmt --statistics -c -o locale/$$lang/LC_MESSAGES/$(TEXT_DOMAIN).mo po/$$lang.po; \
59 build: $(OBJ) build_mo
62 cp $(PROGRAM) $(BUILD_PATH)
63 cp src/constants.py $(BUILD_PATH)
64 $(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
65 $(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
66 $(foreach file, $(OBJ), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
67 $(foreach file, $(LOCALE_FILES), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
68 cp data/$(PROJECT_NAME).desktop $(BUILD_PATH)
69 cp data/$(PROJECT_NAME).service $(BUILD_PATH)
70 cp data/low/$(PROJECT_NAME).png $(BUILD_PATH)/26x26-$(PROJECT_NAME).png
71 cp data/40/$(PROJECT_NAME).png $(BUILD_PATH)/40x40-$(PROJECT_NAME).png
72 cp data/48/$(PROJECT_NAME).png $(BUILD_PATH)/48x48-$(PROJECT_NAME).png
73 cp data/scale/$(PROJECT_NAME).png $(BUILD_PATH)/scale-$(PROJECT_NAME).png
74 cp support/builddeb.py $(BUILD_PATH)
75 cp support/fake_py2deb.py $(BUILD_PATH)
78 $(foreach file, $(SOURCE), $(LINT) $(file) ; )
94 find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
95 find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
96 find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
97 find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f
100 mkdir -p $(dir $(TAG_FILE))
101 $(CTAGS) -o $(TAG_FILE) $(SOURCE)
103 $(TODO_FILE): $(SOURCE)
104 @- $(TODO_FINDER) $(SOURCE) > $(TODO_FILE)
110 #Target to print any variable, can be added to the dependencies of any other target
111 #Userfule flags for make, -d, -p, -n
112 print-%: ; @$(error $* is $($*) ($(value $*)) (from $(origin $*)))