diff --git a/build/Makefile.mingw32 b/build/Makefile.mingw32 new file mode 100644 index 00000000..23e0ae78 --- /dev/null +++ b/build/Makefile.mingw32 @@ -0,0 +1,269 @@ +# Usage: +# +# Create a new empty directory anywhere (preferably not in the boost tree). +# Copy this Makefile to that new directory and rename it to "Makefile" +# Set the MYBOOST_* pathnames below. +# +# The idea is that the build directory is on a Unix filesystem that +# is mounted on a PC using SAMBA. Use this makefile under both Unix +# and Windows: +# +# Unix: make softlinks Create softlinks to source code and tests +# Win: make Compile all sources +# Win: make test Run doctest tests +# Unix: make clean Remove all object files +# Unix: make unlink Remove softlinks + +# To install mingw32, follow instructions at: +# http://starship.python.net/crew/kernr/mingw32/Notes.html +# In particular, install: +# ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe +# ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2/fixes/quote-fix-msvcrt.exe +# http://starship.python.net/crew/kernr/mingw32/Python-1.5.2-mingw32.zip +# Unpack the first two archives in the default locations and update your PATH. +# Unpack the third archive in \usr. + +# Note: comprehensive.cpp generates compiler errors and later crashes. +# Could this be fixed with compiler options? + +MYBOOST_UNIX= /net/cci/rwgk/myboost +MYBOOST_WIN= "L:\myboost" + +PYEXE= "C:\Program files\Python\python.exe" +PYINC= -I"C:\usr\include\python1.5" +PYLIB= "C:\usr\lib\libpython15.a" + +STDOPTS= -ftemplate-depth-21 +WARNOPTS= + +CPP= g++ +CPPOPTS= $(STLPORTINC) $(STLPORTOPTS) -I$(MYBOOST_WIN) $(PYINC) \ + $(STDOPTS) $(WARNOPTS) -g + +LD= g++ +LDOPTS= -shared + +BPL_SRC = $(MYBOOST_UNIX)/libs/python/src +BPL_TST = $(MYBOOST_UNIX)/libs/python/test +BPL_EXA = $(MYBOOST_UNIX)/libs/python/example +SOFTLINKS = \ +$(BPL_SRC)/classes.cpp \ +$(BPL_SRC)/conversions.cpp \ +$(BPL_SRC)/extension_class.cpp \ +$(BPL_SRC)/functions.cpp \ +$(BPL_SRC)/import_extension_class.cpp \ +$(BPL_SRC)/init_function.cpp \ +$(BPL_SRC)/module_builder.cpp \ +$(BPL_SRC)/objects.cpp \ +$(BPL_SRC)/types.cpp \ +$(BPL_TST)/comprehensive.cpp \ +$(BPL_TST)/comprehensive.hpp \ +$(BPL_TST)/comprehensive.py \ +$(BPL_TST)/doctest.py \ +$(BPL_EXA)/abstract.cpp \ +$(BPL_EXA)/dvect.cpp \ +$(BPL_EXA)/dvect.h \ +$(BPL_EXA)/getting_started1.cpp \ +$(BPL_EXA)/getting_started2.cpp \ +$(BPL_EXA)/getting_started3.cpp \ +$(BPL_EXA)/getting_started4.cpp \ +$(BPL_EXA)/getting_started5.cpp \ +$(BPL_EXA)/passing_char.cpp \ +$(BPL_EXA)/cmplx.cpp \ +$(BPL_EXA)/ivect.cpp \ +$(BPL_EXA)/ivect.h \ +$(BPL_EXA)/noncopyable_export.cpp \ +$(BPL_EXA)/noncopyable_import.cpp \ +$(BPL_EXA)/store.h \ +$(BPL_EXA)/test_abstract.py \ +$(BPL_EXA)/test_getting_started1.py \ +$(BPL_EXA)/test_getting_started2.py \ +$(BPL_EXA)/test_getting_started3.py \ +$(BPL_EXA)/test_getting_started4.py \ +$(BPL_EXA)/test_getting_started5.py \ +$(BPL_EXA)/tst_passing_char.py \ +$(BPL_EXA)/tst_cmplx.py \ +$(BPL_EXA)/tst_dvect.py \ +$(BPL_EXA)/tst_ivect.py \ +$(BPL_EXA)/tst_noncopyable.py + +DEFS= \ +test \ +abstract \ +getting_started1 \ +getting_started2 \ +getting_started3 \ +getting_started4 \ +getting_started5 \ +passing_char \ +cmplx \ +noncopyable_export \ +noncopyable_import \ +ivect \ +dvect + +OBJ = classes.o conversions.o extension_class.o functions.o \ + import_extension_class.o init_function.o module_builder.o \ + objects.o types.o + +.SUFFIXES: .o .cpp + +all: libbpl.a test.pyd abstract.pyd \ + getting_started1.pyd getting_started2.pyd getting_started3.pyd \ + getting_started4.pyd getting_started5.pyd \ + passing_char.pyd cmplx.pyd \ + noncopyable_export.pyd noncopyable_import.pyd \ + ivect.pyd dvect.pyd + +softlinks: defs + @ for pn in $(SOFTLINKS); \ + do \ + bn=`basename "$$pn"`; \ + if [ ! -e "$$bn" ]; then \ + echo "ln -s $$pn ."; \ + ln -s "$$pn" .; \ + else \ + echo "info: no softlink created (file exists): $$bn"; \ + fi; \ + done + +unlink: rmdefs + @ for pn in $(SOFTLINKS); \ + do \ + bn=`basename "$$pn"`; \ + if [ -L "$$bn" ]; then \ + echo "rm $$bn"; \ + rm "$$bn"; \ + elif [ -e "$$bn" ]; then \ + echo "info: not a softlink: $$bn"; \ + fi; \ + done + +defs: + @ for def in $(DEFS); \ + do \ + echo "EXPORTS\n\tinit$$def" > $$def.def; \ + done + +rmdefs: + @ for def in $(DEFS); \ + do \ + rm $$def.def; \ + done + +libbpl.a: $(OBJ) + del libbpl.a + ar r libbpl.a $(OBJ) + +DLLWRAPOPTS= --driver-name g++ -s \ + --entry _DllMainCRTStartup@12 --target=i386-mingw32 + +test.pyd: $(OBJ) comprehensive.o + dllwrap $(DLLWRAPOPTS) \ + --dllname test.pyd \ + --def test.def \ + $(OBJ) comprehensive.o $(PYLIB) + +abstract.pyd: $(OBJ) abstract.o + dllwrap $(DLLWRAPOPTS) \ + --dllname abstract.pyd \ + --def abstract.def \ + $(OBJ) abstract.o $(PYLIB) + +getting_started1.pyd: $(OBJ) getting_started1.o + dllwrap $(DLLWRAPOPTS) \ + --dllname getting_started1.pyd \ + --def getting_started1.def \ + $(OBJ) getting_started1.o $(PYLIB) + +getting_started2.pyd: $(OBJ) getting_started2.o + dllwrap $(DLLWRAPOPTS) \ + --dllname getting_started2.pyd \ + --def getting_started2.def \ + $(OBJ) getting_started2.o $(PYLIB) + +getting_started3.pyd: $(OBJ) getting_started3.o + dllwrap $(DLLWRAPOPTS) \ + --dllname getting_started3.pyd \ + --def getting_started3.def \ + $(OBJ) getting_started3.o $(PYLIB) + +getting_started4.pyd: $(OBJ) getting_started4.o + dllwrap $(DLLWRAPOPTS) \ + --dllname getting_started4.pyd \ + --def getting_started4.def \ + $(OBJ) getting_started4.o $(PYLIB) + +getting_started5.pyd: $(OBJ) getting_started5.o + dllwrap $(DLLWRAPOPTS) \ + --dllname getting_started5.pyd \ + --def getting_started5.def \ + $(OBJ) getting_started5.o $(PYLIB) + +passing_char.pyd: $(OBJ) passing_char.o + dllwrap $(DLLWRAPOPTS) \ + --dllname passing_char.pyd \ + --def passing_char.def \ + $(OBJ) passing_char.o $(PYLIB) + +cmplx.pyd: $(OBJ) cmplx.o + dllwrap $(DLLWRAPOPTS) \ + --dllname cmplx.pyd \ + --def cmplx.def \ + $(OBJ) cmplx.o $(PYLIB) + +noncopyable_export.pyd: $(OBJ) noncopyable_export.o + dllwrap $(DLLWRAPOPTS) \ + --dllname noncopyable_export.pyd \ + --def noncopyable_export.def \ + $(OBJ) noncopyable_export.o $(PYLIB) + +noncopyable_import.pyd: $(OBJ) noncopyable_import.o + dllwrap $(DLLWRAPOPTS) \ + --dllname noncopyable_import.pyd \ + --def noncopyable_import.def \ + $(OBJ) noncopyable_import.o $(PYLIB) + +ivect.cpp: ivect.h dvect.h +ivect.pyd: $(OBJ) ivect.o + dllwrap $(DLLWRAPOPTS) \ + --dllname ivect.pyd \ + --def ivect.def \ + $(OBJ) ivect.o $(PYLIB) + +dvect.cpp: ivect.h dvect.h +dvect.pyd: $(OBJ) dvect.o + dllwrap $(DLLWRAPOPTS) \ + --dllname dvect.pyd \ + --def dvect.def \ + $(OBJ) dvect.o $(PYLIB) + +.cpp.o: + $(CPP) $(CPPOPTS) -c $*.cpp + +test: + $(PYEXE) comprehensive.py + $(PYEXE) test_abstract.py + $(PYEXE) test_getting_started1.py + $(PYEXE) test_getting_started2.py + $(PYEXE) test_getting_started3.py + $(PYEXE) test_getting_started4.py + $(PYEXE) test_getting_started5.py + +clean: + rm -f $(OBJ) libbpl.a libbpl.a.input + rm -f comprehensive.o test.pyd + rm -f abstract.o abstract.pyd + rm -f getting_started1.o getting_started1.pyd + rm -f getting_started2.o getting_started2.pyd + rm -f getting_started3.o getting_started3.pyd + rm -f getting_started4.o getting_started4.pyd + rm -f getting_started5.o getting_started5.pyd + rm -f passing_char.o passing_char.pyd + rm -f cmplx.o cmplx.pyd + rm -f noncopyable_export.o noncopyable_export.pyd + rm -f noncopyable_import.o noncopyable_import.pyd + rm -f ivect.o ivect.pyd + rm -f dvect.o dvect.pyd + rm -f so_locations *.pyc + rm -rf cxx_repository