Adaptions to compile Win32 on CLI (native XP or Wine)
authorSven-Ola Tuecke <sven-ola@gmx.de>
Sat, 5 Jul 2008 00:04:23 +0000 (02:04 +0200)
committerSven-Ola Tuecke <sven-ola@gmx.de>
Sat, 5 Jul 2008 00:04:23 +0000 (02:04 +0200)
Makefile
lib/Makefile [deleted file]
make/Makefile.win32

index 20b6a3f..ca5a1ed 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ default_target: $(EXENAME)
 $(EXENAME):    $(OBJS) src/builddata.o
                $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
-cfgparser:     $(CFGDEPS)
+cfgparser:     $(CFGDEPS) src/builddata.o
                $(MAKE) -C $(CFGDIR)
 
 switch:                
@@ -87,6 +87,10 @@ clean:
        -rm -f $(OBJS) $(SRCS:%.c=%.d) $(EXENAME) $(EXENAME).exe src/builddata.c $(TMPFILES)
 ifeq ($(OS), win32)
        -rm -f libolsrd.a
+       -rm -f gui/win32/Main/olsrd_cfgparser.lib
+       -rm -f olsr-setup.exe
+       -rm -fr gui/win32/Main/Release
+       -rm -fr gui/win32/Shim/Release
 endif
 
 uberclean:     clean clean_libs
@@ -136,14 +140,33 @@ rpm:
 # PLUGINS
 #
 
-libs: 
-               $(MAKECMD) -C lib LIBDIR=$(LIBDIR)
+# This is quite ugly but at least it works
+ifeq ($(OS),linux)
+SUBDIRS = $(notdir $(shell find lib -maxdepth 2 -name Makefile -not -path lib/Makefile -printf "%h\n"|sort))
+else
+ifeq ($(OS),win32)
+SUBDIRS := dot_draw httpinfo mini pgraph secure txtinfo
+else
+SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo
+endif
+endif
+
+libs:
+               set -e;for dir in $(SUBDIRS);do $(MAKECMD) -C lib/$$dir LIBDIR=$(LIBDIR);done
 
 libs_clean clean_libs:
-               $(MAKECMD) -C lib LIBDIR=$(LIBDIR) clean
+               -for dir in $(SUBDIRS);do $(MAKECMD) -C lib/$$dir LIBDIR=$(LIBDIR) clean;done
+ifeq ($(OS), win32)
+               -rm -f lib/pgraph/olsrd_pgraph.dll
+               -rm -f lib/txtinfo/olsrd_txtinfo.dll
+               -rm -f lib/httpinfo/olsrd_httpinfo.dll
+               -rm -f lib/secure/olsrd_secure.dll
+               -rm -f lib/dot_draw/olsrd_dot_draw.dll
+               -rm -f lib/mini/olsrd_mini.dll
+endif
 
 libs_install install_libs:
-               $(MAKECMD) -C lib LIBDIR=$(LIBDIR) install
+               set -e;for dir in $(SUBDIRS);do $(MAKECMD) -C lib/$$dir LIBDIR=$(LIBDIR) install;done
 
 httpinfo:
                $(MAKECMD) -C lib/httpinfo clean
diff --git a/lib/Makefile b/lib/Makefile
deleted file mode 100644 (file)
index 0b0dc71..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# This is quite ugly but at least it works
-ifeq ($(OS),linux)
-SUBDIRS := $(shell find -maxdepth 2 -name Makefile -not -path ./Makefile -printf "%h\n")
-else
-ifeq ($(OS),win32)
-SUBDIRS := bmf dot_draw httpinfo mini pgraph secure txtinfo
-else
-SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo
-endif
-endif
-
-.PHONY: $(SUBDIRS)
-
-all: $(SUBDIRS)
-clean: $(SUBDIRS)
-install: $(SUBDIRS)
-
-$(SUBDIRS):
-       $(MAKE) OS=$(OS) -C $@ $(MAKECMDGOALS)
index a04121e..0dc9a65 100644 (file)
@@ -26,88 +26,77 @@ OS_LIB_PTHREAD =
 OS_CFLAG_PTHREAD =
 OS_LIB_DYNLOAD =
 
+PROGDIR = c:/Programme
+PROGCYG = /cygdrive/c/Programme
+PSDKDIR = $(PROGDIR)/Microsoft SDK
+PSDKCYG = $(PROGCYG)/Microsoft\ SDK
+MSVCDIR = $(PROGDIR)/Microsoft Visual Studio
+MSVCCYG = $(PROGCYG)/Microsoft\ Visual\ Studio
+NSISDIR = $(PROGDIR)/NSIS
+NSISCYG = $(PROGCYG)/NSIS
+
+# Necessary for running cygwin under wine. Both the "-C" option and MAKELEVEL 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 $@)
+               $(MSVCCYG)/VC98/Bin/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
+               $(MSVCCYG)/VC98/Bin/LINK.EXE \
+                       /LIBPATH:"$(PSDKDIR)/Lib" /LIBPATH:"$(MSVCDIR)/VC98/Lib" \
+                       kernel32.lib user32.lib \
+                       /nologo /subsystem:console /incremental:no /machine:I386 /out:"$@" "$^"
+
+WIN32FILES+=Frontend
+WIN32FILES+=FrontendDlg
+WIN32FILES+=HnaEntry
+WIN32FILES+=MidEntry
+WIN32FILES+=MprEntry
+WIN32FILES+=MyDialog1
+WIN32FILES+=MyDialog2
+WIN32FILES+=MyDialog3
+WIN32FILES+=MyDialog4
+WIN32FILES+=MyEdit
+WIN32FILES+=MyTabCtrl
+WIN32FILES+=NodeEntry
+WIN32FILES+=StdAfx
+WIN32FILES+=TrayIcon
+
+WIN32CPPFILES=$(addprefix gui/win32/Main/, $(addsuffix .cpp,  $(WIN32FILES)))
+WIN32OBJFILES=$(addprefix gui/win32/Main/Release/, $(addsuffix .obj,  $(WIN32FILES)))
+
+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 $<
+
+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 \
+                       /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 \
+                       /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 $<
+
 win32lib: gui/win32/Main/olsrd_cfgparser.lib
 
 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
