1 ######################################################
4 ### -- modified for new SWIG syntax
5 ### -- re-organised source .i files
7 ### -- target strip_depend
8 ### -- as of 1.3.14, -shadow is no longer needed
9 ### Bug reports to: aravind@engr.ucsb.edu
11 ######################################################
17 ## Change these to reflect local settings
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
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
33 ## Leave USE_BREL undefined if you do not have the Boolean Relation minimisation package
38 ## Set debugging info on/off -- this should normally be off.
43 ## For internal use only
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.
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
)
71 # -malign-double is meaningless.
72 #FLAGS := -DCUDDVER=$(CUDDVER) -fPIC
75 FLAGS
:= $(FLAGS
) -g
-DPYCUDD_DEBUG
76 SWIG_FLAGS
:= $(SWIG_FLAGS
) -DPYCUDD_DEBUG
-v
-Wall
78 FLAGS
:= $(FLAGS
) -O2
-march
=pentium4
80 # AMD64 arch. optimization
81 #FLAGS := $(FLAGS) -O3 -march=athlon64
84 LFLAGS
:= -Xlinker
-rpath
$(CUDD_LIB
)
88 ## BREL-specific additions -- modify to reflect your installation of 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
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
105 HDR
= $(MOD
).h docstring.h
107 .SUFFIXES
: .
cpp .
cc .o .i .c
108 .PHONY
: clean depend strip_depend docs
110 $(CCPLUS
) $(FLAGS
) $(INCLUDES
) -c
$<
113 $(CCPLUS
) $(FLAGS
) $(INCLUDES
) -c
$<
116 $(CCPLUS
) -shared
$(OBJ
) $(LFLAGS
) -o _
$(MOD
).so
$(LDFLAGS
);
119 ## This target is useful if you're hacking manually with the SWIG wrapper
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
;
137 rm -f
*.o
*_wrap
* *.pyc
*.pyo _
$(MOD
).so
$(MOD
).py
$(MOD
)tmp.py docstring.h
;
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
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
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
160 rm -f cudd_funcs cudd.h
168 ## Current maintainer : Aravind Vijayakumar
169 ## Bug reports to : aravind@engineering.ucsb.edu
170 ## Original creator : Steve Haynal
173 # DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS