From e94e4ce0687689ba6ada39dcc38dad682239fbf7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 22 Aug 2004 10:37:00 +0000 Subject: [PATCH] new makefiles --- dlls/dod2/dodfun/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/dod2/dodx/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/fakemeta/Makefile.pl | 181 +++++++++++++++++++++++++++++++++++ dlls/geoip/GeoIP.c | 2 + dlls/geoip/Makefile | 6 +- dlls/geoip/Makefile.pl | 177 ++++++++++++++++++++++++++++++++++ dlls/geoip/geoip_amxx.h | 4 +- dlls/ns/ns/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/pgsql/Makefile | 12 +-- dlls/pgsql/pgsql_amx.cpp | 8 +- dlls/sockets/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/tfc/tfcx/Makefile | 9 +- dlls/tfc/tfcx/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/ts/tsx/Makefile.pl | 176 ++++++++++++++++++++++++++++++++++ dlls/ts/tsx/makefile | 9 +- 15 files changed, 1440 insertions(+), 24 deletions(-) create mode 100755 dlls/dod2/dodfun/Makefile.pl create mode 100755 dlls/dod2/dodx/Makefile.pl create mode 100755 dlls/fakemeta/Makefile.pl create mode 100755 dlls/geoip/Makefile.pl create mode 100755 dlls/ns/ns/Makefile.pl create mode 100755 dlls/sockets/Makefile.pl create mode 100755 dlls/tfc/tfcx/Makefile.pl create mode 100755 dlls/ts/tsx/Makefile.pl diff --git a/dlls/dod2/dodfun/Makefile.pl b/dlls/dod2/dodfun/Makefile.pl new file mode 100755 index 00000000..0b3cf811 --- /dev/null +++ b/dlls/dod2/dodfun/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "dodfun_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("CMisc.cpp", "NPD.cpp", "NBase.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/dod2/dodx/Makefile.pl b/dlls/dod2/dodx/Makefile.pl new file mode 100755 index 00000000..9b1066e4 --- /dev/null +++ b/dlls/dod2/dodx/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "dodx_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("CMisc.cpp", "CRank.cpp", "NBase.cpp", "NRank.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/fakemeta/Makefile.pl b/dlls/fakemeta/Makefile.pl new file mode 100755 index 00000000..ab46ac7a --- /dev/null +++ b/dlls/fakemeta/Makefile.pl @@ -0,0 +1,181 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "fakemeta_amxx"; +$sdk = "../../hlsdk/SourceCode"; +$mm = "../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("dllfunc.cpp", "fakemeta_amxx.cpp", "forward.cpp", "pdata.cpp", "pev.cpp", "engfunc.cpp", "sdk/amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/sdk/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} +if (!(-d "$outdir/sdk")) +{ + mkdir("$outdir/sdk"); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/geoip/GeoIP.c b/dlls/geoip/GeoIP.c index 182a137f..86cc3de7 100755 --- a/dlls/geoip/GeoIP.c +++ b/dlls/geoip/GeoIP.c @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define GEOIPDATADIR "" + #include "GeoIP.h" #include diff --git a/dlls/geoip/Makefile b/dlls/geoip/Makefile index d733ad25..86adad56 100755 --- a/dlls/geoip/Makefile +++ b/dlls/geoip/Makefile @@ -3,10 +3,10 @@ SRCFILES = GeoIP.c amxxmodule.cpp geoip_amxx.cpp EXTRA_LIBS_LINUX = EXTRA_LIBS_WIN32 = -EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux +EXTRA_LIBDIRS_LINUX = -Llib EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32 -EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx +EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx -Igeolib/libGeoIP EXTRA_FLAGS = -Dstrcmpi=strcasecmp @@ -65,7 +65,7 @@ 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 -lstdc++ -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@ +LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -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 diff --git a/dlls/geoip/Makefile.pl b/dlls/geoip/Makefile.pl new file mode 100755 index 00000000..99983e8a --- /dev/null +++ b/dlls/geoip/Makefile.pl @@ -0,0 +1,177 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "geoip_amxx"; +$sdk = "../../hlsdk/SourceCode"; +$mm = "../../metamod/metamod"; +$geoip = "geolib/libGeoIP"; + +@CPP_SOURCE_FILES = ("geoip_amxx.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = ("GeoIP.c"); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls -I$geoip"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/geoip/geoip_amxx.h b/dlls/geoip/geoip_amxx.h index 61a2418b..c5b78281 100755 --- a/dlls/geoip/geoip_amxx.h +++ b/dlls/geoip/geoip_amxx.h @@ -1,9 +1,11 @@ #ifndef _INCLUDE_GEOIPAMXX_H #define _INCLUDE_GEOIPAMXX_H +#define GEOIPDATADIR "" + #include #include "amxxmodule.h" extern AMX_NATIVE_INFO geoip_natives[]; -#endif //_INCLUDE_GEOIPAMXX_H \ No newline at end of file +#endif //_INCLUDE_GEOIPAMXX_H diff --git a/dlls/ns/ns/Makefile.pl b/dlls/ns/ns/Makefile.pl new file mode 100755 index 00000000..ead61eb9 --- /dev/null +++ b/dlls/ns/ns/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "ns_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CPlayer.cpp", "CSpawn.cpp", "NMisc.cpp", "NPData.cpp", "hookedfunctions.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/pgsql/Makefile b/dlls/pgsql/Makefile index 71d44010..e16a3d7e 100755 --- a/dlls/pgsql/Makefile +++ b/dlls/pgsql/Makefile @@ -1,17 +1,17 @@ -MODNAME = pgsql_amx -SRCFILES = pgsql_amx.cpp +MODNAME = pgsql_amxx +SRCFILES = pgsql_amx.cpp pgsql.cpp amxxmodule.cpp -EXTRA_LIBS_LINUX = lib/libpq.a -lpq libz.a -lz -lcrypt +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 -Ipostgresql-7.4.2/src/include -Ipostgresql-7.4.2/src/interfaces/libpq +EXTRA_INCLUDEDIRS = -Iextra/include -I../../amxmodx -Ipostgresql-7.4.3/src/include -Ipostgresql-7.4.3/src/interfaces/libpq EXTRA_FLAGS = -Dstrcmpi=strcasecmp SDKTOP=../../hlsdk -METADIR=../../metamodx/ +METADIR=../../metamod/metamod SDKSRC=$(SDKTOP)/SourceCode OBJDIR_LINUX=obj.linux @@ -53,7 +53,7 @@ endif OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) -#CCOPT = -funroll-loops \ +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 diff --git a/dlls/pgsql/pgsql_amx.cpp b/dlls/pgsql/pgsql_amx.cpp index e160c11c..701dc655 100755 --- a/dlls/pgsql/pgsql_amx.cpp +++ b/dlls/pgsql/pgsql_amx.cpp @@ -88,10 +88,10 @@ void SQL::Disconnect() if (isFree) return; - Host.clear(); - Username.clear(); - Password.clear(); - Database.clear(); + Host.assign(""); + Username.assign(""); + Password.assign(""); + Database.assign(""); PQfinish(cn); diff --git a/dlls/sockets/Makefile.pl b/dlls/sockets/Makefile.pl new file mode 100755 index 00000000..01029efc --- /dev/null +++ b/dlls/sockets/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "sockets_amxx"; +$sdk = "../hlsdk/SourceCode"; +$mm = "../metamod/metamod"; + +@CPP_SOURCE_FILES = ("sockets.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/tfc/tfcx/Makefile b/dlls/tfc/tfcx/Makefile index b3f0cbe2..630059aa 100755 --- a/dlls/tfc/tfcx/Makefile +++ b/dlls/tfc/tfcx/Makefile @@ -10,8 +10,8 @@ EXTRA_INCLUDEDIRS = -Iextra/include EXTRA_FLAGS = -Dstrcmpi=strcasecmp -SDKSRC=../sdk -METADIR=../metamod +SDKSRC=../../../hlsdk/SourceCode +METADIR=../../../metamod/metamod OBJDIR_LINUX=obj.linux OBJDIR_WIN32=obj.win32 @@ -51,9 +51,8 @@ endif OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) -CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ - -malign-jumps=2 -malign-functions=2 -s -DNDEBUG +CCOPT = -march=i386 -O2 -ffast-math -funroll-loops \ + -s -DNDEBUG INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) CFLAGS=-Wall -Wno-unknown-pragmas diff --git a/dlls/tfc/tfcx/Makefile.pl b/dlls/tfc/tfcx/Makefile.pl new file mode 100755 index 00000000..a811ee5f --- /dev/null +++ b/dlls/tfc/tfcx/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "tfcx_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("CMisc.cpp", "CRank.cpp", "NBase.cpp", "NRank.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/ts/tsx/Makefile.pl b/dlls/ts/tsx/Makefile.pl new file mode 100755 index 00000000..df0b1883 --- /dev/null +++ b/dlls/ts/tsx/Makefile.pl @@ -0,0 +1,176 @@ +#!/usr/bin/perl +#(C)2004 AMX Mod X Development Team +# by David "BAILOPAN" Anderson + +# output will occur in bin.x.proc +# where x is debug or opt and proc is ix86 or amd64 +# You must use this script from the project src dir + +#options = +# debug - enable gdb debugging +# amd64 - compile for AMD64 +# proc=ix86 - assumed not amd64 +# clean - clean the specifications above + +$PROJECT = "tsx_amxx"; +$sdk = "../../../hlsdk/SourceCode"; +$mm = "../../../metamod/metamod"; + +@CPP_SOURCE_FILES = ("CMisc.cpp", "CRank.cpp", "NBase.cpp", "NRank.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp"); + +@C_SOURCE_FILES = (); +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\""; + +$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls"; + +while ($cmd = shift) +{ + if ($cmd =~ /amd64/) { + $OPTIONS{"amd64"} = 1; + } elsif ($cmd =~ /debug/) { + $OPTIONS{"debug"} = 1; + } elsif ($cmd =~ /proc=i(\d)86/) { + $proc = $1; + if ($OPTIONS{"amd64"}) + { + die "You cannot compile for i".$proc."86 and AMD64.\n"; + } else { + $OPTIONS{"proc"} = "i".$proc."86"; + } + } elsif ($cmd =~ /clean/) { + $OPTIONS{"clean"} = 1; + } +} + +$gcc = `g++ --version`; +if ($gcc =~ /2\.9/) +{ + $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; +} else { + $OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2"; +} + +if ($OPTIONS{"debug"}) +{ + $cflags = $OPT{"debug"}; +} else { + if (!$OPTIONS{"amd64"}) + { + $proc = $OPTIONS{"proc"}; + if (!$proc) + { + $proc = 3; + } + $cflags = "-march=i".$proc."86 ".$OPT{"opt"}; + } else { + $cflags = $OPT{"opt"}; + } +} + +if ($OPTIONS{"amd64"}) +{ + $cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags"; +} + +if ($OPTIONS{"debug"}) +{ + $outdir = "bin.debug"; +} else { + $outdir = "bin.opt"; +} + +if ($OPTIONS{"amd64"}) +{ + $outdir .= ".amd64"; + $bin = $PROJECT."_amd64.so"; +} else { + $proc = $OPTIONS{"proc"}; + if ($proc) + { + $outdir .= ".i".$proc."86"; + $bin = $PROJECT."_i".$proc."86.so"; + } else { + $outdir .= ".i386"; + $bin = $PROJECT."_i386.so"; + } +} + +if ($OPTIONS{"clean"}) +{ + `rm $outdir/*.o`; + `rm $outdir/$bin`; + die("Project cleaned.\n"); +} + +#create the dirs +#build link list +my @LINK; +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $file =~ s/\.cpp/\.o/; + push(@LINK, $outdir."/".$file); +} +for ($i=0; $i<=$#C_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $file =~ s/\.c/\.o/; + push(@LINK, $outdir."/".$file); +} + +if (!(-d $outdir)) +{ + mkdir($outdir); +} + +$inc = $OPTIONS{"include"}; + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $CPP_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.cpp/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++) +{ + $file = $C_SOURCE_FILES[$i]; + $ofile = $file; + $ofile =~ s/\.c/\.o/; + $ofile = "$outdir/$ofile"; + $gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; + if (-e $ofile) + { + $file_time = (stat($file))[9]; + $ofile_time = (stat($file))[9]; + if ($file_time > $ofile_time) + { + print "$gcc\n"; + `$gcc`; + } + } else { + print "$gcc\n"; + `$gcc`; + } +} + +$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; +`$gcc`; diff --git a/dlls/ts/tsx/makefile b/dlls/ts/tsx/makefile index 1bd86a35..d9ef96f0 100755 --- a/dlls/ts/tsx/makefile +++ b/dlls/ts/tsx/makefile @@ -10,8 +10,8 @@ EXTRA_INCLUDEDIRS = -Iextra/include EXTRA_FLAGS = -Dstrcmpi=strcasecmp -SDKSRC=../sdk -METADIR=../metamod +SDKSRC=../../../hlsdk/SourceCode +METADIR=../../../metamod/metamod OBJDIR_LINUX=obj.linux OBJDIR_WIN32=obj.win32 @@ -51,9 +51,8 @@ endif OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o) OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o) -CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ - -malign-jumps=2 -malign-functions=2 -s -DNDEBUG +CCOPT = -march=i386 -O2 -ffast-math -funroll-loops \ + -s -DNDEBUG INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS) CFLAGS=-Wall -Wno-unknown-pragmas