Merge pull request #3807 from shawns-valve/master

Updated Linux makefiles
This commit is contained in:
shawns-valve 2024-08-29 22:31:59 -07:00 committed by GitHub
commit 7cdc848464
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 56 additions and 58 deletions

View file

@ -64,4 +64,4 @@ Visual Studio 2019 is required to build mod DLLs on Windows. In the Visual Studi
Tools have not yet been updated for VS2019, but can be built using the VS2010 projects in the `projects\vs2010` folder. See the `readme.txt` file there.
Linux binaries are built using Makefiles found in the `linux` folder, and are expected to be built / run in the Steam Runtime "scout" environment. You will need to set the environment variables VALVE_NO_AUTO_P4=1 and USE_STEAM_RUNTIME=1 while building.
Linux binaries can be built using Makefiles found in the `linux` folder. They expect to be built / run in the Steam Runtime "scout" environment. The built binaries are copied to a directory called "game" at the same level as the root directory for the git repository. You can set CREATE_OUTPUT_DIRS=1 while building to create the output directory structure automatically.

View file

@ -25,33 +25,20 @@ DBG_SRC_DIR=$(SOURCE_DIR)/dbg
BUILD_OBJ_DIR=$(BUILD_DIR)/obj
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
P4_EDIT_START = chmod -R +w
P4_EDIT_END = || true
P4_REVERT_START = true
P4_REVERT_END =
else
P4_EDIT_START = p4 edit
P4_EDIT_END =
P4_REVERT_START = p4 revert
P4_REVERT_END =
endif
P4_EDIT_START = chmod -R +w
P4_EDIT_END = || true
P4_REVERT_START = true
P4_REVERT_END =
ARCH=i386
ELF-GC-DYNSTR=./elf-gc-dynstr
# Note that we expect to be building inside a Steam Runtime "scout" container
ifeq ($(OS),Linux)
ifneq ($(USE_STEAM_RUNTIME),1)
CC="/valve/bin/gcc-4.6 -m32"
CPLUS="/valve/bin/g++-4.6 -m32"
CPP_LIB:=-L$(shell /valve/bin/g++-4.6 -m32 -print-file-name=libstdc++.so | xargs dirname) -lstdc++ -ldl -lpthread
CLINK=$(CC)
else
CC="gcc-5 -m32 -std=gnu++11 -fno-delete-null-pointer-checks -fno-gnu-unique -fvisibility=hidden"
CPLUS="g++-5 -m32 -std=gnu++11 -fno-delete-null-pointer-checks -fno-gnu-unique -fvisibility=hidden"
CPP_LIB:=-L$(shell g++-5 -m32 -print-file-name=libstdc++.so | xargs dirname) -lstdc++ -ldl -lpthread
CLINK=$(CC)
endif
endif
ifeq ($(OS),Darwin)

View file

@ -12,6 +12,7 @@ PUBLIC_OBJ_DIR=$(DMC_OBJ_DIR)/public
COMMON_OBJ_DIR=$(DMC_OBJ_DIR)/common
GAME_SHARED_OBJ_DIR=$(DMC_OBJ_DIR)/game_shared
PM_SHARED_OBJ_DIR=$(DMC_OBJ_DIR)/pm_shared
DMC_OUTPUT_DIR=$(SOURCE_DIR)/../game/dmc
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -DDMC_BUILD -I/usr/include/malloc -D_snwprintf=swprintf \
-DDISABLE_JUMP_ORIGIN -DDISABLE_VEC_ORIGIN -D_MAX_PATH=PATH_MAX
@ -115,9 +116,12 @@ all: client_dmc.$(SHLIBEXT)
client_dmc.$(SHLIBEXT): $(DMC_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(PM_SHARED_OBJS)
$(CLINK) -o $(BUILD_DIR)/$@ $(DMC_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(PM_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB)
$(P4_EDIT_START) ../../game/dmc/cl_dlls/client.$(SHLIBEXT) $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/dmc/cl_dlls/client.$(SHLIBEXT)
./gendbg.sh ../../game/dmc/cl_dlls/client.$(SHLIBEXT)
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(DMC_OUTPUT_DIR)/cl_dlls
endif
$(P4_EDIT_START) $(DMC_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT) $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ $(DMC_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT)
./gendbg.sh $(DMC_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT)
$(DMC_OBJ_DIR):

View file

@ -11,6 +11,7 @@ PM_SRC_DIR=$(SOURCE_DIR)/dmc/pm_shared
DMCDLL_OBJ_DIR=$(BUILD_OBJ_DIR)/dmcdll
PM_OBJ_DIR=$(DMCDLL_OBJ_DIR)/pm_shared
GAME_SHARED_OBJ_DIR=$(DMCDLL_OBJ_DIR)/game_shared
DMC_OUTPUT_DIR=$(SOURCE_DIR)/../game/dmc
#full optimization
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS)
@ -93,9 +94,12 @@ dirs:
dmc.$(SHLIBEXT): $(DMCDLL_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS)
$(CLINK) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(DMCDLL_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB)
$(P4_EDIT_START) ../../game/dmc/dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/dmc/dlls
./gendbg.sh ../../game/dmc/dlls/dmc.$(SHLIBEXT)
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(DMC_OUTPUT_DIR)/dlls
endif
$(P4_EDIT_START) .$(DMC_OUTPUT_DIR)/dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ $(DMC_OUTPUT_DIR)/dlls
./gendbg.sh $(DMC_OUTPUT_DIR)/dlls/dmc.$(SHLIBEXT)
$(DMCDLL_OBJ_DIR)/%.o : $(DMCDLL_SRC_DIR)/%.cpp
$(DO_DMCDLL_CC)

View file

@ -14,6 +14,7 @@ COMMON_OBJ_DIR=$(HL1_OBJ_DIR)/common
GAME_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/game_shared
HL1_SERVER_OBJ_DIR=$(HL1_OBJ_DIR)/server
PM_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/pm_shared
HL_OUTPUT_DIR=$(SOURCE_DIR)/../game/valve
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -DCLIENT_WEAPONS -DHL_DLL -I/usr/include/malloc -D_snwprintf=swprintf \
-DDISABLE_JUMP_ORIGIN -DDISABLE_VEC_ORIGIN
@ -114,7 +115,6 @@ PUBLIC_OBJS = \
$(PUBLIC_OBJ_DIR)/interface.o \
COMMON_OBJS = \
$(COMMON_OBJ_DIR)/validator.o \
$(COMMON_OBJ_DIR)/parsemsg.o \
GAME_SHARED_OBJS = \
@ -138,9 +138,12 @@ all: client.$(SHLIBEXT)
client.$(SHLIBEXT): $(HL1_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(DLL_OBJS) $(PM_SHARED_OBJS)
$(CLINK) -o $(BUILD_DIR)/$@ $(HL1_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(DLL_OBJS) $(PM_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB)
$(P4_EDIT_START) ../../game/valve/cl_dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/valve/cl_dlls
./gendbg.sh ../../game/valve/cl_dlls/client.$(SHLIBEXT)
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(HL_OUTPUT_DIR)/cl_dlls
endif
$(P4_EDIT_START) $(HL_OUTPUT_DIR)/cl_dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ $(HL_OUTPUT_DIR)/cl_dlls
./gendbg.sh $(HL_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT)
$(HL1_OBJ_DIR):
mkdir -p $(HL1_OBJ_DIR)

View file

@ -11,6 +11,7 @@ HLDLL_OBJ_DIR=$(BUILD_OBJ_DIR)/hldll
HLWPN_OBJ_DIR=$(HLDLL_OBJ_DIR)/wpn_shared
PM_OBJ_DIR=$(HLDLL_OBJ_DIR)/pm_shared
GAME_SHARED_OBJ_DIR=$(HLDLL_OBJ_DIR)/game_shared
HL_OUTPUT_DIR=$(SOURCE_DIR)/../game/valve
#CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) $(SHLIBCFLAGS) -DCLIENT_WEAPONS
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_WEAPONS
@ -152,9 +153,12 @@ dirs:
hl.$(SHLIBEXT): $(HLDLL_OBJS) $(HLWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS)
$(CC) $(LDFLAGS) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(HLDLL_OBJS) $(HLWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS)
$(P4_EDIT_START) ../../game/valve/dlls/hl.$(SHLIBEXT) $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/valve/dlls/hl.$(SHLIBEXT)
./gendbg.sh ../../game/valve/dlls/hl.$(SHLIBEXT)
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(HL_OUTPUT_DIR)/dlls
endif
$(P4_EDIT_START) $(HL_OUTPUT_DIR)/dlls/hl.$(SHLIBEXT) $(P4_EDIT_END)
cp -f $(BUILD_DIR)/$@ $(HL_OUTPUT_DIR)/dlls/hl.$(SHLIBEXT)
./gendbg.sh $(HL_OUTPUT_DIR)/dlls/hl.$(SHLIBEXT)
$(HLWPN_OBJ_DIR)/%.o : $(HLWPN_SRC_DIR)/%.cpp
$(DO_HLWPN_CC)

View file

@ -12,6 +12,7 @@ PUBLIC_OBJ_DIR=$(RICOCHET_OBJ_DIR)/public
COMMON_OBJ_DIR=$(RICOCHET_OBJ_DIR)/common
GAME_SHARED_OBJ_DIR=$(RICOCHET_OBJ_DIR)/game_shared
PM_SHARED_OBJ_DIR=$(RICOCHET_OBJ_DIR)/pm_shared
RICOCHET_OUTPUT_DIR=$(SOURCE_DIR)/../game/ricochet
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwprintf=swprintf \
-DDISABLE_JUMP_ORIGIN -DDISABLE_VEC_ORIGIN -D_MAX_PATH=PATH_MAX
@ -114,9 +115,12 @@ all: client_ricochet.$(SHLIBEXT)
client_ricochet.$(SHLIBEXT): $(RICOCHET_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(PM_SHARED_OBJS)
$(CLINK) -o $(BUILD_DIR)/$@ $(RICOCHET_OBJS) $(PUBLIC_OBJS) $(COMMON_OBJS) $(GAME_SHARED_OBJS) $(PM_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB)
$(P4_EDIT_START) ../../game/ricochet/cl_dlls/client.$(SHLIBEXT) $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/ricochet/cl_dlls/client.$(SHLIBEXT)
./gendbg.sh ../../game/ricochet/cl_dlls/client.$(SHLIBEXT)
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(RICOCHET_OUTPUT_DIR)/cl_dlls
endif
$(P4_EDIT_START) $(RICOCHET_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT) $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ $(RICOCHET_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT)
./gendbg.sh $(RICOCHET_OUTPUT_DIR)/cl_dlls/client.$(SHLIBEXT)
$(RICOCHET_OBJ_DIR):
mkdir -p $(RICOCHET_OBJ_DIR)

View file

@ -13,6 +13,7 @@ RICOCHETDLL_OBJ_DIR=$(BUILD_OBJ_DIR)/ricochetdll
RICOCHETWPN_OBJ_DIR=$(RICOCHETDLL_OBJ_DIR)/wpn_shared
PM_OBJ_DIR=$(RICOCHETDLL_OBJ_DIR)/pm_shared
GAME_SHARED_OBJ_DIR=$(RICOCHETDLL_OBJ_DIR)/game_shared
RICOCHET_OUTPUT_DIR=$(SOURCE_DIR)/../game/ricochet
#CFLAGS=$(BASE_CFLAGS) -g
CFLAGS=$(BASE_CFLAGS) -O3 -ffast-math -fno-strength-reduce
@ -102,9 +103,12 @@ dirs:
ricochet.$(SHLIBEXT): $(RICOCHETDLL_OBJS) $(RICOCHETWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS)
$(CLINK) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(RICOCHETDLL_OBJS) $(RICOCHETWPN_OBJS) $(PM_OBJS) $(GAME_SHARED_OBJS) $(LDFLAGS) $(CPP_LIB)
$(P4_EDIT_START) ../../game/ricochet/dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ ../../game/ricochet/dlls
./gendbg.sh ../../game/ricochet/dlls/$@
ifeq ($(CREATE_OUTPUT_DIRS),1)
mkdir -p $(RICOCHET_OUTPUT_DIR)/dlls
endif
$(P4_EDIT_START) $(RICOCHET_OUTPUT_DIR)/dlls/$@ $(P4_EDIT_END)
cp $(BUILD_DIR)/$@ $(RICOCHET_OUTPUT_DIR)/dlls
./gendbg.sh $(RICOCHET_OUTPUT_DIR)/dlls/$@
$(RICOCHETWPN_OBJ_DIR)/%.o : $(RICOCHETWPN_SRC_DIR)/%.cpp
$(DO_RICOCHETWPN_CC)

View file

@ -1,20 +1,12 @@
#!/bin/bash
if [[ -n "$VALVE_NO_AUTO_P4" ]]; then
p4_edit () {
chmod -R +w "$@" || true
}
p4_revert () {
true
}
else
p4_edit () {
p4 edit "$@"
}
p4_revert () {
p4 revert "$@"
}
fi
p4_edit () {
chmod -R +w "$@" || true
}
p4_revert () {
true
}
UNAME=$(uname)
if [ "$UNAME" == "Darwin" ]; then
@ -24,11 +16,7 @@ if [ "$UNAME" == "Darwin" ]; then
exit 0;
fi
if [[ -z "$USE_STEAM_RUNTIME" ]]; then
OBJCOPY=/valve/bin/objcopy
else
OBJCOPY=objcopy
fi
OBJCOPY=objcopy
function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"

Binary file not shown.

Binary file not shown.