Fixed linux compiling

This commit is contained in:
David Anderson 2005-08-24 07:16:45 +00:00
parent fd8a27013b
commit e2226ae809
4 changed files with 8 additions and 102 deletions

View File

@ -1,95 +0,0 @@
MODNAME = sqlite_amxx
SRCFILES = sqlite_amx.cpp sqlite.cpp amxxmodule.cpp
EXTRA_INCLUDEDIRS = -I../../amxmodx -Isqlite-source-3_2_3
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
SDKTOP=../../hlsdk
METADIR=../../metamod/metamod
SDKSRC=$(SDKTOP)/SourceCode
OBJDIR_LINUX=obj.linux
OBJDIR_WIN32=obj.win32
SRCDIR=.
ifdef windir
OS=WIN32
else
OS=LINUX
endif
CC_LINUX=gcc-2.95
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
DEFAULT=win32
CLEAN=clean_win32
else
CC_WIN32=/usr/local/cross-tools/i386-mingw32msvc/bin/gcc
LD_WINDLL=/usr/local/cross-tools/bin/i386-mingw32msvc-dllwrap
DEFAULT=linux win32
CLEAN=clean_both
endif
LIBFILE_LINUX = $(MODNAME)_i386.so
LIBFILE_WIN32 = $(MODNAME).dll
TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32)
FILES_ALL = *.cpp *.h [A-Z]* *.rc
ifeq "$(OS)" "LINUX"
ASRCFILES := $(shell ls -t $(SRCFILES))
else
ASRCFILES := $(shell dir /b)
endif
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i386 -O2 -s -DNDEBUG
INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
CFLAGS=-Wall -Wno-unknown-pragmas -march=i386
ODEF = -DOPT_TYPE=\"optimized\"
CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS)
DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -lc -lgcc -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_LINUX)
$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_WIN32)
default: $(DEFAULT)
$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX)
$(LINK_LINUX)
$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32)
$(LINK_WIN32)
$(OBJDIR_LINUX):
mkdir $@
$(OBJDIR_WIN32):
mkdir $@
win32: $(TARGET_WIN32)
linux: $(TARGET_LINUX)
clean: $(CLEAN)
clean_both:
-rm -f $(OBJDIR_LINUX)/*
-rm -f $(OBJDIR_WIN32)/*
clean_win32:
del /q $(OBJDIR_WIN32)

View File

@ -20,12 +20,12 @@ $gccf = "gcc";
@CPP_SOURCE_FILES = ("sqlite.cpp", "sqlite_amx.cpp", "amxxmodule.cpp");
@C_SOURCE_FILES = ("$sql/attach.c", "$sql/auth.c", "$sql/btree.c", "$sql/build.c", "$sql/date.c", "$sql/delete.c", "$sql/expr.c", "$sql/func.c", "$sql/hash.c", "$sql/insert.c", "$sql/legacy.c", "$sql/main.c", "$sql/opcodes.c", "$sql/os_unix.c", "$sql/os_win.c", "$sql/pager.c", "$sql/parse.c", "$sql/pragma.c", "$sql/printf.c", "$sql/random.c", "$sql/select.c", "$sql/shell.c", "$sql/table.c", "$sql/tokenize.c", "$sql/trigger.c", "$sql/update.c", "$sql/utf.c", "$sql/util.c", "$sql/vacuum.c", "$sql/vdbe.c", "$sql/vdbeapi.c", "$sql/vdbeaux.c", "$sql/vdbemem.c", "$sql/where.c");
@C_SOURCE_FILES = ("$sql/attach.c", "$sql/auth.c", "$sql/btree.c", "$sql/build.c", "$sql/date.c", "$sql/delete.c", "$sql/func.c", "$sql/hash.c", "$sql/insert.c", "$sql/legacy.c", "$sql/main.c", "$sql/opcodes.c", "$sql/os_unix.c", "$sql/os_win.c", "$sql/pager.c", "$sql/parse.c", "$sql/pragma.c", "$sql/printf.c", "$sql/random.c", "$sql/select.c", "$sql/shell.c", "$sql/table.c", "$sql/tokenize.c", "$sql/trigger.c", "$sql/update.c", "$sql/utf.c", "$sql/util.c", "$sql/vacuum.c", "$sql/vdbe.c", "$sql/vdbeapi.c", "$sql/vdbeaux.c", "$sql/vdbemem.c", "$sql/where.c", "$sql/prepare.c", "$sql/expr.c", "$sql/callback.c", "$sql/alter.c", "$sql/vdbefifo.c", "$sql/complete.c", "$sql/analyze.c");
my %OPTIONS, %OPT;
$OPT{"debug"} = "-DNO_TCL -g -ggdb";
$OPT{"opt"} = "-DNO_TCL -O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
$OPT{"opt"} = "-DNO_TCL -O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls -I$sql";
@ -71,7 +71,7 @@ if ($OPTIONS{"debug"})
} else {
$cflags = $OPT{"opt"};
}
}
}
if ($OPTIONS{"amd64"})
{
@ -141,7 +141,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
$ofile = $file;
$ofile =~ s/\.cpp/\.o/;
$ofile = "$outdir/$ofile";
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
$gcc = "$gccf $cflags -fno-rtti -fno-exceptions -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
@ -179,6 +179,6 @@ for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
}
}
$gcc = "$gccf $cflags $inc -shared -ldl -lm @LINK -lz -lcrypt -o $outdir/$bin";
$gcc = "$gccf $cflags $inc -shared -static-libgcc -ldl -lm @LINK -lz -lcrypt -o $outdir/$bin";
print "$gcc\n";
`$gcc`;

View File

@ -5,7 +5,7 @@
// Module info
#define MODULE_NAME "Sqlite"
#define MODULE_VERSION "1.50"
#define MODULE_VERSION "1.55"
#define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "SQLITE"

View File

@ -262,4 +262,5 @@ unsigned int SQLResult::NumRows()
}
#if defined _DEBUG
unsigned int SQLResult::latestStoredResultId = 0;
#endif
#endif