merged with tip
[olsrd.git] / make / Makefile.win32
1 #
2 # WINDOWS32 SPECIFIC CONFIGURATION
3 #
4
5 DESTDIR ?=
6 EXENAME = olsrd.exe
7
8 SRCS +=         $(wildcard src/win32/*.c)
9 HDRS +=         $(wildcard src/win32/*.h)
10
11 CPPFLAGS +=     -DWIN32 -D_WIN32_WINNT=0x0600
12 LIBS +=         -mno-cygwin -lws2_32 -liphlpapi
13 CPPFLAGS +=     -I$(TOPDIR)/src/win32
14 CFLAGS +=       -mno-cygwin
15
16 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).dll
17 INSTALL_LIB =   cp $(PLUGIN_FULLNAME) ../..
18
19 ifdef OLSRD_PLUGIN
20 LDFLAGS +=      -L$(TOPDIR)
21 #LIBS +=        $(TOPDIR)/src/win32/compat.o
22 LIBS +=         -lolsrd
23 endif
24
25 OS_LIB_PTHREAD =
26 OS_CFLAG_PTHREAD =
27 OS_LIB_DYNLOAD =
28
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.
37 #
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
41 #
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.
48 #
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"
54 #  fi
55 # done
56 #
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
61
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
70
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)
73
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 "$<"
80
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:"$@" "$^"
86
87 WIN32FILES+=Frontend
88 WIN32FILES+=FrontendDlg
89 WIN32FILES+=HnaEntry
90 WIN32FILES+=MidEntry
91 WIN32FILES+=MprEntry
92 WIN32FILES+=MyDialog1
93 WIN32FILES+=MyDialog2
94 WIN32FILES+=MyDialog3
95 WIN32FILES+=MyDialog4
96 WIN32FILES+=MyEdit
97 WIN32FILES+=MyTabCtrl
98 WIN32FILES+=NodeEntry
99 WIN32FILES+=StdAfx
100 WIN32FILES+=TrayIcon
101
102 WIN32CPPFILES=$(addprefix gui/win32/Main/, $(addsuffix .cpp,  $(WIN32FILES)))
103 WIN32OBJFILES=$(addprefix gui/win32/Main/Release/, $(addsuffix .obj,  $(WIN32FILES)))
104
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 "$<"
109
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 \
116                         $(WIN32CPPFILES)
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:"$@" \
122                         $(WIN32OBJFILES)
123
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 $<
126
127 win32lib: gui/win32/Main/olsrd_cfgparser.lib
128
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
135
136 # Local Variables:
137 # mode: makefile
138 # End: