2 # WINDOWS32 SPECIFIC CONFIGURATION
8 SRCS += $(wildcard src/win32/*.c)
9 HDRS += $(wildcard src/win32/*.h)
11 CPPFLAGS += -DWIN32 -D_WIN32_WINNT=0x0600
12 LIBS += -mno-cygwin -lws2_32 -liphlpapi
13 CPPFLAGS += -I$(TOPDIR)/src/win32
16 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).dll
17 INSTALL_LIB = cp $(PLUGIN_FULLNAME) ../..
20 LDFLAGS += -L$(TOPDIR)
21 #LIBS += $(TOPDIR)/src/win32/compat.o
29 # Notes for compiling olsrd under Windows
30 # ---------------------------------------
31 # You need at least Cygwin installed. Start the Cygwin setup and select
32 # flex,bison,make,mingw-core. Then run "make all libs" to compile olsrd.exe
33 # and the plugin DLLs. To compile the GUI, you need MSVC6, PlatformSDK and
34 # the NSIS installer. Adapt the path names below and run "make win32setup".
35 # Alternatively, set environment vars e.g. in the Windows registry under
36 # HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment e.g.
38 # set PATH=C:\PROGRA~1\MICROS~4\VC98\BIN;C:\PROGRA~1\MIFD68~1\BIN;C:\PROGRA~1\NSIS;%PATH%
39 # set LIB=C:\PROGRA~1\MIFD68~1\LIB;C:\PROGRA~1\MICROS~4\VC98\LIB;C:\PROGRA~1\MICROS~4\VC98\MFC\LIB
40 # set INCLUDE=C:\PROGRA~1\MIFD68~1\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\INCLUDE;C:\PROGRA~1\MICROS~4\VC98\MFC\INCLUDE
42 # You can install Cygwin under Wine. Then "wineconsole make all libs win32lib"
43 # does it's job (slowly), but there may be issues while re-invoking MSVC from
44 # bash.exe during "wineconsole win32setup". Note, that Wine on EXT2/EXT3 prevents
45 # the Cygwin "!<symlink>" files from working somehow. You may need to install Cygwin
46 # under Windows to get a correct gcc/mingw setup, then copy to your Linux
47 # box, then replace all "!<symlink>" files by real symlinks, e.g.
49 # cd ~/.wine/drive_c/Programme/cygwin
50 # for src in $(grep '!<symlink>' . -rl 2>&-);do
51 # if [ $(stat -c "%s" $src) -lt 100 ];then
52 # dst=$(sed -e's/^\!<symlink>//' $src)
53 # echo "ln -sf $dst $src"
57 # Required software versions:
58 # MSVC6 GUI (with MFC!) runs under Wine (copy MFC42.DLL & MSVCP60.DLL)
59 # Platform SDK, search for "February 2003 SDK"
60 # Cygwin 1.5.x and Wine-1.1.0 or above
62 PROGDIR = c:/Programme
63 PROGCYG = /cygdrive/c/Programme
64 PSDKDIR = $(PROGDIR)/Microsoft SDK
65 PSDKCYG = $(PROGCYG)/Microsoft\ SDK
66 MSVCDIR = $(PROGDIR)/Microsoft Visual Studio
67 MSVCCYG = $(PROGCYG)/Microsoft\ Visual\ Studio
68 NSISDIR = $(PROGDIR)/NSIS
69 NSISCYG = $(PROGCYG)/NSIS
71 # Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL>0 will oops...
72 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)
74 gui/win32/Shim/Release/shim.obj: gui/win32/Shim/shim.c
75 test -d $(dir $@) || mkdir -p $(dir $@)
76 PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
77 /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" \
78 /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" \
79 /Fp"$(dir $@)/Shim.pch" /YX /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c "$<"
81 gui/win32/Shim/Release/Shim.exe: gui/win32/Shim/Release/shim.obj
82 PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
83 /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" \
84 kernel32.lib user32.lib \
85 /nologo /subsystem:console /incremental:no /machine:I386 /out:"$@" "$^"
88 WIN32FILES+=FrontendDlg
102 WIN32CPPFILES=$(addprefix gui/win32/Main/, $(addsuffix .cpp, $(WIN32FILES)))
103 WIN32OBJFILES=$(addprefix gui/win32/Main/Release/, $(addsuffix .obj, $(WIN32FILES)))
105 gui/win32/Main/Release/Frontend.res: gui/win32/Main/Frontend.rc
106 test -d $(dir $@) || mkdir -p $(dir $@)
107 PATH=$(PSDKCYG)/Bin:$(MSVCCYG)/Common/MSDev98/Bin:$$PATH && RC.EXE \
108 /l 0x407 /i"$(PSDKDIR)/Include" /i"$(MSVCDIR)/VC98/MFC/Include" /fo"$@" /d NDEBUG "$<"
110 gui/win32/Main/Release/Switch.exe: gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res $(WIN32CPPFILES)
111 test -d $(dir $@) || mkdir -p $(dir $@)
112 PATH=$(MSVCCYG)/VC98/Bin:$$PATH && CL.EXE \
113 /I"$(PSDKDIR)/Include" /I"$(MSVCDIR)/VC98/Include" /I"$(MSVCDIR)/VC98/MFC/Include" /I"src" \
114 /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" \
115 /Fp"$(dir $@)/Frontend.pch" /YX"stdafx.h" /Fo"$(dir $@)/" /Fd"$(dir $@)/" /FD /c \
117 PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LINK.EXE \
118 /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" /LIBPATH:"$(MSVCDIR)/VC98/MFC/Lib" \
119 ws2_32.lib iphlpapi.lib \
120 gui/win32/Main/olsrd_cfgparser.lib gui/win32/Main/Release/Frontend.res \
121 /nologo /subsystem:windows /incremental:no /machine:I386 /out:"$@" \
124 win32setup: gui/win32/Inst/installer.nsi default_target libs gui/win32/Shim/Release/Shim.exe gui/win32/Main/Release/Switch.exe
125 PATH=$(NSISCYG):$$PATH && makensis.exe $<
127 win32lib: gui/win32/Main/olsrd_cfgparser.lib
129 gui/win32/Main/olsrd_cfgparser.lib: cfgparser
130 @# Using the cygwin dlltool does not work (missing functions hooks)
131 @# dlltool --input-def src/cfgparser/olsrd_cfgparser.def --dllname src/cfgparser/olsrd_cfgparser.dll --output-lib $@
132 @# Use the Microsoft Lib Tool instead
133 PATH=$(MSVCCYG)/VC98/Bin:$$PATH && LIB.EXE \
134 /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib