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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
LANGS=(
en
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 "${_VERBOSE_}" ] && echo "-- INCLUDE: detect.sh"
@ -13,8 +13,12 @@ _detect() {
exit 1
fi
else
[ -z "$verbose" ] || echo "-- DETECT: $cmd found"
eval "${cmd}_FOUND=1"
if [ -z "$verbose" ]; then
eval "${cmd}_FOUND=1" &> /dev/null
else
echo "-- DETECT: $cmd found"
eval "${cmd}_FOUND=1"
fi
fi
}

View File

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

View File

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

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
# _VERBOSE_=1
# _FORCE_INSRALL_=1
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)