begin redesign after reading Tabb et al paper re Myrimatch
[greylag.git] / Makefile
blob1e6a8fc796b368784ba591fc6b904fa20baa27fd
1 # Makefile for cgreylag module
3 # SWIG is still experiencing rapid development--1.3.31 or later is required.
4 # Python 2.5 or later is required.
5 # A reasonably recent g++/libstdc++ may also be required.
7 # Developed with swig 1.3.31, g++ 3.4.6/4.1.2, libstdc++.so.6
10 .PHONY: all pycheck modsyms install clean tags check
11 .DELETE_ON_ERROR:
14 # MARCH = pentium3
15 # MARCH = pentium4
16 MARCH = prescott
17 # MARCH = opteron
18 # MARCH = nocona
21 DEST = /n/site/inst/Linux-i686/bioinfo/greylag/
23 PYTHONVER=2.5
24 PYTHONFLAGS = $(shell python$(PYTHONVER)-config --include)
26 CXXBASEFLAGS = -Wall -g3 -march=$(MARCH) -fPIC
28 # This makes it easy to compile different versions without editing this file.
29 # 0=debug, 2=fast, 3=faster and less safe
30 SPEED := 2
32 ifeq ($(SPEED),0)
33 # for debugging (extra checking, slow)
34 CXXFLAGS = $(CXXBASEFLAGS) -O0 -D_GLIBCXX_DEBUG
35 else
36 ifeq ($(SPEED),2)
37 # reasonably fast
38 CXXFLAGS = $(CXXBASEFLAGS) -O2 -ffast-math -mfpmath=sse
39 else
40 ifeq ($(SPEED),3)
41 # for speed (fastest?, fewest checks)
42 CXXFLAGS = $(CXXBASEFLAGS) -O3 -DNDEBUG -ffast-math -mfpmath=sse
43 #CXXFASTFLAGS = -finline-limit=20000 --param inline-unit-growth=1000 --param large-function-growth=1000
44 else
45 CXXFLAGS = ---INVALID-SPEED
46 endif
47 endif
48 endif
50 SWIGCXXFLAGS = $(CXXFLAGS) $(PYTHONFLAGS) -fno-strict-aliasing \
51 -Wno-unused-function -Wno-uninitialized
53 PROGRAM = greylag
54 MODULE = cgreylag
56 all :: _$(MODULE).so
58 $(MODULE)_wrap.cpp : $(MODULE).i $(MODULE).hpp
59 swig -c++ -python -o $@ $<
61 $(MODULE)_wrap.o : $(MODULE)_wrap.cpp $(MODULE).hpp
62 g++ $(SWIGCXXFLAGS) -c $<
64 $(MODULE).o : $(MODULE).cpp $(MODULE).hpp
65 g++ $(CXXFLAGS) $(CXXFASTFLAGS) -c $<
67 _$(MODULE).so : $(MODULE).o $(MODULE)_wrap.o
68 g++ $(CXXFLAGS) $(CXXFASTFLAGS) -shared $^ -o $@
71 pycheck::
72 PYTHONVER=$(PYTHONVER) pychecker --limit 1000 $(PROGRAM).py
74 # summary C++ modules symbols used by main script
75 modsyms::
76 @sed -n -e 's/^.*\(cgreylag\.[a-zA-Z0-9_.]*\).*$$/\1/p' $(PROGRAM).py \
77 | sort | uniq -c
79 tags :: TAGS
80 TAGS : $(MODULE).cpp $(MODULE).hpp
81 etags --members $^
83 # FIX: we could compile the .py files here
84 install::
85 [ -d $(DEST) ] || install -d $(DEST)
86 install -p _$(MODULE).so $(DEST)
87 install -p --mode=444 $(MODULE).py $(DEST)
88 install -p $(PROGRAM).py $(DEST)
89 install -p $(PROGRAM)-mp.py $(DEST)
91 clean::
92 -rm -f $(MODULE).py $(MODULE)_wrap.cpp $(MODULE).o $(MODULE)_wrap.o \
93 _$(MODULE).so *.py[co] test/*.py[co] TAGS *~ .??*~ test/*~ \
94 test/tmp*
96 check::
97 nosetests --exe --with-doctest $(NOSEFLAGS)