added --estimate, better running status, fixes
[greylag.git] / Makefile
blob44bdcb31c9069285a80fe78d1523700df00fa4a8
1 # Makefile for cgreylag module
3 # $Id$
6 # SWIG is still experiencing rapid development--1.3.28 or better is required.
7 # A reasonably recent g++/libstdc++ may also be required. Python 2.4 or
8 # better is assumed.
10 # Developed with swig 1.3.28, g++ 4.1.2, libstdc++.so.6 (ld 2.16.91)
13 .PHONY: all pycheck modsyms install clean tags
14 .DELETE_ON_ERROR:
17 MARCH = pentium3
18 # MARCH = pentium4
19 # MARCH = prescott
20 # MARCH = opteron
21 # MARCH = nocona
24 DEST = /n/site/inst/Linux-i686/bioinfo/greylag/
26 PYTHONVER=2.4
28 # Generally, this is where the 'Python.h' corresponding to your 'python' lives.
29 #PYTHON_I = /n/site/inst/Linux-i686/sys/include/python$(PYTHONVER)
30 PYTHON_I = /usr/include/python$(PYTHONVER)
32 CXXBASEFLAGS=-Wall -g3 -march=$(MARCH)
34 # This makes it easy to compile different versions without editing this file.
35 # 0=debug, 2=fast, 3=faster and less safe
36 SPEED := 2
38 ifeq ($(SPEED),0)
39 # for debugging (extra checking, slow)
40 CXXFLAGS = $(CXXBASEFLAGS) -O0 -D_GLIBCXX_DEBUG
41 else
42 ifeq ($(SPEED),2)
43 # reasonably fast
44 CXXFLAGS = $(CXXBASEFLAGS) -O2 -ffast-math -mfpmath=sse
45 else
46 ifeq ($(SPEED),3)
47 # for speed (fastest?, fewest checks)
48 CXXFLAGS = $(CXXBASEFLAGS) -O3 -DNDEBUG -ffast-math -mfpmath=sse
49 #CXXFASTFLAGS = -finline-limit=20000 --param inline-unit-growth=1000 --param large-function-growth=1000
50 else
51 CXXFLAGS = ---INVALID-SPEED
52 endif
53 endif
54 endif
56 SWIGCXXFLAGS = $(CXXFLAGS) -fPIC -I$(PYTHON_I) -fno-strict-aliasing \
57 -Wno-unused-function -Wno-uninitialized
59 PROGRAM = greylag
60 MODULE = cgreylag
62 all :: _$(MODULE).so
64 $(MODULE)_wrap.cpp : $(MODULE).i $(MODULE).hpp
65 swig -c++ -python -o $@ $<
67 $(MODULE)_wrap.o : $(MODULE)_wrap.cpp $(MODULE).hpp
68 g++ $(SWIGCXXFLAGS) -c $<
70 $(MODULE).o : $(MODULE).cpp $(MODULE).hpp
71 g++ $(CXXFLAGS) $(CXXFASTFLAGS) -c $<
73 _$(MODULE).so : $(MODULE).o $(MODULE)_wrap.o
74 g++ $(CXXFLAGS) $(CXXFASTFLAGS) -shared $^ -o $@
77 pycheck::
78 PYTHONVER=$(PYTHONVER) pychecker --limit 1000 $(PROGRAM).py
80 # summary C++ modules symbols used by main script
81 modsyms::
82 @sed -n -e 's/^.*\(cgreylag\.[a-zA-Z0-9_.]*\).*$$/\1/p' $(PROGRAM).py \
83 | sort | uniq -c
85 tags :: TAGS
86 TAGS : $(MODULE).cpp $(MODULE).hpp
87 etags --members $^
89 # FIX: we could compile the .py files here
90 install::
91 [ -d $(DEST) ] || install -d $(DEST)
92 install -p _$(MODULE).so $(DEST)
93 install -p --mode=444 $(MODULE).py $(DEST)
94 install -p $(PROGRAM).py $(DEST)
96 clean::
97 -rm -f $(MODULE).py $(MODULE)_wrap.cpp $(MODULE).o $(MODULE)_wrap.o \
98 _$(MODULE).so *.py[co] TAGS