merged with tip
[olsrd.git] / make / Makefile.win32
index 0dc9a65..946939d 100644 (file)
@@ -26,6 +26,39 @@ OS_LIB_PTHREAD =
 OS_CFLAG_PTHREAD =
 OS_LIB_DYNLOAD =
 
 OS_CFLAG_PTHREAD =
 OS_LIB_DYNLOAD =
 
+# Notes for compiling olsrd under Windows
+# ---------------------------------------
+# You need at least Cygwin installed. Start the Cygwin setup and select
+# flex,bison,make,mingw-core. Then run "make all libs" to compile olsrd.exe
+# and the plugin DLLs. To compile the GUI, you need MSVC6, PlatformSDK and
+# the NSIS installer. Adapt the path names below and run "make win32setup".
+# Alternatively, set environment vars e.g. in the Windows registry under
+# HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment e.g.
+#
+# set PATH=C:\PROGRA~1\MICROS~4\VC98\BIN;C:\PROGRA~1\MIFD68~1\BIN;C:\PROGRA~1\NSIS;%PATH%
+# set LIB=C:\PROGRA~1\MIFD68~1\LIB;C:\PROGRA~1\MICROS~4\VC98\LIB;C:\PROGRA~1\MICROS~4\VC98\MFC\LIB
+# set INCLUDE=C:\PROGRA~1\MIFD68~1\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\MFC\INCLUDE
+#
+# You can install Cygwin under Wine. Then "wineconsole make all libs win32lib"
+# does it's job (slowly), but there may be issues while re-invoking MSVC from
+# bash.exe during "wineconsole win32setup". Note, that Wine on EXT2/EXT3 prevents
+# the Cygwin "!<symlink>" files from working somehow. You may need to install Cygwin
+# under Windows to get a correct gcc/mingw setup, then copy to your Linux
+# box, then replace all "!<symlink>" files by real symlinks, e.g.
+#
+# cd ~/.wine/drive_c/Programme/cygwin
+# for src in $(grep '!<symlink>' . -rl 2>&-);do
+#  if [ $(stat -c "%s" $src) -lt 100 ];then
+#   dst=$(sed -e's/^\!<symlink>//' $src)
+#   echo "ln -sf $dst $src"
+#  fi
+# done
+#
+# Required software versions:
+# MSVC6 GUI (with MFC!) runs under Wine (copy MFC42.DLL & MSVCP60.DLL)
+# Platform SDK, search for "February 2003 SDK"
+# Cygwin 1.5.x and Wine-1.1.0 or above
+
 PROGDIR = c:/Programme
 PROGCYG = /cygdrive/c/Programme
 PSDKDIR = $(PROGDIR)/Microsoft SDK
 PROGDIR = c:/Programme
 PROGCYG = /cygdrive/c/Programme
 PSDKDIR = $(PROGDIR)/Microsoft SDK
@@ -35,18 +68,18 @@ MSVCCYG = $(PROGCYG)/Microsoft\ Visual\ Studio
 NSISDIR = $(PROGDIR)/NSIS
 NSISCYG = $(PROGCYG)/NSIS
 
 NSISDIR = $(PROGDIR)/NSIS
 NSISCYG = $(PROGCYG)/NSIS
 
-# Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL will oops...
+# Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL>0 will oops...
 MAKE := sh -c 'cmd=$$0;while [ 0 -lt $$\# ];do case $$1 in -C) cmd="cd $$2 && $$cmd";shift 2;; *) cmd="$$cmd \"$$1\"";shift;;esac;done;sh -c "export MAKELEVEL=0 && $$cmd"' $(MAKE)
 
 gui/win32/Shim/Release/shim.obj: gui/win32/Shim/shim.c
                test -d $(dir $@) || mkdir -p $(dir $@)
 MAKE := sh -c 'cmd=$$0;while [ 0 -lt $$\# ];do case $$1 in -C) cmd="cd $$2 && $$cmd";shift 2;; *) cmd="$$cmd \"$$1\"";shift;;esac;done;sh -c "export MAKELEVEL=0 && $$cmd"' $(MAKE)
 
 gui/win32/Shim/Release/shim.obj: gui/win32/Shim/shim.c
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(MSVCCYG)/VC98/Bin/CL.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" \
                        /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
                        /Fp"$(dir $@)/Shim.pch" /YX /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c "$<"
 
 gui/win32/Shim/Release/Shim.exe: gui/win32/Shim/Release/shim.obj
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" \
                        /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
                        /Fp"$(dir $@)/Shim.pch" /YX /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c "$<"
 
 gui/win32/Shim/Release/Shim.exe: gui/win32/Shim/Release/shim.obj
