updated on Thu Jan 19 00:16:31 UTC 2012
[aur-mirror.git] / pycudd / Makefile
blob37cc4fff359f7112f2884c3f77c918a42f70962d
1 ######################################################
2 ###
3 ### pycudd Makefile
4 ### -- modified for new SWIG syntax
5 ### -- re-organised source .i files
6 ### -- BREL extensions
7 ### -- target strip_depend
8 ### -- as of 1.3.14, -shadow is no longer needed
9 ### Bug reports to: aravind@engr.ucsb.edu
10 ###
11 ######################################################
13 MOD = pycudd
15 #######
17 ## Change these to reflect local settings
19 #######
20 CUDD := /usr/local/cudd-2.4.0
21 # For debugging only -- this is CUDD with -g
22 #CUDD := /usr2/research/aravind/CAD/cudd-2.4.0
23 CUDDVER = 0x020400
24 PYTHON_LOC := /usr/
25 # For debugging:
26 #PYTHON_LOC := /usr2/research/aravind/CAD/usr/local
27 PYTHON_VER := python2.6
28 SWIG := /usr/bin/swig -classic
29 #SWIG := /usr2/research/aravind/usr/local/bin/swig
30 CCPLUS := g++
33 ## Leave USE_BREL undefined if you do not have the Boolean Relation minimisation package
34 USE_BREL =
35 #USE_BREL := 1
38 ## Set debugging info on/off -- this should normally be off.
39 PYCUDD_DEBUG =
40 #PYCUDD_DEBUG = 1
43 ## For internal use only
44 TESTING =
46 #######
48 ## Normal pycudd flags
49 ## * Set -march to reflect your installation system
50 ## * Set -malign-double if you compiled CUDD with that (default). If not, take it out.
52 #######
54 PYTHON_INCL := -I$(PYTHON_LOC)/include/$(PYTHON_VER) -I$(PYTHON_LOC)/lib/$(PYTHON_VER)/config
55 PY_DEP_INCL := -isystem $(PYTHON_LOC)/include/$(PYTHON_VER) -isystem $(PYTHON_LOC)/lib/$(PYTHON_VER)/config
57 # For AMD64 with 64-bit code:
58 # Point to the 64-bit libs -- this is for Mandriva linux, may be different for other distros
59 #PYTHON_INCL := -I$(PYTHON_LOC)/include/$(PYTHON_VER) -I$(PYTHON_LOC)/lib64/$(PYTHON_VER)/config
60 #PY_DEP_INCL := -isystem $(PYTHON_LOC)/include/$(PYTHON_VER) -isystem $(PYTHON_LOC)/lib64/$(PYTHON_VER)/config
62 CUDD_INCL := -I/usr/include/cudd
63 CUDD_LIB := /usr/lib/cudd
64 INCLUDES := $(CUDD_INCL) -I. $(PYTHON_INCL)
65 DEP_INCL := $(CUDD_INCL) -I. $(PY_DEP_INCL)
66 LDFLAGS := -L$(CUDD_LIB) -lm -lstdc++ -lcudd -lmtr -lst -lutil -ldddmp -lepd
67 SWIG_FLAGS := -c++ -python -o $(MOD)_wrap.cpp -DCUDDVER=$(CUDDVER)
68 FLAGS := -malign-double -DCUDDVER=$(CUDDVER)
70 # For AMD64:
71 # -malign-double is meaningless.
72 #FLAGS := -DCUDDVER=$(CUDDVER) -fPIC
74 ifdef PYCUDD_DEBUG
75 FLAGS := $(FLAGS) -g -DPYCUDD_DEBUG
76 SWIG_FLAGS := $(SWIG_FLAGS) -DPYCUDD_DEBUG -v -Wall
77 else
78 FLAGS := $(FLAGS) -O2 -march=pentium4
80 # AMD64 arch. optimization
81 #FLAGS := $(FLAGS) -O3 -march=athlon64
83 endif
84 LFLAGS := -Xlinker -rpath $(CUDD_LIB)
86 #######
88 ## BREL-specific additions -- modify to reflect your installation of BREL
90 #######
91 ifdef USE_BREL
92 BREL_LOC = /usr/local/brel
93 BREL_INCL := -I$(BREL_LOC) -I$(BREL_LOC)/list
94 INCLUDES := $(INCLUDES) $(BREL_INCL)
95 DEP_INCL := $(DEP_INCL) $(BREL_INCL)
96 LDFLAGS := $(LDFLAGS) -L$(BREL_LOC) -lbrel
97 FLAGS := $(FLAGS) -DBREL_R_THERE
98 LFLAGS := $(LFLAGS) -Xlinker -rpath $(BREL_LOC)
99 SWIG_FLAGS := $(SWIG_FLAGS) -DBREL_R_THERE
100 endif
102 SWG = $(MOD).i brel.i ddgen.i ddmanager.i ddnode.i externs.i pyiter.i tlcinfo.i utils.i epd.i
103 SRC = $(MOD).cpp $(MOD)_wrap.cpp
104 OBJ = $(SRC:.cpp=.o)
105 HDR = $(MOD).h docstring.h
107 .SUFFIXES: .cpp .cc .o .i .c
108 .PHONY : clean depend strip_depend docs
109 .cpp.o:
110 $(CCPLUS) $(FLAGS) $(INCLUDES) -c $<
112 .c.o:
113 $(CCPLUS) $(FLAGS) $(INCLUDES) -c $<
115 all: $(OBJ) $(HDR)
116 $(CCPLUS) -shared $(OBJ) $(LFLAGS) -o _$(MOD).so $(LDFLAGS);
119 ## This target is useful if you're hacking manually with the SWIG wrapper
120 libso:
121 $(CCPLUS) $(FLAGS) -g $(INCLUDES) -c $(MOD)_wrap.cpp
122 $(CCPLUS) -shared $(OBJ) $(LFLAGS) -o _$(MOD).so $(LDFLAGS);
124 ## The sed script fixes a problem with the disposal of DdNodes.
125 ## Essentially, the destructor has to call Cudd_RecursiveDeref irrespective of whoever swig thinks
126 ## owns the object -- we aren't going to really free anything anyway -- we only deref the node and
127 ## let CUDD handle the actual freeing up of the node.
128 ## Note: This used to be done by a script called fixpycudd.py
129 ## Note to note: This is now fixed by using the declaration %newobject for methods that require the returned Node to be derefed on GC
132 $(MOD)_wrap.cpp:$(SWG)
133 gcc -E -P -x c ./docstring | sed -e "s/\"\([^,]*\)\"/\1/g" | sed -e "s/\([^\n].*\)/#define DOCSTRING \"\1\"/" > docstring.h
134 $(SWIG) $(SWIG_FLAGS) $(MOD).i;
136 clean:
137 rm -f *.o *_wrap* *.pyc *.pyo _$(MOD).so $(MOD).py $(MOD)tmp.py docstring.h;
139 depend:
140 @sed "/^# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS/, $$ d" Makefile > mktemp
141 @echo "# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS" >> mktemp
142 @$(CCPLUS) $(FLAGS) $(DEP_INCL) -E -MM $(MOD).cpp >> mktemp
143 # The next line tries to get the C++ dependencies for the SWIG interface files
144 # First sed prints out the raw C++ code between %{...%}. Second sed removes those markers and any #error directives. Finally, generate a rule for our wrapper cpp file
145 @sed -n "/^%{/,/%}/ p" $(SWG) | sed -e "s/^%[{}].*\|#error.*//" | $(CCPLUS) -x c++ $(FLAGS) $(DEP_INCL) -E -MM -MQ "$(MOD)_wrap.cpp" - >> mktemp
146 @mv -f mktemp Makefile
148 strip_depend:
149 @sed "/^# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS/, $$ d" Makefile > mktemp # $ marks EOF for sed
150 @echo "# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS" >> mktemp
151 @mv -f mktemp Makefile
153 docs:
154 rm -rf doc
155 rm -f *.html
156 cp /usr/share/cudd/cudd/doc/cuddAllDet.html .
157 cp -f /usr/include/cudd/cudd.h .
158 grep "extern\|define Cudd" cudd.h | grep -v "\"C\"" | sed -e's/extern .* \(C[^(]*\) *(.*/\1/' | sed -e's/#define \([^(]*\).*/\1/' | sort > cudd_funcs
159 python doccer.py
160 rm -f cudd_funcs cudd.h
161 mkdir doc
162 mv *.html doc
164 ##################
166 ## CREDITS
168 ## Current maintainer : Aravind Vijayakumar
169 ## Bug reports to : aravind@engineering.ucsb.edu
170 ## Original creator : Steve Haynal
172 ##################
173 # DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS