minor release cleanups
[greylag.git] / Makefile
blobda437b00801e261359ab1adb6da6a23bcf0ddd80
1 # Makefile for cgreylag module
3 # The SWIG Python/STL interface is pretty new, so SWIG 1.3.31 or later is
4 # required.
5 # Python 2.5 or later is required.
6 # A reasonably recent g++/libstdc++ may also be required.
8 # Developed with swig 1.3.31, g++ 3.4.6/4.1.2, libstdc++.so.6
11 .PHONY: all modsyms install install_scripts clean tags check release
12 .DELETE_ON_ERROR:
15 DEST = /usr/local/lib/greylag/
17 PYTHONFLAGS = $(shell python-config --include)
19 CXXBASEFLAGS = -Wall -Werror -g3 -fPIC -pipe
21 # use to add flags from the make command-line
22 CXXFASTFLAGS =
24 # This makes it easy to compile different versions without editing this file.
25 # 0=debug, 2=fast, 3=maybe faster (and less debuggable)
26 SPEED := 2
28 ifeq ($(SPEED),0)
29 # for debugging (extra checking, slow)
30 CXXFLAGS = $(CXXBASEFLAGS) -O0 -D_GLIBCXX_DEBUG
31 else
32 ifeq ($(SPEED),2)
33 # reasonably fast
34 CXXFLAGS = $(CXXBASEFLAGS) -O2 -ffast-math
35 else
36 ifeq ($(SPEED),3)
37 # for speed (fastest?, fewest checks)
38 CXXFLAGS = $(CXXBASEFLAGS) -O3 -ffast-math -DNDEBUG
39 else
40 CXXFLAGS = ---INVALID-SPEED
41 endif
42 endif
43 endif
45 SWIGCXXFLAGS = $(CXXFLAGS) $(PYTHONFLAGS) -fno-strict-aliasing -Wno-error
47 MODULE = cgreylag
49 all :: _$(MODULE).so
51 $(MODULE)_wrap.cpp : $(MODULE).i $(MODULE).hpp
52 swig -c++ -python -o $@ $<
54 $(MODULE)_wrap.o : $(MODULE)_wrap.cpp $(MODULE).hpp
55 @echo "# some warnings possible here (compiling swig output)"
56 $(CXX) $(SWIGCXXFLAGS) -c $<
58 $(MODULE).o : $(MODULE).cpp $(MODULE).hpp
59 $(CXX) $(CXXFLAGS) $(CXXFASTFLAGS) -c $<
61 _$(MODULE).so : $(MODULE).o $(MODULE)_wrap.o
62 $(CXX) $(CXXFLAGS) $(CXXFASTFLAGS) -shared $^ -o $@
65 # summary of C++ modules symbols used by main script
66 modsyms ::
67 @sed -n -e 's/^.*\(cgreylag\.[a-zA-Z0-9_.]*\).*$$/\1/p' \
68 greylag_chase.py \
69 | sort | uniq -c
71 tags :: TAGS
72 TAGS : $(MODULE).cpp $(MODULE).hpp
73 etags $^
75 install :: all install_scripts
76 install -p _$(MODULE).so $(DEST)
77 install -p --mode=444 $(MODULE).py $(DEST)
79 # FIX: we could compile the .py files here
80 install_scripts ::
81 [ -d $(DEST) ] || install -d $(DEST)
82 install -p --mode=444 greylag.py $(DEST)
83 install -p greylag_flatten_fasta.py $(DEST)/greylag-flatten-fasta
84 install -p greylag_shuffle_database.py $(DEST)/greylag-shuffle-database
85 install -p greylag_chase.py $(DEST)/greylag-chase
86 install -p greylag_rally.py $(DEST)/greylag-rally
87 install -p greylag_merge.py $(DEST)/greylag-merge
88 install -p greylag_sqt.py $(DEST)/greylag-sqt
89 install -p greylag_validate.py $(DEST)/greylag-validate
91 clean ::
92 -rm -f $(MODULE).py $(MODULE)_wrap.cpp $(MODULE).o $(MODULE)_wrap.o \
93 _$(MODULE).so *.py[co] TAGS *~ .??*~ \
94 test/*.py[co] test/*.glw test/*-bad.sqt test/tmp* test/*~
96 check :: all
97 nosetests --exe --with-doctest $(NOSEFLAGS)
100 # Release steps:
101 # - bump version number in greylag.py, commit to master branch
102 # - make clean; make; make check
103 # - tag with version number (w good one-line summary)
104 # git-tag -a v$(VERSION)
105 # - publish website (cd doc; make; make publish)
106 # - make release
107 # - upload to sourceforge
108 # - push master to public git archive
109 # git-push git+ssh://repo.or.cz/srv/git/greylag.git v$(VERSION)
110 # - announce to greylag-announce
112 release :: all
113 git-tag -l "v$(VERSION)" || false # no such tag
114 git-archive --format=tar --prefix=greylag-$(VERSION)/ v$(VERSION) \
115 | gzip -9 > ../greylag-$(VERSION).tgz
116 @echo DO: git-push git+ssh://repo.or.cz/srv/git/greylag.git v$(VERSION)