1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00
hl2sdk/linux_sdk/Makefile
2008-09-15 01:33:59 -05:00

125 lines
4.3 KiB
Makefile

#
# SDK Makefile for x86 Linux
#
#
#############################################################################
# Developer configurable items
#############################################################################
# the name of the mod binary (_i486.so is appended to the end)
NAME=server
# the location of the vcproj that builds the mod
MOD_PROJ=../dlls/server_scratch-2005.vcproj
# the name of the mod configuration (typically <proj name>_<build type><build target>)
MOD_CONFIG=server_sdk_ReleaseSDKWin32
# the directory the base binaries (tier0_i486.so, etc) are located
GAME_DIR=~/srcds
# compiler options (gcc 3.4.1 or above is required)
CC=/usr/bin/gcc
CPLUS=/usr/bin/g++
CLINK=/usr/bin/gcc
CPP_LIB="/usr/lib/libstdc++.a /usr/lib/libgcc_eh.a"
# put any compiler flags you want passed here
USER_CFLAGS=
# link flags for your mod, make sure to include any special libraries here
LDFLAGS="-lm -ldl mathlib_i486.a choreoobjects_i486.a tier1_i486.a $(GAME_DIR)/bin/tier0_i486.so $(GAME_DIR)/bin/vstdlib_i486.so"
# XERCES 2.6.0 or above ( http://xml.apache.org/xerces-c/ ) is used by the vcproj to makefile converter
# it must be installed before being able to run this makefile
XERCES_INC_DIR=/usr/include
XERCES_LIB_DIR=/usr/lib
#############################################################################
# Things below here shouldn't need to be altered
#############################################################################
MAKE=make
AR="ar rvs"
# the dir we want to put binaries we build into
BUILD_DIR=.
# the place to put object files
BUILD_OBJ_DIR=$(BUILD_DIR)/obj
# the location of the source code
SOURCE_DIR=..
# Locations of static library projects
TIER1_PROJ=../tier1/tier1-2005.vcproj
MATHLIB_PROJ=../mathlib/mathlib-2005.vcproj
CHOREO_PROJ=../choreoobjects/choreoobjects-2005.vcproj
# the CPU target for the build, must be i486 for now
ARCH=i486
ARCH_CFLAGS=-mtune=i686 -march=pentium3 -mmmx -O3
BASE_CFLAGS=-D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Wno-non-virtual-dtor -Wno-invalid-offsetof
SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared -Wl,-Map,$@_map.txt -Wl
#flags passed to the c compiler
CFLAGS="$(USER_CFLAGS) $(DEFINES) $(ARCH_CFLAGS) $(BASE_CFLAGS) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE"
# define list passed to make for the sub makefile
BASE_DEFINES=CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) \
BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) \
SOURCE_DIR=$(SOURCE_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \
CLINK=$(CLINK) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) \
ARCH=$(ARCH) GAME_DIR=$(GAME_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \
XERCES_INC_DIR=$(XERCES_INC_DIR) XERCES_LIB_DIR=$(XERCES_LIB_DIR)
# Project Makefile
MAKE_MOD=Makefile.game
MAKE_VCPM=Makefile.vcpm
MAKE_PLUGIN=Makefile.plugin
MAKE_TIER1=Makefile.tier1
MAKE_MATH=Makefile.mathlib
MAKE_CHOREO=Makefile.choreoobjects
all: check vcpm mod
check:
if [ -z "$(CC)" ]; then echo "Compiler not defined."; exit; fi
if [ ! -d $(BUILD_DIR) ];then mkdir -p $(BUILD_DIR);fi
cd $(BUILD_DIR)
vcpm:
if [ ! -f "tier0_i486.so" ]; then ln -s $(GAME_DIR)/bin/tier0_i486.so .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(GAME_DIR)/bin/vstdlib_i486.so .; fi
$(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES)
mod: vcpm
if [ ! -f "tier0_i486.so" ]; then ln -s $(GAME_DIR)/bin/tier0_i486.so .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(GAME_DIR)/bin/vstdlib_i486.so .; fi
./vcpm $(MOD_PROJ)
$(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES)
plugin:
if [ ! -f "tier0_i486.so" ]; then ln -s $(GAME_DIR)/bin/tier0_i486.so .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(GAME_DIR)/bin/vstdlib_i486.so .; fi
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES)
tier1:
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES)
mathlib:
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES)
choreoobjects:
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES)
clean:
$(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_MOD) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean