-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
36 lines (28 loc) · 831 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# CCache + multicore compilation script by Stian
# For "The Forgotten Server"
# Example:
# # make clean
# # time ./build.sh
# Gives:
# real 3m27.070s
# user 6m4.066s
# sys 0m16.659s
# CCACHE recompile (from scratch):
# # make clean
# # time ./build.sh
# Gives:
# real 0m27.620s
# user 0m43.744s
# sys 0m4.766s
# 1/7 of the original compile time!
# When more you do it, more ccache will cache, default is limited to use 1GB storage
echo "TheForgottenServer build script- seems to speed things up ALOT when testing new features. Requires CCache installed!"
# Enable CCACHE
export PATH=/usr/lib/ccache/bin:$PATH
# Get number cores
CORES=`grep cores /proc/cpuinfo | wc -l`
# Set make processes - 1 + number of cores
MAKEOPT=$(($CORES + 1))
echo "Building on $CORES cores, using $MAKEOPT processes"
make -j $MAKEOPT