amxmodx/modules/sqlite/Makefile

148 lines
4.3 KiB
Makefile
Raw Normal View History

# (C)2004-2013 AMX Mod X Development Team
2005-08-26 15:54:42 +00:00
# Makefile written by David "BAILOPAN" Anderson
###########################################
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
###########################################
2005-08-26 15:54:42 +00:00
HLSDK = ../../../hlsdk
MM_ROOT = ../../../metamod/metamod
PUBLIC_ROOT = ../../public
THIRD_PARTY = $(PUBLIC_ROOT)/third_party
SQL = $(THIRD_PARTY)/sqlite
2005-08-26 15:54:42 +00:00
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
#####################################
PROJECT = sqlite
OBJECTS = basic_sql.cpp handles.cpp module.cpp threading.cpp amxxmodule.cpp oldcompat_sql.cpp \
thread/BaseWorker.cpp thread/ThreadWorker.cpp thread/PosixThreads.cpp \
sqlitepp/SqliteQuery.cpp sqlitepp/SqliteResultSet.cpp sqlitepp/SqliteDatabase.cpp \
sqlitepp/SqliteDriver.cpp
OBJECTS += $(SQL)/sqlite3.c
##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
##############################################
C_OPT_FLAGS = -DNDEBUG -O3 -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
LINK =
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
-I$(SQL) -Isqlitepp -Ithread \
-I$(MM_ROOT)
################################################
### 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
endif
2005-08-26 15:54:42 +00:00
LINK += -m32 -lm -ldl -lpthread
2006-08-27 02:17:18 +00:00
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
2005-08-26 15:54:42 +00:00
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
2005-08-26 15:54:42 +00:00
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS += $(C_DEBUG_FLAGS)
2005-08-26 15:54:42 +00:00
else
BIN_DIR = Release
CFLAGS += $(C_OPT_FLAGS)
LINK += -s
2006-08-27 02:17:18 +00:00
endif
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
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/")
else
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
endif
2006-08-27 02:17:18 +00:00
# Clang || GCC >= 4
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
CFLAGS += $(C_GCC4_FLAGS)
CPPFLAGS += $(CPP_GCC4_FLAGS)
2005-08-26 15:54:42 +00:00
endif
# GCC >= 4.6
ifeq "$(shell expr $(IS_CLANG) \= 0 \& \( \( $(CPP_MAJOR) \= 4 \& $(CPP_MINOR) \>= 6 \) \| $(CPP_MAJOR) \> 4 \))" "1"
CFLAGS += -Wno-unused-but-set-variable
endif
# Clang >= 3 || GCC >= 4.7
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
CPPFLAGS += -Wno-delete-non-virtual-dtor
endif
2005-08-26 15:54:42 +00:00
# OS is Linux and not using clang
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
LINK += -static-libgcc
2005-08-26 15:54:42 +00:00
endif
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
OBJ_BIN := $(OBJ_BIN:%.c=$(BIN_DIR)/%.o)
2005-08-26 15:54:42 +00:00
# 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))
2005-08-26 15:54:42 +00:00
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
2005-08-26 15:54:42 +00:00
$(BIN_DIR)/%.o: %.c
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
2005-08-26 15:54:42 +00:00
all:
mkdir -p $(BIN_DIR)
2006-06-04 07:35:33 +00:00
mkdir -p $(BIN_DIR)/thread
mkdir -p $(BIN_DIR)/sqlitepp
2005-08-26 15:54:42 +00:00
mkdir -p $(BIN_DIR)/$(SQL)
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
2005-08-26 15:54:42 +00:00
$(PROJECT): $(OBJ_BIN)
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
2005-08-26 15:54:42 +00:00
debug:
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
2005-08-26 15:54:42 +00:00
default: all
clean:
rm -rf $(BIN_DIR)/*.o
rm -rf $(BIN_DIR)/thread/*.o
rm -rf $(BIN_DIR)/sqlitepp/*.o
rm -rf $(BIN_DIR)/$(SQL)/*.o
rm -f $(BIN_DIR)/$(BINARY)