Fix build on macOS
This commit is contained in:
parent
26fd329caa
commit
9cbd0b29ef
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ INSTALL_PREFIX ?= dist
|
||||
# Internal variables
|
||||
override CFLAGS = -Wall -Wextra -Werror -pedantic -Isrc
|
||||
override LIBFLAGS = -fPIC
|
||||
override ABS_INSTALL_PREFIX != readlink -f $(INSTALL_PREFIX)
|
||||
override ABS_INSTALL_PREFIX := $(shell mkdir -p $(INSTALL_PREFIX) && realpath $(INSTALL_PREFIX))
|
||||
override CSTD := -std=gnu11
|
||||
override CXXSTD := -std=gnu++11
|
||||
override KERNEL := $(shell uname -s)
|
||||
|
16
build
16
build
@ -6,7 +6,7 @@ BOLD="\033[1m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
BUILD_TYPE="Debug"
|
||||
ACCEPTED_BUILD_TYPES=("RelWithDebInfo" "Debug" "Release")
|
||||
ACCEPTED_BUILD_TYPES=("Debug" "RelWithDebInfo" "Release")
|
||||
KERNEL="$(uname -s)"
|
||||
ARGS=""
|
||||
|
||||
@ -15,6 +15,15 @@ join_array_elements() {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
contains() {
|
||||
local item="$1"; shift
|
||||
local e
|
||||
for e; do
|
||||
[[ "$e" == "$item" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
print_usage() {
|
||||
echo -e "Usage: build [-b build_type] ..."
|
||||
echo -e " Options:"
|
||||
@ -40,10 +49,7 @@ while [[ $# > 0 ]];do
|
||||
esac
|
||||
done
|
||||
|
||||
# Compare build type against array
|
||||
# From this: https://www.baeldung.com/linux/check-bash-array-contains-value#using-anifcondition-with-aregex-pattern
|
||||
build_regex="\<${BUILD_TYPE}\>"
|
||||
if [[ ! ${ACCEPTED_BUILD_TYPES[@]} =~ $build_regex ]]; then
|
||||
if ! contains ${BUILD_TYPE} "${ACCEPTED_BUILD_TYPES[@]}"; then
|
||||
echo -e "${RED}${BOLD}Unknown build type: ${BUILD_TYPE}${NC}\n"
|
||||
print_usage
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user