Makefiles for Linux. Not tested.
This commit is contained in:
parent
8a40ed8cd6
commit
9d4e5b18ee
@ -1,18 +1,17 @@
|
||||
MODNAME = mysql_amxx
|
||||
SRCFILES = mysql.cpp amxxmodule.cpp mysql_amx.cpp
|
||||
MODNAME = sqlite_amxx
|
||||
SRCFILES = sqlite_amx.cpp sqlite.cpp amxxmodule.cpp
|
||||
|
||||
EXTRA_LIBS_LINUX = -lmysqlclient -lz
|
||||
EXTRA_LIBS_WIN32 = extra/lib_win32/libmysqlclient.a extra/lib_win32/libz.a -lws2_32 -lwsock32
|
||||
EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
|
||||
EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
|
||||
EXTRA_LIBS_LINUX = lib/libpq.a -lpq -lz -lcrypt
|
||||
EXTRA_LIBS_WIN32 = libpq.a -lws2_32 -lwsock32
|
||||
EXTRA_LIBDIRS_LINUX = -Llib
|
||||
EXTRA_LIBDIRS_WIN32 = -L
|
||||
|
||||
EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx
|
||||
EXTRA_INCLUDEDIRS = -Iextra/include -I../../amxmodx -Isqlite-source-3_1_2
|
||||
|
||||
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
|
||||
|
||||
SDKTOP=../hlsdk
|
||||
METADIR=../metamod/metamod
|
||||
|
||||
SDKTOP=../../hlsdk
|
||||
METADIR=../../metamod/metamod
|
||||
|
||||
SDKSRC=$(SDKTOP)/SourceCode
|
||||
OBJDIR_LINUX=obj.linux
|
||||
@ -25,7 +24,7 @@ else
|
||||
OS=LINUX
|
||||
endif
|
||||
|
||||
CC_LINUX=gcc
|
||||
CC_LINUX=gcc-2.95
|
||||
ifeq "$(OS)" "WIN32"
|
||||
CC_WIN32=gcc
|
||||
LD_WINDLL=dllwrap
|
||||
@ -57,13 +56,13 @@ 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
|
||||
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 -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
|
||||
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
|
||||
|
@ -12,13 +12,13 @@
|
||||
# proc=ix86 - assumed not amd64
|
||||
# clean - clean the specifications above
|
||||
|
||||
$PROJECT = "mysql_amxx";
|
||||
$PROJECT = "pgsql_amxx";
|
||||
$sdk = "../hlsdk/SourceCode";
|
||||
$mm = "../metamod/metamod";
|
||||
$pg = "extra/src";
|
||||
$gccf = "gcc";
|
||||
$mysql_link = "extra/lib_linux";
|
||||
|
||||
@CPP_SOURCE_FILES = ("mysql.cpp", "mysql_amx.cpp", "amxxmodule.cpp");
|
||||
@CPP_SOURCE_FILES = ("pgsql.cpp", "pgsql_amx.cpp", "amxxmodule.cpp");
|
||||
|
||||
@C_SOURCE_FILES = ();
|
||||
my %OPTIONS, %OPT;
|
||||
@ -26,7 +26,7 @@ my %OPTIONS, %OPT;
|
||||
$OPT{"debug"} = "-g -ggdb";
|
||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||
|
||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls -Iextra/include";
|
||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls -I$pg/include -I$pg/interfaces/libpq -L./lib";
|
||||
|
||||
while ($cmd = shift)
|
||||
{
|
||||
@ -74,7 +74,7 @@ if ($OPTIONS{"debug"})
|
||||
|
||||
if ($OPTIONS{"amd64"})
|
||||
{
|
||||
$cflags = " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||
$cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||
}
|
||||
|
||||
if ($OPTIONS{"debug"})
|
||||
@ -88,7 +88,6 @@ if ($OPTIONS{"amd64"})
|
||||
{
|
||||
$outdir .= ".amd64";
|
||||
$bin = $PROJECT."_amd64.so";
|
||||
$OPTIONS{"include"} .= " -L".$mysql_link."64";
|
||||
} else {
|
||||
$proc = $OPTIONS{"proc"};
|
||||
if ($proc)
|
||||
@ -99,7 +98,6 @@ if ($OPTIONS{"amd64"})
|
||||
$outdir .= ".i386";
|
||||
$bin = $PROJECT."_i386.so";
|
||||
}
|
||||
$OPTIONS{"include"} .= " -L".$mysql_link;
|
||||
}
|
||||
|
||||
unlink("$outdir/$bin");
|
||||
@ -142,7 +140,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||
if (-e $ofile)
|
||||
{
|
||||
$file_time = (stat($file))[9];
|
||||
$ofile_time = (stat($ofile))[9];
|
||||
$ofile_time = (stat($file))[9];
|
||||
if ($file_time > $ofile_time)
|
||||
{
|
||||
print "$gcc\n";
|
||||
@ -164,7 +162,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||
if (-e $ofile)
|
||||
{
|
||||
$file_time = (stat($file))[9];
|
||||
$ofile_time = (stat($ofile))[9];
|
||||
$ofile_time = (stat($file))[9];
|
||||
if ($file_time > $ofile_time)
|
||||
{
|
||||
print "$gcc\n";
|
||||
@ -176,6 +174,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||
}
|
||||
}
|
||||
|
||||
$gcc = "$gccf $cflags $inc -shared -ldl -lm @LINK -lmysqlclient -lz -o $outdir/$bin";
|
||||
$gcc = "$gccf $cflags $inc -shared -ldl -lm @LINK -lpq -lz -lcrypt -o $outdir/$bin";
|
||||
print "$gcc\n";
|
||||
`$gcc`;
|
||||
|
Loading…
Reference in New Issue
Block a user