3 # Patch to cudd build system to build everything with libtool, supporting
4 # shared libraries. Also all libraries are combined into a single one.
6 # This script applies the patch, builds cudd, and, assuming there are no
7 # errors, reverses the patch.
9 # -- Morgan Deters <mdeters@cs.nyu.edu> Wed, 13 Jul 2011 18:03:11 -0400
13 if [ $# -ne 1 -o "$1" = -h -o "$1" = -help -o "$1" = --help ]; then
14 echo "usage: $(basename "$0") cudd-dir" >&2
18 patch="$(pwd)/$(basename "$0")"
19 if [ ! -r "$patch" ]; then
20 echo "error: can't read patch at \`$patch'" >&2
23 if ! expr "$1" : / &>/dev
/null
; then
24 echo "error: must specify an absolute path to cudd sources" >&2
29 arch
=$
(..
/config
/config.guess | cut
-f1 -d-)
31 i?
86) XCFLAGS
='-mtune=pentium4 -malign-double -DHAVE_IEEE_754 -DBSD' ;;
32 x86_64
) XCFLAGS
='-mtune=native -DHAVE_IEEE_754 -DBSD -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8' ;;
45 datadir
="$prefix/share"
46 includedir
="$prefix/include"
48 mandir
="$datadir/man/man1"
53 make "XCFLAGS=$XCFLAGS" "CC=libtool --mode=compile gcc" "CPP=libtool --mode=compile g++" libdir
="$libdir" version_info
="$version_info" DDDEBUG
= MTRDEBUG
= ICFLAGS
=-O2
55 libtool
--mode=install cp libcudd.la
"$libdir/libcudd.la"
56 libtool
--mode=install cp libcuddxx.la
"$libdir/libcuddxx.la"
57 libtool
--mode=install cp libdddmp.la
"$libdir/libdddmp.la"
58 libtool
--finish "$libdir"
59 patch -p1 -R < "$patch"
64 --- cudd-2.5
.0.orig
/Makefile
65 +++ cudd-2.5
.0/Makefile
66 @@
-220,11 +220,16 @@ DIRS
= $
(BDIRS
) nanotrav
70 - @
for dir
in $
(DIRS
); do \
71 + +@
for dir
in $
(BDIRS
) obj
; do \
73 echo Making $
$dir ...
; \
74 - make CC
=$
(CC
) RANLIB
=$
(RANLIB
) MFLAG
= MNEMLIB
= ICFLAGS
="$(ICFLAGS)" XCFLAGS
="$(XCFLAGS)" DDDEBUG
="$(DDDEBUG)" MTRDEBUG
="$(MTRDEBUG)" LDFLAGS
="$(LDFLAGS)" PURE
="$(PURE)" EXE
="$(EXE)" )\
75 + make CC
="$(CC)" RANLIB
="$(RANLIB)" MFLAG
= MNEMLIB
= ICFLAGS
="$(ICFLAGS)" XCFLAGS
="$(XCFLAGS)" DDDEBUG
="$(DDDEBUG)" MTRDEBUG
="$(MTRDEBUG)" LDFLAGS
="$(LDFLAGS)" PURE
="$(PURE)" EXE
="$(EXE)" )\
77 + libtool
--mode=link gcc
-rpath "$(libdir)" -version-info "$(version_info)" -o libcudd.la cudd
/libcudd.la mtr
/libmtr.la epd
/libepd.la util
/libutil.la st
/libst.la
-lm
78 + libtool
--mode=link gcc
-rpath "${libdir}" -version-info "$(version_info)" -o libdddmp.la dddmp
/libdddmp.la
79 + libtool
--mode=link g
++ -rpath "$(libdir)" -version-info "$(version_info)" -o libcuddxx.la obj
/libobj.la
-lcudd
81 + make CC
="$(CC)" RANLIB
="$(RANLIB)" MFLAG
= MNEMLIB
= ICFLAGS
="$(ICFLAGS)" XCFLAGS
="$(XCFLAGS)" DDDEBUG
="$(DDDEBUG)" MTRDEBUG
="$(MTRDEBUG)" LDFLAGS
="$(LDFLAGS)" PURE
="$(PURE)" EXE
="$(EXE)" )
85 @@
-318,4 +323,6 @@ distclean
:
86 echo Cleaning $
$dir ...
; \
87 make -s EXE
="$(EXE)" distclean
) \
89 + rm -f libcudd
* libdddmp
*
92 --- cudd-2.5
.0.orig
/mtr
/Makefile
93 +++ cudd-2.5
.0/mtr
/Makefile
94 @@
-30,7 +30,7 @@ INCLUDE
= $
(WHERE
)/include
96 PSRC
= mtrBasic.c mtrGroup.c
99 +POBJ
= $
(PSRC
:.c
=.lo
)
103 @@
-49,12 +49,11 @@ LINTLIBS
= llib-l$
(P
).
ln
105 #---------------------------
111 + libtool
--mode=link gcc
-o $@ $?
113 -.c.o
: $
(PSRC
) $
(PHDR
)
114 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(MTRDEBUG
)
116 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(MTRDEBUG
)
118 optimize_dec
: lib$
(P
).b
120 @@
-88,9 +87,10 @@ $
(TARGETu
): $
(SRC
) $
(PSRC
) $
(PHDR
) $
(UBJ
121 cc
-O3 $
(XCFLAGS
) $
(LDFLAGS
) -o $@ $
(UBJ
) $
(BLIBS
) -lm
124 - rm -f *.o
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
125 + rm -f *.o
*.lo
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
126 .pure core
*.warnings
129 - rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib$
(P
).b llib-l$
(P
).
ln \
130 + rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln \
131 *.bak
*~ tags
*.qv
*.qx
133 --- cudd-2.5
.0.orig
/nanotrav
/Makefile
134 +++ cudd-2.5
.0/nanotrav
/Makefile
135 @@
-19,9 +19,7 @@ WHERE
= ..
137 INCLUDE
= $
(WHERE
)/include
139 -LIBS = $
(WHERE
)/dddmp
/libdddmp.a $
(WHERE
)/cudd
/libcudd.a \
140 - $
(WHERE
)/mtr
/libmtr.a $
(WHERE
)/st
/libst.a $
(WHERE
)/util
/libutil.a \
141 - $
(WHERE
)/epd
/libepd.a
142 +LIBS
= $
(WHERE
)/libcudd.la $
(WHERE
)/libdddmp.la
145 #MNEMLIB = $(WHERE)/mnemosyne/libmnem.a
146 @@
-39,7 +37,7 @@ SRC
= main.c bnet.c ntr.c ntrHeap.c ntrB
147 HDR
= bnet.h ntr.h $
(WHERE
)/include
/dddmp.h $
(WHERE
)/include
/cudd.h \
148 $
(WHERE
)/include
/cuddInt.h
155 @@
-61,10 +59,10 @@ LINTFLAGS
= -u -n -DDD_STATS -DDD_CACHE_
156 #------------------------------------------------------
158 $
(TARGET
): $
(SRC
) $
(OBJ
) $
(HDR
) $
(LIBS
) $
(MNEMLIB
)
159 - $
(PURE
) $
(CC
) $
(CFLAGS
) $
(LDFLAGS
) -o $@ $
(OBJ
) $
(LIBS
) $
(MNEMLIB
) -lm
160 + libtool
--mode=link gcc $
(CFLAGS
) $
(LDFLAGS
) -o $@ $
(OBJ
) $
(LIBS
) $
(MNEMLIB
) -lm
163 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
165 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
167 # if the header files change, recompile
169 @@
-91,8 +89,9 @@ pixie
: $
(TARGETu
)
173 - rm -f *.o
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
174 + rm -f *.o
*.lo
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
175 .pure core
*.warnings
178 rm -f $
(TARGET
) $
(TARGETu
) *.bak
*~ .gdb_history
*.qv
*.qx
180 --- cudd-2.5
.0.orig
/dddmp
/Makefile
181 +++ cudd-2.5
.0/dddmp
/Makefile
182 @@
-148,7 +148,7 @@ PSRC
= dddmpStoreBdd.c dddmpStoreAdd.
183 dddmpStoreMisc.c dddmpUtil.c dddmpBinary.c dddmpConvert.c \
185 PHDR
= dddmp.h dddmpInt.h $
(INCLUDE
)/cudd.h $
(INCLUDE
)/cuddInt.h
186 -POBJ = $
(PSRC
:.c
=.o
)
187 +POBJ
= $
(PSRC
:.c
=.lo
)
189 TARGET
= test$
(P
)$
(EXE
)
191 @@
-182,12 +182,11 @@ LINTLIBS
= .
/llib-ldddmp.
ln $
(WHERE
)/cud
192 $
(WHERE
)/mtr
/llib-lmtr.
ln $
(WHERE
)/st
/llib-lst.
ln \
193 $
(WHERE
)/util
/llib-lutil.
ln
199 + libtool
--mode=link gcc
-o $@ $?
202 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(ICFLAGS
) $
(XCFLAGS
) $
(DDDEBUG
) $
(MTRDEBUG
) $
(DDDMPDEBUG
) $
(LDFLAGS
)
204 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(ICFLAGS
) $
(XCFLAGS
) $
(DDDEBUG
) $
(MTRDEBUG
) $
(DDDMPDEBUG
) $
(LDFLAGS
)
206 optimize_dec
: lib$
(P
).b
208 @@
-231,12 +230,13 @@ programs
: $
(TARGET
) $
(TARGETu
) lintpgm
209 #----------------------------------------------------------------------------#
212 - rm -f *.o
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
213 + rm -f *.o
*.lo
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
214 .pure core
*.warnings
217 - rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib$
(P
).b llib-l$
(P
).
ln \
218 + rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln \
219 *.bak
*~ tags .gdb_history
*.qv
*.qx
224 --- cudd-2.5
.0.orig
/util
/Makefile
225 +++ cudd-2.5
.0/util
/Makefile
226 @@
-20,19 +20,18 @@ LINTSWITCH
= -o
228 PSRC
= cpu_time.c cpu_stats.c safe_mem.c strsav.c texpand.c \
229 ptime.c prtime.c pipefork.c pathsearch.c stub.c datalimit.c
230 -POBJ = $
(PSRC
:.c
=.o
)
231 +POBJ
= $
(PSRC
:.c
=.lo
)
236 INCLUDE
= $
(WHERE
)/include
242 + libtool
--mode=link gcc
-o $@ $?
245 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(FLAGS
) $
(CFLAGS
)
247 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(FLAGS
) $
(CFLAGS
)
249 optimize_dec
: lib$
(P
).b
251 @@
-58,7 +57,8 @@ tags
: $
(PSRC
) $
(PHDR
)
252 all
: lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln tags
255 - rm -f *.o
*.u core
*.warnings
256 + rm -f *.o
*.lo
*.u core
*.warnings
259 - rm -f lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln tags
*.bak
*~ .pure
260 + rm -f lib$
(P
).a lib$
(P
).la lib$
(P
).b llib-l$
(P
).
ln tags
*.bak
*~ .pure
262 --- cudd-2.5
.0.orig
/epd
/Makefile
263 +++ cudd-2.5
.0/epd
/Makefile
264 @@
-19,7 +19,7 @@ LINTSWITCH
= -o
268 -POBJ = $
(PSRC
:.c
=.o
)
269 +POBJ
= $
(PSRC
:.c
=.lo
)
273 @@
-27,12 +27,11 @@ INCLUDE
= $
(WHERE
)/include
275 #---------------------------
281 + libtool
--mode=link gcc
-o $@ $?
283 -.c.o
: $
(PSRC
) $
(PHDR
)
284 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
)
286 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
)
288 optimize_dec
: lib$
(P
).b
290 @@
-58,7 +57,8 @@ tags
: $
(PSRC
) $
(PHDR
)
291 all
: lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln tags
294 - rm -f *.o
*.u .pure
*.warnings
295 + rm -f *.o
*.lo
*.u .pure
*.warnings
298 - rm -f lib
*.a lib$
(P
).b llib-l$
(P
).
ln tags
*~
*.bak
*.qv
*.qx
299 + rm -f lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln tags
*~
*.bak
*.qv
*.qx
301 --- cudd-2.5
.0.orig
/obj
/Makefile
302 +++ cudd-2.5
.0/obj
/Makefile
303 @@
-45,7 +45,7 @@ LDFLAGS
=
306 PHDR
= cuddObj.hh $
(INCLUDE
)/cudd.h
307 -POBJ = $
(PSRC
:.cc
=.o
)
308 +POBJ
= $
(PSRC
:.cc
=.lo
)
309 PUBJ
= $
(PSRC
:.cc
=.u
)
310 TARGET
= test$
(P
)$
(EXE
)
312 @@
-57,12 +57,11 @@ UBJ
= $
(SRC
:.cc
=.u
)
314 #------------------------------------------------------
320 + libtool
--mode=link g
++ -o $@ $?
323 - $
(CXX
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
325 + libtool
--mode=compile $
(CXX
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
327 optimize_dec
: lib$
(P
).b
329 @@
-80,7 +79,7 @@ $
(OBJ
): $
(PHDR
)
332 $
(TARGET
): $
(SRC
) $
(OBJ
) $
(HDR
) $
(LIBS
) $
(MNEMLIB
)
333 - $
(PURE
) $
(CXX
) $
(CFLAGS
) $
(LDFLAGS
) -o $@ $
(OBJ
) $
(LIBS
) $
(MNEMLIB
) -lm
334 + libtool
--mode=compile $
(PURE
) $
(CXX
) $
(CFLAGS
) $
(LDFLAGS
) -o $@ $
(OBJ
) $
(LIBS
) $
(MNEMLIB
) -lm
336 # optimize (DECstations and Alphas only: uses u-code)
337 $
(TARGETu
): $
(SRC
) $
(UBJ
) $
(HDR
) $
(LIBS
:.a
=.b
)
338 @@
-102,9 +101,10 @@ all
: lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln t
339 programs
: $
(TARGET
) $
(TARGETu
) lintpgm
342 - rm -f *.o
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
343 + rm -f *.o
*.lo
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
344 .pure core
*.warnings
347 - rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib$
(P
).b llib-l$
(P
).
ln \
348 + rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln \
349 *.bak
*~ tags .gdb_history
*.qv
*.qx
351 --- cudd-2.5
.0.orig
/st
/Makefile
352 +++ cudd-2.5
.0/st
/Makefile
353 @@
-19,7 +19,7 @@ LINTSWITCH
= -o
357 -POBJ = $
(PSRC
:.c
=.o
)
358 +POBJ
= $
(PSRC
:.c
=.lo
)
362 @@
-27,12 +27,11 @@ INCLUDE
= $
(WHERE
)/include
364 #---------------------------
370 + libtool
--mode=link gcc
-o $@ $?
373 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
)
375 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
)
377 optimize_dec
: lib$
(P
).b
379 @@
-58,7 +57,8 @@ tags
: $
(PSRC
) $
(PHDR
)
380 all
: lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln tags
383 - rm -f *.o
*.u .pure
*.warnings
384 + rm -f *.o
*.lo
*.u .pure
*.warnings
387 - rm -f lib
*.a lib$
(P
).b llib-l$
(P
).
ln tags
*~
*.bak
*.qv
*.qx
388 + rm -f lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln tags
*~
*.bak
*.qv
*.qx
390 --- cudd-2.5
.0.orig
/cudd
/Makefile
391 +++ cudd-2.5
.0/cudd
/Makefile
392 @@
-59,7 +59,7 @@ PSRC
= cuddAPI.c cuddAddAbs.c cuddAddApp
393 cuddZddPort.c cuddZddReord.c cuddZddSetop.c cuddZddSymm.c \
395 PHDR
= cudd.h cuddInt.h
396 -POBJ = $
(PSRC
:.c
=.o
)
397 +POBJ
= $
(PSRC
:.c
=.lo
)
399 TARGET
= test$
(P
)$
(EXE
)
401 @@
-71,12 +71,11 @@ UBJ
= $
(SRC
:.c
=.u
)
403 #------------------------------------------------------
409 + libtool
--mode=link gcc
-o $@ $?
411 -.c.o
: $
(PSRC
) $
(PHDR
)
412 - $
(CC
) -c $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
414 + $
(CC
) -c -o $@ $
< -I$
(INCLUDE
) $
(CFLAGS
) $
(DDDEBUG
)
416 optimize_dec
: lib$
(P
).b
418 @@
-116,9 +115,10 @@ all
: lib$
(P
).a lib$
(P
).b llib-l$
(P
).
ln t
419 programs
: $
(TARGET
) $
(TARGETu
) lintpgm
422 - rm -f *.o
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
423 + rm -f *.o
*.lo
*.u mon.out gmon.out
*.pixie
*.Addrs
*.Counts mnem.
* \
424 .pure core
*.warnings
427 - rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib$
(P
).b llib-l$
(P
).
ln \
428 + rm -f $
(TARGET
) $
(TARGETu
) lib
*.a lib
*.la lib$
(P
).b llib-l$
(P
).
ln \
429 *.bak
*~ tags .gdb_history
*.qv
*.qx