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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
|
# **************************************************************************
# Makefile
#
# Makefile for creating MS Windows installers for the Coin binary SDK for
# MS Windows.
#
# Prerequisites:
# Cygwin system.
# makensis - the nullsoft installer system
#
# Authors:
# Lars J. Aas <larsa@sim.no>
# **************************************************************************
project = coin
Project = Coin
major = @COIN_MAJOR_VERSION@
sdk_prefix = /tmp/coin3d/coin
#sdk_prefix = ${prefix}
top_srcdir = @top_srcdir@
# default c library option
libc = md
ALLCFLAGS = /noBool /WX
DBGCFLAGS = $(ALLCFLAGS) /GZ /Zi /Yd
OPTCFLAGS = $(ALLCFLAGS) /Oitgb1 /Gs
DLLCFLAGS = /GD
CONFIGUREOPTIONS = --enable-threads
# --enable-threadsafe is disabled for performance reasons
# --enable-3ds-import is disabled for stability (untested code) reasons
BUILDOPTIONS = --disable-dependency-tracking --disable-libtool-lock
BUILDS = buildfiles docs shared-release shared-debug # static-release static-debug
# **************************************************************************
all:: $(BUILDS) $(project)-v$(VERSION)-install.exe
# **************************************************************************
extract.sed: Makefile
@echo -e "2,\$$ {\n/GENERAL PUBLIC LICENSE/,/END OF TERMS/ {\ns/\f//;\np;\n};\n};" >extract.sed
unix2dos.sed: Makefile
@echo -e "s/\$$/\r/;\np;" >unix2dos.sed
LICENSE.TXT: extract.sed unix2dos.sed
@cp $(top_srcdir)/LICENSE.GPL LICENSE.TXT;
@for process in extract unix2dos; do \
sed -n -f $${process}.sed <LICENSE.TXT >LICENSE.TMP; \
rm -f LICENSE.TXT; \
mv -f LICENSE.TMP LICENSE.TXT; \
rm -f $${process}.sed; \
done
# FIXME: use full makensis path (and support spaces in the path)...
# something like ac_subst $(sim_ac_makensis_exe)
$(project)-v$(VERSION)-install.exe: $(project).nsi LICENSE.TXT $(project)-sdk.html
makensis $(project).nsi
$(Project)-$(VERSION): $(Project)-$(VERSION).tar.gz
tar zxf $(Project)-$(VERSION).tar.gz
# Note: Making the distdir target in the Makefile.in files, genereated
# by automake, can cause two kinds of problems on cygwin.
# Both problems are fixed below by modifying the Makefile.in files.
#
#### Problem 1
#
# The first problem is that if $(DISTFILES) is too big (around 30502
# bytes on my system), the make aborts with the following error:
#
# mkdir -p -- ../../Coin-2.2.0a/src/elements/../../include/Inventor/elements
# c:\cygwin\bin\bash.exe: *** fork: can't reserve memory for stack 0x40000 -
# 0x240000, Win32 error 487
# 4 [main] bash 2220 sync_with_child: child 3112(0x6DC) died before
# initialization with status code 0x1
# 438 [main] bash 2220 sync_with_child: *** child state waiting for
# longjmp
# /bin/bash: fork: Resource temporarily unavailable
# make[2]: *** [distdir] Error 128
#
#
# Simplified case:
# The following command line will fail with the error message mantioned
# above:
#
# [1]
# list='$(somevar)'; foo=`pwd`
#
# If I rewrite the line to (note change of quoting) :
#
# [2]
# list='$(somevar)'; foo='pwd'
#
# list is set correctly, but foo, of course, isn't.
#
# If I replace this with the following, everything is OK (note the
# non-existent semicollon on the first line)
#
# [3]
# echo $(somevar) > somevar.txt
# list=`cat somevar.txt`; foo=`pwd`
#
# This was the only fix I was able to come up with. I do not know why
# [1] fails and [2] doesn't. I think it has to do with the maximum
# command line size for bash when bash forks a sub-process. The first
# error message comes from <cygwin-source>/winsup/cygwin/dcrt0.cc,
# called from fork.c.
#
# A similar bug report can be found here:
# http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3467&group_id=353
#
#
# And another one (with a suggested solution):
# http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-reviews/mercury-reviews.0202/0162.html
#
# The fix will be removed when we've start using makefiles in the include
# directories.
#
#### problem 2
#
# The dist target in Makefile.in, generated by automake, is incompatible with
# filesystems mounted in textmode under cygwin. A slight rewrite of the
# offending line fixes the problem:
#
# Change
#
# $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
#
# into
#
# GZIP=$(GZIP_ENV) $(AMTAR) czhof $(distdir).tar.gz $(distdir)
#
# Alternative fixes
# - Abort make process if source directory is mounted in textmode
# - Let the makefile mount the source directory in binary mode
# - Try to convince the automake guys to change automake
# (this will probably fail, see note in
# autotool/devel/share/automake-1.7/am/distdir.am regarding this)
#
# 2003-11-19 thammer.
$(Project)-$(VERSION).tar.gz:
@( cd ..; \
itemlist=`find . -name Makefile`; \
for item in $$itemlist ; do \
cp $$item $$item.org; \
cat $$item.org | sed -e 's/distdir: \$$(DISTFILES)/distdir: \$$(DISTFILES)\n\techo \$$(DISTFILES)>distfiles.txt/' -e "s/list='\$$(DISTFILES)'/list=\`cat distfiles.txt\`/" >$$item; \
done; \
cp Makefile Makefile.org; \
cat Makefile.org | sed -e 's/$$(AMTAR) chof - $$(distdir) | GZIP=$$(GZIP_ENV) gzip -c >$$(distdir).tar.gz/GZIP=$$(GZIP_ENV) $$(AMTAR) czhof $$(distdir).tar.gz $$(distdir)/g' > Makefile; \
$(MAKE) dist; mv $(Project)-$(VERSION).tar.gz windows/ )
headerlist.nsi: $(project)_include.txt Makefile
winpath=`CYGWIN= cygpath -w "$(sdk_prefix)"`; \
( prevdir=; for path in `cat $(project)_include.txt`; do \
dir=`echo $$path | sed 's/\/[^\/]*$$//'`; \
if test x"$$dir" != x"$$prevdir"; then \
prevdir=$$dir; \
file=`echo $$path | sed 's/^.*\///g'`; \
dir=`echo $$dir | sed 's/\//\\\\/g'`; \
echo "SetOutPath \$$INSTDIR\\$$dir"; \
echo "File $$winpath\\$$dir\\*.h"; \
fi; \
done ) >headerlist.nsi
$(project)_include.txt: Makefile
(cd $(sdk_prefix); \
find include -type f -name *.h) \
> $(project)_include.txt
sourcelist.nsi: $(project)_source.txt Makefile
( prevdir=""; for path in `cat $(project)_source.txt`; do \
dir=`echo $$path | sed 's/\/[^\/]*$$//'`; \
if test x"$$dir" != x"$$prevdir"; then \
prevdir=$$dir; \
file=`echo $$path | sed 's/^.*\///g'`; \
dir=`echo $$dir | sed 's/\//\\\\/g'`; \
echo "SetOutPath \$$INSTDIR\\source\\$$dir"; \
echo "File $$dir\\*"; \
fi; \
done ) >sourcelist.nsi
$(project)_source.txt: $(Project)-$(VERSION) Makefile
find $(Project)-$(VERSION) -type f \
> $(project)_source.txt
buildfileslist.nsi: $(project)_build.txt Makefile
( prevdir=; for path in `cat $(project)_build.txt`; do \
dir=`echo $$path | sed 's/\/[^\/]*$$//'`; \
if test x"$$dir" != x"$$prevdir"; then \
prevdir=$$dir; \
file=`echo $$path | sed 's/^.*\///g'`; \
dir=`echo $$dir | sed 's/\//\\\\/g' | cut -c2-`; \
echo "SetOutPath \$$INSTDIR\\build$$dir"; \
echo "File .\\build-files$$dir\\$$file"; \
else \
dir=`echo $$dir | sed 's/\//\\\\/g' | cut -c2-`; \
file=`echo $$path | sed 's/^.*\///g'`; \
echo "File .\\build-files$$dir\\$$file"; \
fi; \
done ) >buildfileslist.nsi
$(project)_build.txt: buildfiles
(cd build-files; \
echo "./$(project)$(major).dsp"; \
echo "./$(project)$(major).dsw"; \
find . -type f -name "*.h") > $(project)_build.txt
uninstall.nsi: Makefile
( cd $(sdk_prefix); \
for file in `find . -type f -depth`; do \
file=`echo $$file | sed 's/^.\///; s/\//\\\\/g'`; \
echo "Delete \$$INSTDIR\\$$file"; \
done; \
for dir in `find . -type d -depth`; do \
dir=`echo $$dir | sed 's/^.\///; s/\//\\\\/g'`; \
echo "RMDir \$$INSTDIR\\$$dir"; \
done ) >uninstall.nsi
$(project).nsi: heading.nsi headerlist.nsi middle.nsi sourcelist.nsi bfheader.nsi buildfileslist.nsi post.nsi uninstall.nsi footer.nsi unix2dos.sed Makefile
cat heading.nsi headerlist.nsi middle.nsi sourcelist.nsi bfheader.nsi buildfileslist.nsi post.nsi uninstall.nsi footer.nsi >$(project).tmp
winpath=`CYGWIN= cygpath -w "$(sdk_prefix)"`; \
winpath=`echo $$winpath | sed -e 's/\\\\/\\\\\\\\/g'`; \
sed -e 's/@win_prefix@/'$$winpath'/g' \
-e 's/@sdk_version@/$(VERSION)/g' <$(project).tmp >$(project).tmp2
sed -n -f unix2dos.sed <$(project).tmp2 >$(project).nsi
rm -f $(project).tmp $(project).tmp2
# **************************************************************************
build-docs/html/index.html: $(Project)-$(VERSION)
@if test -d build-docs; then :; else mkdir build-docs; fi
cd build-docs; \
../$(Project)-$(VERSION)/configure \
--disable-build \
--enable-html htmldir=html/$(Project) \
--enable-html-help htmlhelpdir=htmlhelp \
--enable-man \
--prefix=$(sdk_prefix)
cd build-docs/; \
$(MAKE)
cd build-docs/; \
$(MAKE) install
if test -d "$(top_srcdir)/docs/images"; then \
mkdir -p build-docs/html/images; \
cp -R "$(top_srcdir)/docs/images/Coin" build-docs/html/images; \
cp -R "$(top_srcdir)/docs/images/SoGuiExamples" build-docs/html/images; \
for file in `find "build-docs/html" -name "*.html"`; do \
sed -i -e 's%http://doc.coin3d.org/images/%images/%g' $$file; \
done; \
fi
-if test -d "$(top_srcdir)/docs/images"; then \
cd "build-docs/html"; \
hhc index.hhp; \
fi
docs: build-docs/html/index.html
build-shared-release/src/$(project)$(major).dll: $(Project)-$(VERSION)
@if test -d build-shared-release; then :; else mkdir build-shared-release; fi
cd build-shared-release; \
../$(Project)-$(VERSION)/configure \
CFLAGS="$(OPTCFLAGS) $(DLLCFLAGS)" \
CXXFLAGS="$(OPTCFLAGS) $(DLLCFLAGS)" \
$(CONFIGUREOPTIONS) \
$(BUILDOPTIONS) \
--disable-debug \
--disable-symbols \
--with-msvcrt=$(libc) \
--prefix=$(sdk_prefix)
cd build-shared-release; \
$(MAKE)
cd build-shared-release; \
$(MAKE) install
shared-release: build-shared-release/src/$(project)$(major).dll
build-shared-debug/src/$(project)$(major)d.dll: $(Project)-$(VERSION)
@if test -d build-shared-debug; then :; else mkdir build-shared-debug; fi
cd build-shared-debug; \
../$(Project)-$(VERSION)/configure \
CFLAGS="$(DBGCFLAGS)" \
CXXFLAGS="$(DBGCFLAGS)" \
$(CONFIGUREOPTIONS) \
$(BUILDOPTIONS) \
--enable-debug \
--enable-symbols \
--with-msvcrt=$(libc)d \
--with-alternate=debug \
--with-suffix=d \
--prefix=$(sdk_prefix)
cd build-shared-debug; \
$(MAKE)
cd build-shared-debug; \
$(MAKE) install
shared-debug: build-shared-debug/src/$(project)$(major)d.dll
build-static-release/src/$(project)$(major)d.dll: $(Project)-$(VERSION)
@if test -d build-static-release; then :; else mkdir build-static-release; fi
cd build-static-release; \
../$(Project)-$(VERSION)/configure \
CFLAGS="$(OPTCFLAGS)" \
CXXFLAGS="$(OPTCFLAGS)" \
$(CONFIGUREOPTIONS) \
$(BUILDOPTIONS) \
--disable-shared \
--disable-debug \
--disable-symbols \
--with-msvcrt=$(libc) \
--with-alternate=static \
--with-suffix=s \
--prefix=$(sdk_prefix)
cd build-static-release; \
$(MAKE)
cd build-static-release; \
$(MAKE) install
static-release: build-static-release/src/$(project)$(major)d.dll
build-static-debug/src/$(project)$(major)d.dll: $(Project)-$(VERSION)
@if test -d build-static-debug; then :; else mkdir build-static-debug; fi
cd build-static-debug; \
../$(Project)-$(VERSION)/configure \
CFLAGS="$(DBGCFLAGS)" \
CXXFLAGS="$(DBGCFLAGS)" \
$(CONFIGUREOPTIONS) \
$(BUILDOPTIONS) \
--disable-shared \
--enable-debug \
--enable-symbols \
--with-msvcrt=$(libc)d \
--with-alternate=static-debug \
--with-suffix=sd \
--prefix=$(sdk_prefix)
cd build-static-debug; \
$(MAKE)
cd build-static-debug; \
$(MAKE) install
static-debug: build-static-debug/src/$(project)$(major)d.dll
buildfiles: build-files/$(project)$(major).dsp
build-files/$(project)$(major).dsp: $(Project)-$(VERSION)
@if test -d build-files; then :; else mkdir build-files; fi
builddir=`pwd`; \
cd build-files; \
../$(Project)-$(VERSION)/configure \
$(CONFIGUREOPTIONS) \
$(BUILDOPTIONS) \
--enable-msvcdsp; \
$(MAKE) clean && $(MAKE); \
wbuilddir=`cygpath -w $$builddir | sed -e 's%\\\\%\\\\\\\\%g'`; \
version=`echo "@VERSION@" | sed -e 's%\.%\\\.%g'`; \
cp $(project)$(major).dsp $(project)$(major).dsp.orig; \
cat $(project)$(major).dsp.orig | \
sed -e "s%$$wbuilddir%\.\.\\\\\.\.%g" \
-e "s%\.\.\\\\source\\\\$(Project)-$$version%\.\.\\\\\.\.\\\\source\\\\$(Project)-$(major)%g" \
-e "s%\\\\$(Project)-$$version%%g" \
-e "s%/out:\"%/out:\"\.\.\\\\\.\.\\\\bin\\\\%g" \
-e "s%$(project)$(major)d\.dll\"%$(project)$(major)d\.dll\" /pdb:\"\.\.\\\\\.\.\\\\bin\\\\$(project)$(major)d.pdb\" /implib:\"\.\.\\\\\.\.\\\\lib\\\\$(project)$(major)d.lib\"%g" \
-e "s%$(project)$(major)\.dll\"%$(project)$(major)\.dll\" /implib:\"\.\.\\\\\.\.\\\\lib\\\\$(project)$(major).lib\"%g" \
> $(project)$(major).dsp; \
rm $(project)$(major).dsp.orig
.PHONY: docs shared-release shared-debug static-release static-debug buildfiles
# **************************************************************************
|