Added linux support

This commit is contained in:
David Anderson 2005-07-27 16:58:18 +00:00
parent 94d3b31f40
commit 0de288139d
4 changed files with 64 additions and 2 deletions

46
compiler/amxxpc/Makefile Executable file
View File

@ -0,0 +1,46 @@
#(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson
### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3
CPP = gcc
BINARY = amxxpc
OBJECTS = amx.cpp amxxpc.cpp
LINK = -lz
INCLUDE = -I. -L.
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS = $(DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -DAMX_ANSIONLY
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
$(MAKE) amxxpc
amxxpc: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -ldl -lm -o$(BIN_DIR)/$(BINARY)
default: all
clean:
rm -rf Release/*.o
rm -rf Release/$(BINARY)
rm -rf Debug/*.o
rm -rf Debug/$(BINARY)

View File

@ -5,6 +5,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <io.h> #include <io.h>
#endif #endif
#include <stdlib.h>
#include "zlib.h" #include "zlib.h"
#include "amx.h" #include "amx.h"
#include "amxxpc.h" #include "amxxpc.h"
@ -39,7 +40,7 @@ int main(int argc, char **argv)
if (!sc32) if (!sc32)
{ {
#ifdef __linux__ #ifdef __linux__
printf("32bit compiler failed to link: %p|%p.\n",sc32, sc_printf); printf("32bit compiler failed to link: %p.\n",sc32);
#else #else
printf("32bit compiler failed to link: %d.\n", GetLastError()); printf("32bit compiler failed to link: %d.\n", GetLastError());
#endif #endif
@ -117,7 +118,7 @@ int main(int argc, char **argv)
if (!sc64) if (!sc64)
{ {
#ifdef __linux__ #ifdef __linux__
sc_printf("64bit compiler failed to link: %s.\n", dlerror()); printf("64bit compiler failed to link: %s.\n", dlerror());
#else #else
printf("64bit compiler failed to link: %d.\n", GetLastError()); printf("64bit compiler failed to link: %d.\n", GetLastError());
#endif #endif

15
compiler/amxxpc/getch.h Executable file
View File

@ -0,0 +1,15 @@
/* Extremely inefficient but portable POSIX getch(), see getch.c */
#ifndef GETCH_H
#define GETCH_H
#if defined __cplusplus
extern "C" {
#endif
int getch(void);
int kbhit(void);
#if defined __cplusplus
}
#endif
#endif /* GETCH_H */

BIN
compiler/amxxpc/libz.a Executable file

Binary file not shown.