2013-02-13 07:14:37 +00:00
|
|
|
# (C)2004-2013 AMX Mod X Development Team
|
2006-04-24 07:19:15 +00:00
|
|
|
# Makefile written by David "BAILOPAN" Anderson
|
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
###########################################
|
|
|
|
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
|
|
|
###########################################
|
|
|
|
|
2013-09-06 00:51:52 +00:00
|
|
|
HLSDK = ../../../hlsdk
|
2010-04-05 00:55:37 +00:00
|
|
|
MM_ROOT = ../../../metamod/metamod
|
2013-02-13 07:14:37 +00:00
|
|
|
MYSQL_DIR = ../../../mysql-5.0
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
#####################################
|
2006-04-24 07:19:15 +00:00
|
|
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
2013-02-13 07:14:37 +00:00
|
|
|
#####################################
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
PROJECT = mysql
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
OBJECTS = basic_sql.cpp handles.cpp module.cpp threading.cpp sdk/amxxmodule.cpp oldcompat_sql.cpp \
|
|
|
|
thread/BaseWorker.cpp thread/ThreadWorker.cpp thread/PosixThreads.cpp \
|
|
|
|
mysql/MysqlQuery.cpp mysql/MysqlResultSet.cpp mysql/MysqlDatabase.cpp mysql/MysqlDriver.cpp
|
2006-04-27 00:02:54 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
##############################################
|
|
|
|
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
|
|
|
##############################################
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
|
|
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
|
|
|
C_GCC4_FLAGS = -fvisibility=hidden
|
|
|
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
|
|
|
CPP = gcc
|
|
|
|
CPP_OSX = clang
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
LINK = $(MYSQL_DIR)/lib/libmysqlclient_r.a -lz -lpthread -L$(MYSQL_DIR)/lib
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
2013-09-06 00:51:52 +00:00
|
|
|
-I$(HLSDK)/public -I$(MM_ROOT) -I$(MYSQL_DIR)/include -Ithread -Imysql -Isdk
|
2006-08-24 22:44:57 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
################################################
|
|
|
|
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
|
|
|
################################################
|
|
|
|
|
|
|
|
OS := $(shell uname -s)
|
|
|
|
|
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
CPP = $(CPP_OSX)
|
|
|
|
LIB_EXT = dylib
|
|
|
|
LIB_SUFFIX = _amxx
|
|
|
|
CFLAGS += -DOSX
|
|
|
|
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
|
|
|
else
|
|
|
|
LIB_EXT = so
|
|
|
|
LIB_SUFFIX = _amxx_i386
|
|
|
|
CFLAGS += -DLINUX
|
|
|
|
LINK += -shared
|
2006-08-24 22:44:57 +00:00
|
|
|
endif
|
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
LINK += -m32 -lm -ldl
|
|
|
|
|
|
|
|
CFLAGS += -DSM_DEFAULT_THREADER -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H \
|
|
|
|
-Dstricmp=strcasecmp -fno-strict-aliasing -m32 -Wall -Werror
|
|
|
|
CPPFLAGS += -fno-exceptions -fno-rtti
|
|
|
|
|
|
|
|
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
|
|
|
|
2006-04-24 07:19:15 +00:00
|
|
|
ifeq "$(DEBUG)" "true"
|
|
|
|
BIN_DIR = Debug
|
2013-02-13 07:14:37 +00:00
|
|
|
CFLAGS += $(C_DEBUG_FLAGS)
|
2006-04-24 07:19:15 +00:00
|
|
|
else
|
|
|
|
BIN_DIR = Release
|
2013-02-13 07:14:37 +00:00
|
|
|
CFLAGS += $(C_OPT_FLAGS)
|
|
|
|
LINK += -s
|
2006-04-24 07:19:15 +00:00
|
|
|
endif
|
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
ifeq "$(IS_CLANG)" "1"
|
|
|
|
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
|
|
|
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
2006-04-24 07:19:15 +00:00
|
|
|
else
|
2013-02-13 07:14:37 +00:00
|
|
|
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
|
|
|
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Clang || GCC >= 4
|
|
|
|
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
|
|
|
CFLAGS += $(C_GCC4_FLAGS)
|
|
|
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
2006-04-24 07:19:15 +00:00
|
|
|
endif
|
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
# Clang >= 3 || GCC >= 4.7
|
|
|
|
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
2013-08-10 17:29:28 +00:00
|
|
|
CPPFLAGS += -Wno-delete-non-virtual-dtor
|
2013-02-13 07:14:37 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# OS is Linux and not using clang
|
|
|
|
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
|
|
|
LINK += -static-libgcc
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
|
|
|
|
|
|
|
# This will break if we include other Makefiles, but is fine for now. It allows
|
|
|
|
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
|
|
|
# or other changes without mucking up the original.
|
|
|
|
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
2006-04-24 07:19:15 +00:00
|
|
|
|
|
|
|
$(BIN_DIR)/%.o: %.cpp
|
2013-02-13 07:14:37 +00:00
|
|
|
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
2006-04-24 07:19:15 +00:00
|
|
|
|
|
|
|
all:
|
2013-02-13 07:14:37 +00:00
|
|
|
mkdir -p $(BIN_DIR)
|
2006-04-24 07:19:15 +00:00
|
|
|
mkdir -p $(BIN_DIR)/mysql
|
2013-02-13 07:14:37 +00:00
|
|
|
mkdir -p $(BIN_DIR)/thread
|
2006-04-24 07:19:15 +00:00
|
|
|
mkdir -p $(BIN_DIR)/sdk
|
2013-02-13 07:14:37 +00:00
|
|
|
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
$(PROJECT): $(OBJ_BIN)
|
|
|
|
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
2006-04-24 07:19:15 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
debug:
|
|
|
|
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
2006-04-24 07:19:15 +00:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
clean:
|
2013-02-13 07:14:37 +00:00
|
|
|
rm -rf $(BIN_DIR)/*.o
|
|
|
|
rm -rf $(BIN_DIR)/mysql/*.o
|
|
|
|
rm -rf $(BIN_DIR)/thread/*.o
|
|
|
|
rm -rf $(BIN_DIR)/sdk/*.o
|
|
|
|
rm -f $(BIN_DIR)/$(BINARY)
|
|
|
|
|