-               lib /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
-
-olsr-$(VERS).zip: gui/win32/release/Main.exe \
-               gui/win32/release/Shim.exe \
-               olsrd.exe \
-               olsr_switch.exe \
-               src/cfgparser/olsrd_cfgparser.dll \
-               README \
-               README-Link-Quality.html \
-               README-Link-Quality-Fish-Eye.txt \
-               README-Olsr-Switch.html \
-               gui/win32/Inst/linux-manual.txt \
-               files/olsrd.conf.win32.rfc \
-               files/olsrd.conf.win32.lq \
-               gui/win32/Main/RFC-Default.olsr \
-               gui/win32/Main/LQ-Default.olsr \
-               lib/dot_draw/olsrd_dot_draw.dll \
-               lib/httpinfo/olsrd_httpinfo.dll
-               $(STRIP) olsrd.exe
-               $(STRIP) olsr_switch.exe
-               $(STRIP) src/cfgparser/olsrd_cfgparser.dll
-               $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
-               $(STRIP) lib/httpinfo/olsrd_httpinfo.dll
-               rm -rf $(TEMP)/olsr-$(VERS)
-               rm -f $(TEMP)/olsr-$(VERS).zip
-               rm -f olsr-$(VERS).zip
-               mkdir $(TEMP)/olsr-$(VERS)
-               cp gui/win32/release/Main.exe $(TEMP)/olsr-$(VERS)/Switch.exe
-               cp gui/win32/release/Shim.exe $(TEMP)/olsr-$(VERS)
-               cp olsrd.exe $(TEMP)/olsr-$(VERS)
-               cp olsr_switch.exe $(TEMP)/olsr-$(VERS)
-               cp src/cfgparser/olsrd_cfgparser.dll $(TEMP)/olsr-$(VERS)
-               cp README $(TEMP)/olsr-$(VERS)
-               cp README-Link-Quality.html $(TEMP)/olsr-$(VERS)
-               cp README-Link-Quality-Fish-Eye.txt $(TEMP)/olsr-$(VERS)
-               cp README-Olsr-Switch.html $(TEMP)/olsr-$(VERS)
-               cp gui/win32/Inst/linux-manual.txt $(TEMP)/olsr-$(VERS)
-               cp files/olsrd.conf.win32.rfc $(TEMP)/olsr-$(VERS)/olsrd.conf.rfc
-               cp files/olsrd.conf.win32.lq $(TEMP)/olsr-$(VERS)/olsrd.conf.lq
-               cp gui/win32/Main/RFC-Default.olsr $(TEMP)/olsr-$(VERS)
-               cp gui/win32/Main/LQ-Default.olsr $(TEMP)/olsr-$(VERS)/Default.olsr
-               cp lib/dot_draw/olsrd_dot_draw.dll $(TEMP)/olsr-$(VERS)
-               cp lib/httpinfo/olsrd_httpinfo.dll $(TEMP)/olsr-$(VERS)
-               echo y | cacls $(TEMP)\olsr-$(VERS) /T /G Everyone:F
-               cd "$(TEMP)"; zip -q -r olsr-$(VERS).zip olsr-$(VERS)
-               cp $(TEMP)/olsr-$(VERS).zip .
-               rm -rf $(TEMP)/olsr-$(VERS)
-               rm -f $(TEMP)/olsr-$(VERS).zip
-
-olsr-$(VERS)-setup.exe:        gui/win32/release/Main.exe \
-               gui/win32/release/Shim.exe \
-               olsrd.exe \
-               olsr_switch.exe \
-               src/cfgparser/olsrd_cfgparser.dll \
-               README \
-               README-Link-Quality.html \
-               README-Link-Quality-Fish-Eye.txt \
-               README-Olsr-Switch.html \
-               gui/win32/Inst/linux-manual.txt \
-               files/olsrd.conf.win32.rfc \
-               files/olsrd.conf.win32.lq \
-               gui/win32/Main/RFC-Default.olsr \
-               gui/win32/Main/LQ-Default.olsr \
-               lib/dot_draw/olsrd_dot_draw.dll \
-               lib/httpinfo/olsrd_httpinfo.dll \
-               gui/win32/Inst/installer.nsi
-               $(STRIP) olsrd.exe
-               $(STRIP) olsr_switch.exe
-               $(STRIP) src/cfgparser/olsrd_cfgparser.dll
-               $(STRIP) lib/dot_draw/olsrd_dot_draw.dll
-               $(STRIP) lib/nameservice/olsrd_nameservice.dll
-               $(STRIP) lib/httpinfo/olsrd_httpinfo.dll
-               rm -f olsr-setup.exe
-               rm -f olsr-$(VERS)-setup.exe
-               C:/Program\ Files/NSIS/makensis gui\win32\Inst\installer.nsi
-               mv olsr-setup.exe olsr-$(VERS)-setup.exe
+               $(MSVCCYG)/VC98/Bin/LIB.EXE /machine:i386 /def:src/cfgparser/olsrd_cfgparser.def /out:gui/win32/Main/olsrd_cfgparser.lib
 
 # Local Variables:
 # mode: makefile