Using bash instead of sh

This commit is contained in:
John Zhao 2018-03-09 11:42:45 +08:00
parent f02f892494
commit 0820406313
11 changed files with 29 additions and 27 deletions

View File

@ -1,6 +1,8 @@
ifndef _COMMON_DEFS_MAKE_ ifndef _COMMON_DEFS_MAKE_
_COMMON_DEFS_MAKE_ := 1 _COMMON_DEFS_MAKE_ := 1
SHELL := /bin/bash
EMPTY := EMPTY :=
SPACE := $(EMPTY) $(EMPTY) SPACE := $(EMPTY) $(EMPTY)
COMMA := , COMMA := ,
@ -91,21 +93,22 @@ lower = $(shell echo $1 | tr '[:upper:]' '[:lower:]')
# Command # Command
ifeq ($(HOST_OS),MinGW) SH := $(SHELL)
ECHO := echo -e ECHO := echo -e
FIND := $(shell ./scripts/getfind.sh)
ifeq ($(HOST_OS),MinGW)
CC := x86_64-w64-mingw32-gcc CC := x86_64-w64-mingw32-gcc
CXX := x86_64-w64-mingw32-g++ CXX := x86_64-w64-mingw32-g++
MAKE := mingw32-make MAKE := mingw32-make
BUILD := $(MAKE) BUILD := $(MAKE)
else ifeq ($(HOST_OS),Win) else ifeq ($(HOST_OS),Win)
ECHO := echo -e
CC := cl CC := cl
CXX := cl CXX := cl
MAKE := make MAKE := make
BUILD := msbuild.exe ALL_BUILD.vcxproj /property:Configuration=Release BUILD := msbuild.exe ALL_BUILD.vcxproj /property:Configuration=Release
else else
# mac & linux # mac & linux
ECHO := echo
# Set realpath for linux because of compiler not found with wrong path when cmake again # Set realpath for linux because of compiler not found with wrong path when cmake again
CC := /usr/bin/cc CC := /usr/bin/cc
CXX := /usr/bin/c++ CXX := /usr/bin/c++
@ -113,8 +116,6 @@ else
BUILD := $(MAKE) BUILD := $(MAKE)
endif endif
FIND := $(shell ./scripts/getfind.sh)
ifeq ($(HOST_OS),Mac) ifeq ($(HOST_OS),Mac)
LDD := otool -L LDD := otool -L
else else

View File

@ -17,14 +17,14 @@ help:
apidoc: apidoc:
@$(call echo,Make $@) @$(call echo,Make $@)
@sh ./doc/build.sh @$(SH) ./doc/build.sh
opendoc: apidoc opendoc: apidoc
@$(call echo,Make $@) @$(call echo,Make $@)
@$(shell sh ./doc/langs.sh 1); \ @$(shell $(SH) ./doc/langs.sh 1); \
for lang in "$${LANGS[@]}"; do \ for lang in "$${LANGS[@]}"; do \
html=./doc/output/$$lang/html/index.html; \ html=./doc/output/$$lang/html/index.html; \
[ -f "$$html" ] && sh ./scripts/open.sh $$html; \ [ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
done done
.PHONY: apidoc opendoc .PHONY: apidoc opendoc
@ -33,7 +33,7 @@ opendoc: apidoc
init: init:
@$(call echo,Make $@) @$(call echo,Make $@)
@sh ./scripts/init.sh @$(SH) ./scripts/init.sh
.PHONY: init .PHONY: init
@ -77,14 +77,14 @@ host:
@$(call echo,Make $@) @$(call echo,Make $@)
@echo HOST_OS: $(HOST_OS) @echo HOST_OS: $(HOST_OS)
@echo HOST_ARCH: $(HOST_ARCH) @echo HOST_ARCH: $(HOST_ARCH)
@echo SH: $(SH)
@echo ECHO: $(ECHO) @echo ECHO: $(ECHO)
@echo FIND: $(FIND)
@echo CC: $(CC) @echo CC: $(CC)
@echo CXX: $(CXX) @echo CXX: $(CXX)
@echo MAKE: $(MAKE) @echo MAKE: $(MAKE)
@echo BUILD: $(BUILD) @echo BUILD: $(BUILD)
@echo FIND: $(FIND)
@echo LDD: $(LDD) @echo LDD: $(LDD)
@echo CMAKE: $(CMAKE) @echo CMAKE: $(CMAKE)
@#$(FIND) . -name READ*
.PHONY: host .PHONY: host

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
# _VERBOSE_=1 # _VERBOSE_=1
# _TEST_=1 # _TEST_=1

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
LANGS=( LANGS=(
en en
zh-Hans zh-Hans

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
[ -n "${_DETECT_SH_}" ] && return || readonly _DETECT_SH_=1 [ -n "${_DETECT_SH_}" ] && return || readonly _DETECT_SH_=1
[ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: detect.sh" [ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: detect.sh"
@ -13,9 +13,13 @@ _detect() {
exit 1 exit 1
fi fi
else else
[ -z "$verbose" ] || echo "-- DETECT: $cmd found" if [ -z "$verbose" ]; then
eval "${cmd}_FOUND=1" &> /dev/null
else
echo "-- DETECT: $cmd found"
eval "${cmd}_FOUND=1" eval "${cmd}_FOUND=1"
fi fi
fi
} }
_detect_cmd() { _detect_cmd() {

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
[ -n "${_ECHO_SH_}" ] && return || readonly _ECHO_SH_=1 [ -n "${_ECHO_SH_}" ] && return || readonly _ECHO_SH_=1
[ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: echo.sh" [ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: echo.sh"
@ -9,11 +9,7 @@
# source "$(dirname "$0")/echo.sh" # source "$(dirname "$0")/echo.sh"
# fi # fi
if [ "$OS" = "Windows_NT" ]; then
ECHO="echo -e" ECHO="echo -e"
else
ECHO="echo"
fi
# task colors # task colors
COLOR_STRONG="1;35" # Magenta COLOR_STRONG="1;35" # Magenta

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
[ -n "${_HOST_SH_}" ] && return || readonly _HOST_SH_=1 [ -n "${_HOST_SH_}" ] && return || readonly _HOST_SH_=1
[ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: host.sh" [ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: host.sh"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
[ -n "${_MKDIR_SH_}" ] && return || readonly _MKDIR_SH_=1 [ -n "${_MKDIR_SH_}" ] && return || readonly _MKDIR_SH_=1
[ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: mkdir.sh" [ -n "${_VERBOSE_}" ] && echo "-- INCLUDE: mkdir.sh"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
FIND="find" FIND="find"

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env bash
# _VERBOSE_=1
# _FORCE_INSRALL_=1 # _FORCE_INSRALL_=1
BASE_DIR=$(cd "$(dirname "$0")" && pwd) BASE_DIR=$(cd "$(dirname "$0")" && pwd)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
BASE_DIR=$(cd "$(dirname "$0")" && pwd) BASE_DIR=$(cd "$(dirname "$0")" && pwd)