core/Makefile
author David Anderson <dvander@alliedmods.net>
Sat Nov 15 23:46:27 2008 -0600 (2008-11-15)
changeset 552 4b73ffd6e176
parent 551 747f2a3e0e11
child 557 0a8ad2b12708
permissions -rw-r--r--
Initial commit of vsp bridge for new core. Not tested, barely compiles.
ds@538
     1
# (C)2004-2008 SourceMod Development Team
dvander@370
     2
# Makefile written by David "BAILOPAN" Anderson
dvander@370
     3
ds@538
     4
SRCDS_BASE = ~/srcds
ds@538
     5
HL2SDK_OB = ../../hl2sdk-ob
ds@538
     6
HL2SDK_L4D = ../../hl2sdk-l4d
dvander@370
     7
ds@538
     8
#####################################
ds@538
     9
### EDIT BELOW FOR OTHER PROJECTS ###
ds@538
    10
#####################################
dvander@370
    11
dvander@540
    12
OBJECTS = metamod.cpp 				\
dvander@540
    13
		  metamod_util.cpp 			\
dvander@540
    14
		  metamod_console.cpp 		\
dvander@540
    15
		  metamod_oslink.cpp 		\
dvander@540
    16
		  metamod_plugins.cpp 		\
dvander@540
    17
		  sourcehook/sourcehook.cpp \
dvander@540
    18
		  sourcehook/sourcehook_hookmangen.cpp \
dvander@540
    19
		  provider/console.cpp 		\
dvander@540
    20
		  provider/provider_ep2.cpp \
dvander@552
    21
		  provider/vsp_listener.cpp	\
dvander@552
    22
		  vsp_bridge.cpp
ds@538
    23
ds@538
    24
##############################################
ds@538
    25
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
ds@538
    26
##############################################
ds@538
    27
ds@538
    28
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
ds@538
    29
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
ds@538
    30
C_GCC4_FLAGS = -fvisibility=hidden
ds@538
    31
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
ds@538
    32
CPP = gcc-4.1
dvander@370
    33
ds@538
    34
override ENGSET = false
ds@538
    35
ifeq "$(ENGINE)" "orangebox"
ds@538
    36
	HL2SDK = $(HL2SDK_OB)
ds@538
    37
	HL2PUB = $(HL2SDK_OB)/public
ds@538
    38
	HL2LIB = $(HL2SDK_OB)/lib/linux
ds@538
    39
	INCLUDE += -I$(HL2SDK_OB)/public/game/server
ds@538
    40
	SRCDS = $(SRCDS_BASE)/orangebox
dvander@551
    41
	BINARY = metamod.2.ep2.so
ds@538
    42
	override ENGSET = true
ds@538
    43
endif
ds@538
    44
ifeq "$(ENGINE)" "left4dead"
ds@538
    45
	HL2SDK = $(HL2SDK_L4D)
ds@538
    46
	HL2PUB = $(HL2SDK_L4D)/public
ds@538
    47
	HL2LIB = $(HL2SDK_L4D)/lib/linux
ds@538
    48
	INCLUDE += -I$(HL2SDK_L4D)/public/game/server
ds@538
    49
	SRCDS = $(SRCDS_BASE)/l4d_demo
dvander@551
    50
	BINARY = metamod2.l4d.so
ds@538
    51
	override ENGSET = true
ds@538
    52
endif
dvander@370
    53
ds@538
    54
LINK += $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so -static-libgcc
ds@538
    55
ds@538
    56
	
ds@538
    57
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
dvander@552
    58
	-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I. -Isourcehook -I../loader
ds@538
    59
ds@538
    60
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
ds@538
    61
	-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca \
ds@538
    62
	-Dstrcmpi=strcasecmp -Wall -Werror -Wno-uninitialized -mfpmath=sse -msse -DHAVE_STDINT_H -m32
ds@538
    63
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
ds@538
    64
ds@538
    65
################################################
ds@538
    66
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
ds@538
    67
################################################
dvander@370
    68
dvander@370
    69
ifeq "$(DEBUG)" "true"
ds@538
    70
	BIN_DIR = Debug.$(ENGINE)
ds@538
    71
	CFLAGS += $(C_DEBUG_FLAGS)
dvander@370
    72
else
ds@538
    73
	BIN_DIR = Release.$(ENGINE)
ds@538
    74
	CFLAGS += $(C_OPT_FLAGS)
dvander@370
    75
endif
dvander@370
    76
dvander@370
    77
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
dvander@370
    78
ifeq "$(GCC_VERSION)" "4"
ds@538
    79
	CFLAGS += $(C_GCC4_FLAGS)
ds@538
    80
	CPPFLAGS += $(CPP_GCC4_FLAGS)
dvander@370
    81
endif
dvander@370
    82
dvander@370
    83
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
ds@538
    84
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
dvander@370
    85
dvander@370
    86
$(BIN_DIR)/%.o: %.cpp
ds@538
    87
	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
ds@538
    88
ds@538
    89
$(BIN_DIR)/%.o: %.c
dvander@370
    90
	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
dvander@370
    91
ds@538
    92
all: check
dvander@370
    93
	mkdir -p $(BIN_DIR)
dvander@540
    94
	mkdir -p $(BIN_DIR)/provider
dvander@540
    95
	mkdir -p $(BIN_DIR)/sourcehook
dvander@370
    96
	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
dvander@370
    97
	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
ds@538
    98
	$(MAKE) -f Makefile metamod
dvander@370
    99
ds@538
   100
check:
ds@538
   101
	if [ "$(ENGSET)" == "false" ]; then \
ds@538
   102
		echo "You must supply ENGINE=left4dead or ENGINE=orangebox"; \
ds@538
   103
		exit 1; \
ds@538
   104
	fi
dvander@370
   105
ds@538
   106
metamod: check $(OBJ_LINUX)
ds@538
   107
	$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
ds@538
   108
ds@538
   109
debug:
dvander@496
   110
	$(MAKE) -f Makefile all DEBUG=true
dvander@370
   111
dvander@370
   112
default: all
dvander@370
   113
ds@538
   114
clean: check
ds@538
   115
	rm -rf $(BIN_DIR)/*.o
dvander@540
   116
	rm -rf $(BIN_DIR)/sourcehook/*.o
dvander@540
   117
	rm -rf $(BIN_DIR)/provider/*.o
ds@538
   118
	rm -rf $(BIN_DIR)/$(BINARY)
dvander@540
   119