Bump to 1.1.3
[gonvert] / Makefile
old mode 100755 (executable)
new mode 100644 (file)
index 1b02a5e..a4c08c6
--- a/Makefile
+++ b/Makefile
-NAME=gonvert
-
-#Get version number from source file
-VERSION=$(shell head -3 $(NAME) | grep version | cut -d\" -f2)
-
-#DESTDIR can be defined when calling make ie. make install DESTDIR=$RPM_BUILD_ROOT
-prefix  = /usr/local
-bindir  = $(prefix)/bin
-datadir = $(prefix)/share
-docdir  = $(datadir)/doc
-
-DESTDIR =
-
-all:
-
-install:
-       install -D -m0755 gonvert $(DESTDIR)$(bindir)/gonvert
-       install -D -m0644 gonvert.glade $(DESTDIR)$(datadir)/gonvert/gonvert.glade
-       install -d -m0755 $(DESTDIR)$(datadir)/pixmaps/
-       install -m0644 pixmaps/*.png $(DESTDIR)$(datadir)/pixmaps/
-       install -D -m0644 gonvert.desktop $(DESTDIR)$(datadir)/gnome/apps/Utilities/gonvert.desktop
-       install -d -m0755 $(DESTDIR)$(docdir)/gonvert/
-       install -m0644 doc/* $(DESTDIR)$(docdir)/gonvert/
-
-install_pl:
-       install -D -m0755 gonvert $(DESTDIR)$(bindir)/gonvert
-       install -D -m0644 gonvert.glade $(DESTDIR)$(datadir)/gonvert/gonvert.glade
-       install -d -m0755 $(DESTDIR)$(datadir)/pixmaps/
-       install -m0644 pixmaps/*.png $(DESTDIR)$(datadir)/pixmaps/
-       install -D -m0644 gonvert.desktop $(DESTDIR)$(datadir)/gnome/apps/Utilities/gonvert.desktop
-       install -d -m0755 $(DESTDIR)$(docdir)/gonvert/
-       install -m0644 doc/* $(DESTDIR)$(docdir)/gonvert/
-       install -m0644 i18n/pl_messages.gmo /usr/share/locale/pl/LC_MESSAGES/gonvert.mo
-
-uninstall:
-       #specify project name manually to prevent removal of all directories
-       rm -f  $(bindir)/gonvert
-       rm -rf $(datadir)/gonvert*
-       rm -rf $(docdir)/gonvert*
-       rm -f /usr/share/gnome/apps/Utilities/$(NAME).desktop
-       rm -f /usr/share/pixmaps/$(NAME).png
-
-uninstall_pl:
-       #specify project name manually to prevent removal of all directories
-       rm -f  $(bindir)/gonvert
-       rm -rf $(datadir)/gonvert*
-       rm -rf $(docdir)/gonvert*
-       rm -f /usr/share/gnome/apps/Utilities/$(NAME).desktop
-       rm -f /usr/share/pixmaps/$(NAME).png
-       rm -f /usr/share/locale/pl/LC_MESSAGES/gonvert.mo
-
-dist:
-       if test -d "$(NAME)-$(VERSION)"; then rm -rf $(NAME)-$(VERSION); fi
-       if test -f "$(NAME)-$(VERSION).tar.gz"; then rm -f $(NAME)-$(VERSION).tar.gz; fi
-       mkdir $(NAME)-$(VERSION)
-       cp Makefile $(NAME)-$(VERSION)
-       cp messages.pot $(NAME)-$(VERSION)
-       cp -R i18n $(NAME)-$(VERSION)
-       cp -R doc $(NAME)-$(VERSION)
-       cp $(NAME) $(NAME)-$(VERSION)
-       cp $(NAME).glade $(NAME)-$(VERSION)
-       cp $(NAME).spec $(NAME)-$(VERSION)
-       cp $(NAME).desktop $(NAME)-$(VERSION)
-       cp -R pixmaps $(NAME)-$(VERSION)
-       tar cvzf $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
-       rm -rf $(NAME)-$(VERSION)
-
-rpm:
-       #You will most likely have to be root for this to work
-       sed '/Version/s/replaceme/$(VERSION)/' gonvert.spec.skel > gonvert.spec
-       cp $(NAME).spec /usr/src/redhat/SPECS/$(NAME).spec
-       cp $(NAME)-$(VERSION).tar.gz /usr/src/redhat/SOURCES
-       rpmbuild -ba /usr/src/redhat/SPECS/gonvert.spec
-       cp /usr/src/redhat/RPMS/noarch/gonvert-$(VERSION)*.rpm ~anthony/web/unihedron/projects/gonvert/downloads
-
-pub:
-       #For authors use only
-       if test -f "$(NAME)"; then cp $(NAME)  ~/web/unihedron/projects/gonvert/downloads/$(NAME).pyw; fi
-       if test -f "$(NAME).glade"; then cp $(NAME).glade  ~/web/unihedron/projects/gonvert/downloads; fi
-       if test -f "$(NAME)-$(VERSION).tar.gz"; then mv -f $(NAME)-$(VERSION).tar.gz  ~/web/unihedron/projects/gonvert/downloads; fi
-       if test -f "doc/CHANGELOG"; then cp -f doc/CHANGELOG  ~/web/unihedron/projects/gonvert/CHANGELOG; fi
+PROJECT_NAME=gonvert
+SOURCE_PATH=src
+SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")
+PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
+DATA_PATH=data
+DATA_TYPES=*.ini *.map *.glade *.png
+DATA=$(foreach type, $(DATA_TYPES), $(shell find $(DATA_PATH) -iname "$(type)"))
+OBJ=$(SOURCE:.py=.pyc)
+BUILD_PATH=./build
+TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
+TODO_FILE=./TODO
+
+DEBUGGER=winpdb
+UNIT_TEST=nosetests --with-doctest -w .
+SYNTAX_TEST=support/test_syntax.py
+STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
+LINT_RC=./support/pylint.rc
+LINT=pylint --rcfile=$(LINT_RC)
+PROFILE_GEN=python -m cProfile -o .profile
+PROFILE_VIEW=python -m pstats .profile
+TODO_FINDER=support/todo.py
+CTAGS=ctags-exuberant
+
+.PHONY: all run profile debug test build lint tags todo clean distclean
+
+all: test
+
+run: $(OBJ)
+       $(SOURCE_PATH)/$(PROJECT_NAME)_glade.py
+
+profile: $(OBJ)
+       $(PROFILE_GEN) $(PROGRAM)
+       $(PROFILE_VIEW)
+
+debug: $(OBJ)
+       $(DEBUGGER) $(PROGRAM)
+
+test: $(OBJ)
+       $(UNIT_TEST)
+
+package: $(OBJ)
+       rm -Rf $(BUILD_PATH)
+
+       mkdir -p $(BUILD_PATH)/generic
+       cp $(SOURCE_PATH)/constants.py  $(BUILD_PATH)/generic
+       cp $(SOURCE_PATH)/$(PROJECT_NAME).py  $(BUILD_PATH)/generic
+       $(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/generic/$(subst /,-,$(file)) ; )
+       $(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/generic/$(subst /,-,$(file)) ; )
+       cp support/$(PROJECT_NAME).desktop $(BUILD_PATH)/generic
+       cp support/builddeb.py $(BUILD_PATH)/generic
+       cp support/py2deb.py $(BUILD_PATH)/generic
+       cp support/fake_py2deb.py $(BUILD_PATH)/generic
+
+       mkdir -p $(BUILD_PATH)/diablo
+       cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/diablo
+       cd $(BUILD_PATH)/diablo ; python builddeb.py diablo
+       mkdir -p $(BUILD_PATH)/fremantle
+       cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/fremantle
+       cd $(BUILD_PATH)/fremantle ; python builddeb.py fremantle
+       mkdir -p $(BUILD_PATH)/debian
+       cp -R $(BUILD_PATH)/generic/* $(BUILD_PATH)/debian
+       cd $(BUILD_PATH)/debian ; python builddeb.py debian
+
+upload:
+       dput fremantle-extras-builder $(BUILD_PATH)/fremantle/$(PROJECT_NAME)*.changes
+       dput diablo-extras-builder $(BUILD_PATH)/diablo/$(PROJECT_NAME)*.changes
+       cp $(BUILD_PATH)/debian/*.deb ./www/$(PROJECT_NAME).deb
+
+lint: $(OBJ)
+       $(foreach file, $(SOURCE), $(LINT) $(file) ; )
+
+tags: $(TAG_FILE) 
+
+todo: $(TODO_FILE)
+
+clean:
+       rm -Rf $(OBJ)
+       rm -Rf $(BUILD_PATH)
+       rm -Rf $(TODO_FILE)
+
+distclean:
+       rm -Rf $(OBJ)
+       rm -Rf $(BUILD_PATH)
+       rm -Rf $(TAG_FILE)
+       find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
+       find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
+       find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
+       find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f
+
+$(TAG_FILE): $(OBJ)
+       mkdir -p $(dir $(TAG_FILE))
+       $(CTAGS) -o $(TAG_FILE) $(SOURCE)
+
+$(TODO_FILE): $(SOURCE)
+       @- $(TODO_FINDER) $(SOURCE) > $(TODO_FILE)
+
+%.pyc: %.py
+       $(SYNTAX_TEST) $<
+
+#Makefile Debugging
+#Target to print any variable, can be added to the dependencies of any other target
+#Userfule flags for make, -d, -p, -n
+print-%: ; @$(error $* is $($*) ($(value $*)) (from $(origin $*)))