-               $(MSVCCYG)/VC98/Bin/LINK.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" \
                        kernel32.lib user32.lib \
                        /nologo /subsystem:console /incremental:no /machine:I386 /out:"$@" "$^"
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" \
                        kernel32.lib user32.lib \
                        /nologo /subsystem:console /incremental:no /machine:I386 /out:"$@" "$^"
@@ -71,24 +104,25 @@ WIN32OBJFILES=$(addprefix gui/win32/Main/Release/, $(addsuffix .obj,  $(WIN32FIL
 
 gui/win32/Main/Release/Frontend.res: gui/win32/Main/Frontend.rc
                test -d $(dir $@) || mkdir -p $(dir $@)
 
 gui/win32/Main/Release/Frontend.res: gui/win32/Main/Frontend.rc
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(PSDKCYG)/Bin/RC.Exe /l 0x407 /i"$(PSDKDIR)/Include" /i"$(MSVCDIR)/VC98/MFC/Include" /fo"$@" /d NDEBUG $<
+               PATH=$(PSDKCYG)/Bin:$(MSVCCYG)/Common/MSDev98/Bin:$$PATH && RC.EXE \
+                       /l 0x407 /i"$(PSDKDIR)/Include" /i"$(MSVCDIR)/VC98/MFC/Include" /fo"$@" /d NDEBUG "$<"
 
 gui/win32/Main/Release/Switch.exe: gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res $(WIN32CPPFILES)
                test -d $(dir $@) || mkdir -p $(dir $@)
 
 gui/win32/Main/Release/Switch.exe: gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res $(WIN32CPPFILES)
                test -d $(dir $@) || mkdir -p $(dir $@)
-               $(MSVCCYG)/VC98/Bin/CL.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" /I"$(MSVCDIR)/VC98/MFC/Include" /I"src" \
                        /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" \
                        /Fp"$(dir $@)/Frontend.pch" /YX"stdafx.h" /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c \
                        $(WIN32CPPFILES)
                        /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" /I"$(MSVCDIR)/VC98/MFC/Include" /I"src" \
                        /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" \
                        /Fp"$(dir $@)/Frontend.pch" /YX"stdafx.h" /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c \
                        $(WIN32CPPFILES)
-               $(MSVCCYG)/VC98/Bin/LINK.EXE \
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" /LIBPATH:"$(MSVCDIR)/VC98/MFC/Lib" \
                        ws2_32.lib iphlpapi.lib \
                        gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res \
                        /nologo /subsystem:windows /incremental:no /machine:I386 /out:"$@" \
                        $(WIN32OBJFILES)
 
                        /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" /LIBPATH:"$(MSVCDIR)/VC98/MFC/Lib" \
                        ws2_32.lib iphlpapi.lib \
                        gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res \
                        /nologo /subsystem:windows /incremental:no /machine:I386 /out:"$@" \
                        $(WIN32OBJFILES)
 
-win32setup: gui/win32/Inst/installer.nsi gui/win32/Shim/Release/Shim.exe gui/win32/Main/Release/Switch.exe
-               $(NSISCYG)/makensis.exe $<
+win32setup: gui/win32/Inst/installer.nsi default_target libs gui/win32/Shim/Release/Shim.exe gui/win32/Main/Release/Switch.exe
+               PATH=$(NSISCYG):$$PATH && makensis.exe $<
 
 win32lib: gui/win32/Main/olsrd_cfgparser.lib
 
 
 win32lib: gui/win32/Main/olsrd_cfgparser.lib
 
@@ -96,7 +130,8 @@ gui/win32/Main/olsrd_cfgparser.lib: cfgparser
                @# Using the cygwin dlltool does not work (missing functions hooks)
                @# dlltool --input-def src/cfgparser/olsrd_cfgparser.def --dllname src/cfgparser/olsrd_cfgparser.dll --output-lib $@
                @# Use the Microsoft Lib Tool instead
                @# Using the cygwin dlltool does not work (missing functions hooks)
                @# dlltool --input-def src/cfgparser/olsrd_cfgparser.def --dllname src/cfgparser/olsrd_cfgparser.dll --output-lib $@
                @# Use the Microsoft Lib Tool instead
-               $(MSVCCYG)/VC98/Bin/LIB.EXE /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
+               PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LIB.EXE \
+                       /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
 
 # Local Variables:
 # mode: makefile
 
 # Local Variables:
 # mode: makefile