2013-02-13 11:14:37 +04:00
|
|
|
# (C)2004-2013 AMX Mod X Development Team
|
2005-07-27 20:58:18 +04:00
|
|
|
# Makefile written by David "BAILOPAN" Anderson
|
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
#####################################
|
2005-07-27 20:58:18 +04:00
|
|
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
2013-02-13 11:14:37 +04:00
|
|
|
#####################################
|
2005-07-27 20:58:18 +04:00
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
PROJECT = amxxpc
|
2005-08-02 22:37:59 +04:00
|
|
|
OBJECTS = amx.cpp amxxpc.cpp Binary.cpp
|
2005-07-27 20:58:18 +04:00
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
##############################################
|
|
|
|
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
|
|
|
##############################################
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
LINK =
|
|
|
|
|
|
|
|
INCLUDE = -I.
|
|
|
|
|
|
|
|
################################################
|
|
|
|
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
|
|
|
################################################
|
|
|
|
|
|
|
|
OS := $(shell uname -s)
|
|
|
|
|
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
CPP = $(CPP_OSX)
|
|
|
|
LIB_SUFFIX = _osx
|
|
|
|
CFLAGS += -DOSX
|
|
|
|
LINK += -lstdc++ -mmacosx-version-min=10.5 -lz-darwin
|
|
|
|
else
|
|
|
|
LIB_SUFFIX =
|
|
|
|
CFLAGS += -DLINUX
|
|
|
|
LINK += -lz /lib32/libstdc++.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
LINK += -m32 -lm -ldl -L.
|
|
|
|
|
|
|
|
CFLAGS += -DAMX_ANSIONLY -DHAVE_STDINT_H -fno-strict-aliasing \
|
|
|
|
-m32 -Wall -Werror
|
|
|
|
CPPFLAGS += -fexceptions -fno-rtti
|
2005-07-27 20:58:18 +04:00
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
BINARY = $(PROJECT)$(LIB_SUFFIX)
|
2005-07-27 20:58:18 +04:00
|
|
|
|
|
|
|
ifeq "$(DEBUG)" "true"
|
|
|
|
BIN_DIR = Debug
|
2013-02-13 11:14:37 +04:00
|
|
|
CFLAGS += $(C_DEBUG_FLAGS)
|
2005-07-27 20:58:18 +04:00
|
|
|
else
|
|
|
|
BIN_DIR = Release
|
2013-02-13 11:14:37 +04:00
|
|
|
CFLAGS += $(C_OPT_FLAGS)
|
|
|
|
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
|
|
|
|
|
|
|
|
# Clang || GCC >= 4
|
|
|
|
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
|
|
|
CFLAGS += $(C_GCC4_FLAGS)
|
|
|
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Clang >= 3 || GCC >= 4.7
|
|
|
|
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
|
|
|
CFLAGS += -Wno-delete-non-virtual-dtor
|
|
|
|
endif
|
|
|
|
|
|
|
|
# OS is Linux and not using clang
|
|
|
|
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
|
|
|
LINK += -static-libgcc
|
2005-07-27 20:58:18 +04:00
|
|
|
endif
|
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
2005-07-27 20:58:18 +04:00
|
|
|
|
2013-02-13 11:14:37 +04: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-07-27 20:58:18 +04:00
|
|
|
|
|
|
|
$(BIN_DIR)/%.o: %.cpp
|
2013-02-13 11:14:37 +04:00
|
|
|
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
2005-07-27 20:58:18 +04:00
|
|
|
|
|
|
|
all:
|
|
|
|
mkdir -p $(BIN_DIR)
|
2013-02-13 11:14:37 +04:00
|
|
|
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
2005-07-27 20:58:18 +04:00
|
|
|
|
2013-02-13 11:14:37 +04:00
|
|
|
$(PROJECT): $(OBJ_BIN)
|
|
|
|
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
2005-07-27 20:58:18 +04:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
clean:
|
2013-02-13 11:14:37 +04:00
|
|
|
rm -rf $(BIN_DIR)/*.o
|
|
|
|
rm -f $(BIN_DIR)/$(BINARY)
|
2005-07-27 20:58:18 +04:00
|
|
|
|