mirror of
https://github.com/ENSL/NS.git
synced 2024-12-02 09:11:56 +00:00
36c78acbce
* handle particles project VC++ compilation errors with MVCS and project property changes - retarget to v142 platformtoolset - remove explicit windows SDK version; use latest by default - remove settings that are otherwise default values in project or are best determined by solution * attempt to handle clang++ issues regarding unsupported c++11 features * reset file changes to particledefs.h * removing PARTICLEDLL_API definition and replacing usage with extern "C" block statements * add g++ compiler option to specify c++11 standard * attempt to resolve forward enum errors by adding std to base cflags * replacing deprecated libstdc++ and removing -lstdc++ flag, updating MacOSX10 sdk version * small refactor to Makefiles, and add libstdc++ back to linux build * remove added type to enum * reset makefile changes that may be causing unexpected linux build failures * refactoring std=c++11 declarations in Makefile to mitgate linux build failing * ensure std is set for hl_cdll make * attempt to define a standard library to resolve vector initialization_list constructor issue * attempt to update MacOS sdk, set minimum os to be 10.7, and include export in travis ci to define deployment target
155 lines
5.1 KiB
Makefile
155 lines
5.1 KiB
Makefile
|
|
#
|
|
# Half-life Makefile for x86 Linux
|
|
#
|
|
#
|
|
|
|
OS:=$(shell uname)
|
|
HOSTNAME:=$(shell hostname)
|
|
|
|
ifeq "$(CFG)" ""
|
|
CFG=release
|
|
endif
|
|
|
|
SOURCE_DIR=..
|
|
BUILD_DIR=$(CFG)
|
|
|
|
MOD_SRC_DIR=$(SOURCE_DIR)/mod
|
|
ENGINE_SRC_DIR=$(SOURCE_DIR)/engine
|
|
COMMON_SRC_DIR=$(SOURCE_DIR)/common
|
|
PM_SRC_DIR=$(SOURCE_DIR)/pm_shared
|
|
GAME_SHARED_SRC_DIR=$(SOURCE_DIR)/game_shared
|
|
GAMEDB_SRC_DIR=$(COMMON_SRC_DIR)/gamedb
|
|
PUBLIC_SRC_DIR=$(SOURCE_DIR)/public
|
|
DBG_SRC_DIR=$(SOURCE_DIR)/dbg
|
|
|
|
|
|
BUILD_OBJ_DIR=$(BUILD_DIR)/obj
|
|
|
|
ARCH=i386
|
|
ELF-GC-DYNSTR=./elf-gc-dynstr
|
|
|
|
ifeq ($(OS),Linux)
|
|
CC="gcc -m32"
|
|
CPLUS="g++ -m32 -std=c++11"
|
|
CPP_LIB:=-L$(shell g++ -m32 -print-file-name=libstdc++.so | xargs dirname) -lstdc++ -ldl -lpthread
|
|
endif
|
|
|
|
ifeq ($(OS),Darwin)
|
|
OSXVER := $(shell sw_vers -productVersion)
|
|
DEVELOPER_DIR := $(shell /usr/bin/xcode-select -print-path)
|
|
ifeq (,$(findstring 10.7, $(OSXVER)))
|
|
BUILDING_ON_LION := 0
|
|
COMPILER_BIN_DIR := $(DEVELOPER_DIR)/usr/bin
|
|
SDK_DIR := $(DEVELOPER_DIR)/SDKs
|
|
else
|
|
BUILDING_ON_LION := 1
|
|
COMPILER_BIN_DIR := $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
|
SDK_DIR := $(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/SDKs
|
|
endif
|
|
|
|
#SDKROOT ?= $(SDK_DIR)/MacOSX10.6.sdk
|
|
SDKROOT ?= $(SDK_DIR)/MacOSX10.10.sdk
|
|
|
|
ARCH_FLAGS ?= -arch i386 -m32 -march=prescott -gdwarf-2 -g2 -Wno-typedef-redefinition -momit-leaf-frame-pointer -mtune=core2
|
|
CPP_LIB=-lstdc++ -lpthread
|
|
|
|
ifeq ($(origin AR), default)
|
|
AR = libtool -static -o
|
|
endif
|
|
ifeq ($(origin CC), default)
|
|
CC ="$(COMPILER_BIN_DIR)/clang -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.7 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
|
endif
|
|
ifeq ($(origin CPLUS), default)
|
|
CPLUS ="$(COMPILER_BIN_DIR)/clang++ -std=c++11 -Qunused-arguments -isysroot $(SDKROOT) -mmacosx-version-min=10.7 -fasm-blocks -I$(SDKROOT)/usr/include/malloc $(ARCH_FLAGS)"
|
|
endif
|
|
LINK ?= $(CPLUS)
|
|
endif
|
|
|
|
CLINK=$(CC)
|
|
|
|
ifeq "$(CFG)" "release"
|
|
ARCH_CFLAGS_I486=-O3
|
|
ARCH_CFLAGS_I686=-O3
|
|
ARCH_CFLAGS_AMD=-O3
|
|
ARCH_CFLAGS_AMD64=-m64
|
|
else
|
|
ARCH_CFLAGS_I486=-gdwarf-2 -g2
|
|
ARCH_CFLAGS_I686=-gdwarf-2 -g2
|
|
ARCH_CFLAGS_AMD=-gdwarf-2 -g2
|
|
ARCH_CFLAGS_AMD64=-m64 -gdwarf-2 -g2
|
|
endif
|
|
|
|
ifeq ($(OS),Linux)
|
|
ARCH_CFLAGS_I486+=-march=pentium-m -mfpmath=387
|
|
ARCH_CFLAGS_I686+=-march=pentium-m -mfpmath=387
|
|
ARCH_CFLAGS_AMD+=-march=k6 -mfpmath=387
|
|
endif
|
|
|
|
ifeq ($(OS),Darwin)
|
|
# force 387 for FP math so the precision between win32 and linux and osx match
|
|
ARCH_CFLAGS_I486+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
|
ARCH_CFLAGS_I686+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
|
ARCH_CFLAGS_AMD+=-mno-sse -mfpmath=387 -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
|
endif
|
|
|
|
|
|
ARCH_CFLAGS="$(ARCH_CFLAGS_I486)"
|
|
|
|
BASE_CFLAGS=-fpermissive -fno-strict-aliasing -DNDEBUG -DPOSIX -D_POSIX -DLINUX -D_LINUX -DGNUC -DHL1 -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -DQUIVER -DQUAKE2 -DVALVE_DLL -D_alloca=alloca -fno-exceptions -fexpensive-optimizations -D_vsnprintf=vsnprintf -DNO_MALLOC_OVERRIDE -Werror=return-type
|
|
BASE_CFLAGS+=-w
|
|
|
|
ifeq ($(OS),Darwin)
|
|
BASE_CFLAGS += -DOSX -D_OSX -fvisibility=hidden -target i386-apple-darwin -DCMAKE_OSX_ARCHITECTURES=i386
|
|
else
|
|
BASE_CFLAGS+= -DLINUX -D_LINUX
|
|
endif
|
|
|
|
DEDICATED_CFLAGS="-DDEDICATED -DSWDS"
|
|
ifeq ($(OS),Darwin)
|
|
SHLIBEXT=dylib
|
|
SHLIBCFLAGS=
|
|
SHLIBLDFLAGS="-shared -gdwarf-2 -g2 -DCMAKE_OSX_ARCHITECTURES=i386 -target i386-apple-darwin"
|
|
else
|
|
SHLIBEXT=so
|
|
SHLIBCFLAGS=
|
|
SHLIBLDFLAGS="-shared -gdwarf-2 -g2 -Wl,-Map,$@_map.txt"
|
|
endif
|
|
AR=ar
|
|
LIBEXT=a
|
|
MAKE+= -j8
|
|
|
|
MAKE_HL_LIB=$(MAKE) -f Makefile.nsdll
|
|
MAKE_hl_cdll=$(MAKE) -f Makefile.hl_cdll
|
|
|
|
#############################################################################
|
|
# SETUP AND BUILD
|
|
#############################################################################
|
|
|
|
all: build_dir targets
|
|
|
|
TARGETS=
|
|
|
|
TARGETS+= \
|
|
particles \
|
|
ns \
|
|
hl_cdll \
|
|
|
|
build_dir:
|
|
-mkdir $(BUILD_DIR);
|
|
cd $(BUILD_DIR)
|
|
|
|
targets: $(TARGETS)
|
|
|
|
particles:
|
|
cd ../particles && make && cd ../linux && cp ../particles/libpart* .
|
|
|
|
hl_cdll: build_dir
|
|
$(MAKE_hl_cdll) ARCH=i686 CC=$(CC) CPLUS=$(CPLUS) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) MOD_SRC_DIR=$(MOD_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) DBG_SRC_DIR=$(DBG_SRC_DIR) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)" GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) CLINK=$(CLINK) PM_SRC_DIR=$(PM_SRC_DIR) SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) CFG=$(CFG) OS=$(OS)
|
|
|
|
ns: build_dir
|
|
$(MAKE_HL_LIB) CC=$(CC) ARCH=$(ARCH) CPP_LIB="$(CPP_LIB)" BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SOURCE_DIR=$(SOURCE_DIR) ENGINE_SRC_DIR=$(ENGINE_SRC_DIR) COMMON_SRC_DIR=$(COMMON_SRC_DIR) PM_SRC_DIR=$(PM_SRC_DIR) GAME_SHARED_SRC_DIR=$(GAME_SHARED_SRC_DIR) GAMEDB_SRC_DIR=$(GAMEDB_SRC_DIR) BASE_CFLAGS="$(BASE_CFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBCFLAGS=$(SHLIBCFLAGS) SHLIBLDFLAGS=$(SHLIBLDFLAGS) PUBLIC_SRC_DIR=$(PUBLIC_SRC_DIR) CFG=$(CFG) OS=$(OS) ARCH_CFLAGS="$(ARCH_CFLAGS_I686)"
|
|
|
|
clean:
|
|
make -f ../particles/Makefile clean
|
|
-rm -rf $(BUILD_OBJ_DIR)
|