PWD = `pwd`
PLATFORM = generic
+PLATFORM_IDENT = NOT_WINDOWS
PREFIX = /usr/local
MODULE = ./Module
cc -o $@ ./Tool/itworks.c
./Server:: ./Common ./Tool/option ./Tool/genconf ./Tool/itworks
- $(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../`" EXTLIBS="`./Tool/option libs ../`" EXTCFLAGS="`./Tool/option cflags ../`" EXTLDFLAGS="`./Tool/option ldflags ../`"
+ $(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../`" EXTLIBS="`./Tool/option libs ../ $(PLATFORM_IDENT)`" EXTCFLAGS="`./Tool/option cflags ../`" EXTLDFLAGS="`./Tool/option ldflags ../`"
./Module:: ./Common
$(MAKE) -C $@ $(FLAGS)
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = ../bcc.sh
AR = tlib
AR_FLAGS =
AR_PROC = grep -Eo "[^ ]+" | xargs -I {} echo + {}
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -fPIC
LDFLAGS =
-LIBS = -lws2_32
+LIBS =
EXEC =
STATIC = lib
LIBSUF = .dll
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = ../vc6.sh
AR = lib
AR_FLAGS = /nologo /out:
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -fPIC
LDFLAGS =
-LIBS = -lws2_32 -ladvapi32 -llibcmt
+LIBS = -ladvapi32 -llibcmt
EXEC =
STATIC = lib
LIBSUF = .dll
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS_WATCOM
CC = owcc
AR = wlib
AR_FLAGS = -q -b -n -fo
CFLAGS = -b nt$(END) -I $(WATCOM)/h/nt -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -fPIC
LDFLAGS = -b nt$(END)
-LIBS = ws2_32.lib
+LIBS =
EXEC = .exe
STATIC = lib
LIBSUF = .dll
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = i686-w64-mingw32-gcc
AR = i686-w64-mingw32-ar
WINDRES = i686-w64-mingw32-windres
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC -DSERVICE -mwindows
LDFLAGS = -mwindows
-LIBS = -lws2_32
+LIBS =
EXEC = .exe
LIBSUF = .dll
PREOBJS = tewi.res
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = i686-w64-mingw32-gcc
AR = i686-w64-mingw32-ar
WINDRES = i686-w64-mingw32-windres
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC
LDFLAGS =
-LIBS = -lws2_32
+LIBS =
EXEC = .exe
LIBSUF = .dll
PREOBJS = tewi.res
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = x86_64-w64-mingw32-gcc
AR = x86_64-w64-mingw32-ar
WINDRES = x86_64-w64-mingw32-windres
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC -DSERVICE -mwindows
LDFLAGS = -mwindows
-LIBS = -lws2_32
+LIBS =
EXEC = .exe
LIBSUF = .dll
PREOBJS = tewi.res
PREFIX = C:/Tewi
+PLATFORM_IDENT = WINDOWS
CC = x86_64-w64-mingw32-gcc
AR = x86_64-w64-mingw32-ar
WINDRES = x86_64-w64-mingw32-windres
CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -fPIC
LDFLAGS =
-LIBS = -lws2_32
+LIBS =
EXEC = .exe
LIBSUF = .dll
PREOBJS = tewi.res
#endif
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#ifdef USE_WINSOCK1
+#include <winsock.h>
+#else
#include <winsock2.h>
#endif
+#endif
#include <cm_string.h>
#include <cm_log.h>
#include <string.h>
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
+#ifdef USE_WINSOCK1
+#include <winsock.h>
+#else
#include <winsock2.h>
+#endif
#else
#ifdef USE_POLL
#ifdef __PPU__
#include <ws2tcpip.h>
#include <wspiapi.h>
#endif
+#ifdef USE_WINSOCK1
+#include <winsock.h>
+#else
#include <winsock2.h>
+#endif
#include <process.h>
#include <windows.h>
int i;
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
WSADATA wsa;
+#ifdef USE_WINSOCK1
+ WSAStartup(MAKEWORD(1, 1), &wsa);
+#else
WSAStartup(MAKEWORD(2, 0), &wsa);
+#endif
#endif
for(i = 0; config.ports[i] != -1; i++)
;
#include <stdbool.h>
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
+#ifdef USE_WINSOCK1
+#include <winsock.h>
+#else
#include <winsock2.h>
+#endif
#define NO_IPV6
#else
#ifdef __PPU__
#ifndef NO_SSL
printf("-lssl -lcrypto");
#endif
+ if(strcmp(argv[3], "WINDOWS") == 0){
+#ifdef USE_WINSOCK1
+ printf(" -lwsock32");
+#else
+ printf(" -lws2_32");
+#endif
+ }else if(strcmp(argv[3], "WINDOWS_WATCOM") == 0){
+#ifdef USE_WINSOCK1
+ printf(" wsock32.lib");
+#else
+ printf(" ws2_32.lib");
+#endif
+ }
}
printf("\n");
return 0;
elif [ "`echo "$i" | grep -Eo "^-D"`" = "-D" ]; then
options="$options -`echo "$i" | sed "s/^-//g"`"
elif [ "`echo "$i" | grep -Eo "^-l"`" = "-l" ]; then
- libraries="$libraries `echo "$i" | sed "s/^-l//g"`.lib"
+ if [ ! "$i" = "-lwsock32" ]; then
+ libraries="$libraries `echo "$i" | sed "s/^-l//g"`.lib"
+ fi
elif [ "$dowhat" = "output" ]; then
dowhat=""
outfile="$i"
#define USE_POLL
#define HAS_CHROOT
#undef NO_GETADDRINFO
+#undef USE_WINSOCK1
/* DO NOT EDIT BELOW THIS LINE */
#undef USE_POLL
/* Force select(2) for Windows */
#endif
+#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && defined(USE_WINSOCK1) && !defined(NO_GETADDRINFO)
+#define NO_GETADDRINFO
+/* getaddrinfo is not on winsock 1 */
+#endif
#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && defined(HAS_CHROOT)
#undef HAS_CHROOT