2010-04-23 22:59:32 +02:00
|
|
|
# (C)2004-2010 Metamod:Source Development Team
|
2008-02-18 00:28:55 +01:00
|
|
|
# Makefile written by David "BAILOPAN" Anderson
|
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
###########################################
|
|
|
|
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
|
|
|
###########################################
|
|
|
|
|
2008-02-18 00:28:55 +01:00
|
|
|
HL2SDK_ORIG = ../../hl2sdk
|
|
|
|
HL2SDK_OB = ../../hl2sdk-ob
|
2009-11-14 01:25:56 +01:00
|
|
|
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
|
2008-11-24 19:03:02 +01:00
|
|
|
HL2SDK_L4D = ../../hl2sdk-l4d
|
2009-11-14 01:25:56 +01:00
|
|
|
HL2SDK_L4D2 = ../../hl2sdk-l4d2
|
|
|
|
MMSOURCE18 = ..
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
#####################################
|
|
|
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
|
|
|
#####################################
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2010-05-22 07:45:44 +02:00
|
|
|
PROJECT = sample_mm
|
2008-02-18 00:28:55 +01:00
|
|
|
OBJECTS = sample_mm.cpp
|
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
##############################################
|
|
|
|
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
|
|
|
##############################################
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
|
|
|
GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
|
|
|
|
DEBUG_FLAGS = -g -ggdb3 -D_DEBUG
|
2010-05-22 07:45:44 +02:00
|
|
|
CPP = gcc
|
|
|
|
|
|
|
|
##########################
|
|
|
|
### SDK CONFIGURATIONS ###
|
|
|
|
##########################
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
override ENGSET = false
|
2010-05-22 07:45:44 +02:00
|
|
|
|
|
|
|
# Check for valid list of engines
|
|
|
|
ifneq (,$(filter original orangebox orangeboxvalve left4dead left4dead2,$(ENGINE)))
|
|
|
|
override ENGSET = true
|
|
|
|
endif
|
|
|
|
|
2008-02-18 00:28:55 +01:00
|
|
|
ifeq "$(ENGINE)" "original"
|
|
|
|
HL2SDK = $(HL2SDK_ORIG)
|
2009-02-20 14:41:57 +01:00
|
|
|
CFLAGS += -DSOURCE_ENGINE=1
|
2008-02-18 00:28:55 +01:00
|
|
|
endif
|
|
|
|
ifeq "$(ENGINE)" "orangebox"
|
|
|
|
HL2SDK = $(HL2SDK_OB)
|
2008-11-24 19:03:02 +01:00
|
|
|
CFLAGS += -DSOURCE_ENGINE=3
|
2009-11-14 01:25:56 +01:00
|
|
|
endif
|
|
|
|
ifeq "$(ENGINE)" "orangeboxvalve"
|
|
|
|
HL2SDK = $(HL2SDK_OB_VALVE)
|
|
|
|
CFLAGS += -DSOURCE_ENGINE=4
|
2008-02-18 00:28:55 +01:00
|
|
|
endif
|
2008-11-24 19:03:02 +01:00
|
|
|
ifeq "$(ENGINE)" "left4dead"
|
|
|
|
HL2SDK = $(HL2SDK_L4D)
|
2009-11-14 01:25:56 +01:00
|
|
|
CFLAGS += -DSOURCE_ENGINE=5
|
|
|
|
endif
|
|
|
|
ifeq "$(ENGINE)" "left4dead2"
|
|
|
|
HL2SDK = $(HL2SDK_L4D2)
|
2010-05-22 07:45:44 +02:00
|
|
|
CFLAGS += -DSOURCE_ENGINE=6
|
|
|
|
endif
|
|
|
|
|
|
|
|
HL2PUB = $(HL2SDK)/public
|
|
|
|
|
|
|
|
ifeq "$(ENGINE)" "original"
|
|
|
|
INCLUDE += -I$(HL2SDK)/public/dlls
|
|
|
|
METAMOD = $(MMSOURCE18)/core-legacy
|
|
|
|
else
|
2009-11-14 01:25:56 +01:00
|
|
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
2010-05-22 07:45:44 +02:00
|
|
|
METAMOD = $(MMSOURCE18)/core
|
|
|
|
endif
|
|
|
|
|
|
|
|
OS := $(shell uname -s)
|
|
|
|
|
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
LIB_EXT = dylib
|
|
|
|
HL2LIB = $(HL2SDK)/lib/mac
|
|
|
|
else
|
|
|
|
LIB_EXT = so
|
|
|
|
ifeq "$(ENGINE)" "original"
|
|
|
|
HL2LIB = $(HL2SDK)/linux_sdk
|
|
|
|
else
|
|
|
|
HL2LIB = $(HL2SDK)/lib/linux
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# if ENGINE is orig, OB, or L4D
|
|
|
|
ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
|
|
|
|
LIB_SUFFIX = _i486.$(LIB_EXT)
|
|
|
|
else
|
2010-04-23 22:59:32 +02:00
|
|
|
LIB_PREFIX = lib
|
2010-05-22 07:45:44 +02:00
|
|
|
LIB_SUFFIX = .$(LIB_EXT)
|
2008-02-18 01:36:10 +01:00
|
|
|
endif
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2009-11-14 01:25:56 +01:00
|
|
|
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 \
|
2010-07-22 10:22:28 +02:00
|
|
|
-DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6 -DSE_ALIENSWARM=7
|
2008-11-24 19:03:02 +01:00
|
|
|
|
2010-04-23 22:59:32 +02:00
|
|
|
LINK += $(HL2LIB)/tier1_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) $(LIB_PREFIX)tier0$(LIB_SUFFIX) \
|
|
|
|
-static-libgcc
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
|
|
|
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I. -I$(METAMOD) -I$(METAMOD)/sourcehook
|
2010-05-22 07:45:44 +02:00
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
################################################
|
|
|
|
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
|
|
|
################################################
|
2008-02-18 00:28:55 +01:00
|
|
|
|
2010-05-22 07:45:44 +02:00
|
|
|
BINARY = $(PROJECT).$(LIB_EXT)
|
|
|
|
|
2008-02-18 00:28:55 +01:00
|
|
|
ifeq "$(DEBUG)" "true"
|
|
|
|
BIN_DIR = Debug.$(ENGINE)
|
|
|
|
CFLAGS += $(DEBUG_FLAGS)
|
|
|
|
else
|
|
|
|
BIN_DIR = Release.$(ENGINE)
|
|
|
|
CFLAGS += $(OPT_FLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
|
|
|
|
2010-05-22 07:45:44 +02:00
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
LIB_EXT = dylib
|
|
|
|
CFLAGS += -isysroot /Developer/SDKs/MacOSX10.5.sdk
|
|
|
|
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
|
|
|
else
|
|
|
|
LIB_EXT = so
|
|
|
|
CFLAGS += -D_LINUX
|
|
|
|
LINK += -shared
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
|
2008-02-18 00:28:55 +01:00
|
|
|
-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca \
|
|
|
|
-Dstrcmpi=strcasecmp -Wall -Wno-non-virtual-dtor -Werror -fPIC -fno-exceptions \
|
|
|
|
-fno-rtti -msse -m32 -fno-strict-aliasing
|
|
|
|
|
|
|
|
ifeq "$(GCC_VERSION)" "4"
|
|
|
|
CFLAGS += $(GCC4_FLAGS)
|
|
|
|
endif
|
|
|
|
|
2010-05-22 07:45:44 +02:00
|
|
|
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
2008-02-18 00:28:55 +01:00
|
|
|
|
|
|
|
$(BIN_DIR)/%.o: %.cpp
|
|
|
|
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
all: check
|
2008-02-18 00:28:55 +01:00
|
|
|
mkdir -p $(BIN_DIR)
|
2010-04-23 22:59:32 +02:00
|
|
|
ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
|
|
|
|
ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX)
|
2008-02-18 00:28:55 +01:00
|
|
|
$(MAKE) -f Makefile sample_mm
|
2008-11-24 19:03:02 +01:00
|
|
|
|
|
|
|
check:
|
2008-12-08 06:49:13 +01:00
|
|
|
if [ "$(ENGSET)" = "false" ]; then \
|
2009-11-14 01:25:56 +01:00
|
|
|
echo "You must supply one of the following values for ENGINE:"; \
|
2010-04-23 22:59:32 +02:00
|
|
|
echo "left4dead2, left4dead, orangeboxvalve, orangebox, or original"; \
|
2008-11-24 19:03:02 +01:00
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2010-05-22 07:45:44 +02:00
|
|
|
sample_mm: check $(OBJ_BIN)
|
|
|
|
$(CPP) $(INCLUDE) -m32 $(OBJ_BIN) $(LINK) -ldl -lm -o $(BIN_DIR)/$(BINARY)
|
2008-02-18 00:28:55 +01:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
2008-11-24 19:03:02 +01:00
|
|
|
clean: check
|
2008-02-18 00:28:55 +01:00
|
|
|
rm -rf $(BIN_DIR)/*.o
|
|
|
|
rm -rf $(BIN_DIR)/$(BINARY)
|
|
|
|
|