-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile_64bit
181 lines (163 loc) · 6.23 KB
/
Makefile_64bit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
######################################################
###
### pycudd Makefile
### -- modified for new SWIG syntax
### -- re-organised source .i files
### -- BREL extensions
### -- target strip_depend
### -- as of 1.3.14, -shadow is no longer needed
### Bug reports to: [email protected]
###
######################################################
MOD = repycudd
#######
##
## Change these to reflect local settings
##
#######
TOP := $(shell pwd)
CUDD := $(TOP)/cudd-2.4.2/
CUDDVER = 0x020400
PYTHON_LOC := /usr
# Change the following to lib64 for 64-bit architectures
LIB_DIR := lib
#PYTHON_LOC := /usr
PYTHON_VER := python2.7 # Set this from command line for 2.6 or 3.4
SWIG := swig
CCPLUS := g++
##
## Leave USE_BREL undefined if you do not have the Boolean Relation minimisation package
#USE_BREL =
#USE_BREL := 1
##
## Set debugging info on/off -- this should normally be off.
PYCUDD_DEBUG =
#PYCUDD_DEBUG = 1
##
## For internal use only
TESTING =
#######
##
## Normal pycudd flags
## * Set -malign-double if you compiled CUDD with that (default). If not, take it out.
##
#######
#
#PYTHON_INCL := -I$(PYTHON_LOC)/include/$(PYTHON_VER) -I$(PYTHON_LOC)/lib/$(PYTHON_VER)/config
#PY_DEP_INCL := -isystem $(PYTHON_LOC)/include/$(PYTHON_VER) -isystem $(PYTHON_LOC)/lib/$(PYTHON_VER)/config
#
# For AMD64 with 64-bit code:
# Point to the 64-bit libs -- this is for Mandriva linux, may be different for other distros
PYTHON_INCL := -I$(PYTHON_LOC)/include/$(PYTHON_VER) -I$(PYTHON_LOC)/$(LIB_DIR)/$(PYTHON_VER)/config
PY_DEP_INCL := -isystem $(PYTHON_LOC)/include/$(PYTHON_VER) -isystem $(PYTHON_LOC)$(LIB_DIR)/$(PYTHON_VER)/config
#
CUDD_INCL := -I$(CUDD)/include
INCLUDES := $(CUDD_INCL) -I. $(PYTHON_INCL)
DEP_INCL := $(CUDD_INCL) -I. $(PY_DEP_INCL)
LDFLAGS := -L$(CUDD)/lib -lm -lstdc++ -lcudd -lcuddmtr -lcuddst -lcuddutil -ldddmp -lcuddepd
SWIG_FLAGS := -c++ -python -o $(MOD)_wrap.cpp -DCUDDVER=$(CUDDVER)
#FLAGS := -malign-double -DCUDDVER=$(CUDDVER)
#
# For AMD64:
# -malign-double is meaningless.
FLAGS := -DCUDDVER=$(CUDDVER) -fPIC
#
ifdef PYCUDD_DEBUG
FLAGS := $(FLAGS) -g -DPYCUDD_DEBUG
SWIG_FLAGS := $(SWIG_FLAGS) -DPYCUDD_DEBUG -v -Wall
else
FLAGS := $(FLAGS) -O2
endif
LFLAGS := -Xlinker -rpath $(CUDD)/lib
#######
##
## BREL-specific additions -- modify to reflect your installation of BREL
##
#######
ifdef USE_BREL
BREL_LOC = /usr/local/brel
BREL_INCL := -I$(BREL_LOC) -I$(BREL_LOC)/list
INCLUDES := $(INCLUDES) $(BREL_INCL)
DEP_INCL := $(DEP_INCL) $(BREL_INCL)
LDFLAGS := $(LDFLAGS) -L$(BREL_LOC) -lbrel
FLAGS := $(FLAGS) -DBREL_R_THERE
LFLAGS := $(LFLAGS) -Xlinker -rpath $(BREL_LOC)
SWIG_FLAGS := $(SWIG_FLAGS) -DBREL_R_THERE
endif
SWG = $(MOD).i brel.i ddgen.i ddmanager.i ddnode.i externs.i pyiter.i tlcinfo.i utils.i epd.i
SRC = $(MOD).cpp $(MOD)_wrap.cpp
OBJ = $(SRC:.cpp=.o)
HDR = $(MOD).h docstring.h
.SUFFIXES: .cpp .cc .o .i .c
.PHONY : clean depend strip_depend docs
.cpp.o:
$(CCPLUS) $(FLAGS) $(INCLUDES) -c $<
.c.o:
$(CCPLUS) $(FLAGS) $(INCLUDES) -c $<
all: $(OBJ) $(HDR)
$(MAKE) -C $(CUDD) -f Makefile_64bit
$(MAKE) -C $(CUDD) -f Makefile_64bit libso
$(CCPLUS) -shared $(OBJ) $(LFLAGS) -o _$(MOD).so $(LDFLAGS);
##
## This target is useful if you're hacking manually with the SWIG wrapper
libso:
$(CCPLUS) $(FLAGS) -g $(INCLUDES) -c $(MOD)_wrap.cpp
$(CCPLUS) -shared $(OBJ) $(LFLAGS) -o _$(MOD).so $(LDFLAGS);
##
## The sed script fixes a problem with the disposal of DdNodes.
## Essentially, the destructor has to call Cudd_RecursiveDeref irrespective of whoever swig thinks
## owns the object -- we aren't going to really free anything anyway -- we only deref the node and
## let CUDD handle the actual freeing up of the node.
## Note: This used to be done by a script called fixpycudd.py
## Note to note: This is now fixed by using the declaration %newobject for methods that require the returned Node to be derefed on GC
##
$(MOD)_wrap.cpp:$(SWG)
gcc -E -P -x c ./docstring | sed -e "s/\"\([^,]*\)\"/\1/g" | sed -e "s/\([^\n].*\)/#define DOCSTRING \"\1\"/" > docstring.h
$(SWIG) $(SWIG_FLAGS) $(MOD).i;
clean:
rm -f *.o *_wrap* *.pyc *.pyo _$(MOD).so $(MOD).py $(MOD)tmp.py docstring.h;
depend:
@sed "/^# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS/, $$ d" Makefile > mktemp
@echo "# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS" >> mktemp
@$(CCPLUS) $(FLAGS) $(DEP_INCL) -E -MM $(MOD).cpp >> mktemp
# The next line tries to get the C++ dependencies for the SWIG interface files
# 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
@sed -n "/^%{/,/%}/ p" $(SWG) | sed -e "s/^%[{}].*\|#error.*//" | $(CCPLUS) -x c++ $(FLAGS) $(DEP_INCL) -E -MM -MQ "$(MOD)_wrap.cpp" - >> mktemp
@mv -f mktemp Makefile
strip_depend:
@sed "/^# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS/, $$ d" Makefile > mktemp # $ marks EOF for sed
@echo "# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS" >> mktemp
@mv -f mktemp Makefile
docs:
rm -rf doc
rm -f *.html
cp $(CUDD)/cudd/doc/cuddAllDet.html .
cp -f $(CUDD)/cudd/cudd.h .
grep "extern\|define Cudd" cudd.h | grep -v "\"C\"" | sed -e's/extern .* \(C[^(]*\) *(.*/\1/' | sed -e's/#define \([^(]*\).*/\1/' | sort > cudd_funcs
python doccer.py
rm -f cudd_funcs cudd.h
mkdir doc
mv *.html doc
##################
##
## CREDITS
##
## Current maintainer : Merritt Miller
## Bug reports to : [email protected]
## Former maintainer : Aravind Vijayakumar
## Original creator : Steve Haynal
##
##################
# DO NOT CHANGE THIS OR ANY SUCCEEDING LINE -- AUTOGENERATED DEPS
repycudd.o: repycudd.cpp repycudd.h $(CUDD)/include/util.h \
$(CUDD)/include/cudd.h $(CUDD)/include/mtr.h \
$(CUDD)/include/epd.h $(CUDD)/include/cuddInt.h \
$(CUDD)/include/cudd.h $(CUDD)/include/st.h \
$(CUDD)/include/dddmp.h $(CUDD)/include/util.h \
$(CUDD)/include/epd.h
repycudd_wrap.cpp: $(CUDD)/include/cudd.h \
$(CUDD)/include/mtr.h $(CUDD)/include/epd.h repycudd.h \
$(CUDD)/include/util.h $(CUDD)/include/cuddInt.h \
$(CUDD)/include/cudd.h $(CUDD)/include/st.h \
$(CUDD)/include/dddmp.h $(CUDD)/include/util.h \
$(CUDD)/include/epd.h