Skip to content

Commit

Permalink
Makefile: fix "install"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jan 7, 2020
1 parent f248c52 commit 32c2e1a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions README-ja_JP.md
Expand Up @@ -90,6 +90,7 @@ $ cp -r ble-0.3.0 /path/to/blesh

## アップデートする

Git (`git'), GNU awk (`gawk`), 及び GNU make (`make`) が必要になります。
`ble-0.3` 以上をお使いの場合は `ble.sh` をロードした状態で `ble-update` を実行して下さい。

```bash
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -87,6 +87,7 @@ If you want to load `ble.sh` by default in interactive sessions of `bash`, add t

## Update

You need Git (`git`), GNU awk (`gawk`) and GNU make (`make`).
For `ble-0.3+`, run `ble-update` in the session with `ble.sh` loaded:

```bash
Expand Down
13 changes: 8 additions & 5 deletions ble.pp
Expand Up @@ -593,9 +593,12 @@ function ble-update {
return
fi

if ! type git make gawk &>/dev/null; then
local MAKE=make
type gmake &>/dev/null && MAKE=gmake

if ! type git gawk "$MAKE" &>/dev/null; then
local command
for command in git make gawk; do
for command in git "$MAKE" gawk; do
type "$command" ||
ble/util/print "ble-update: '$command' command is not available." >&2
done
Expand All @@ -607,17 +610,17 @@ function ble-update {
local branch=${_ble_base_repository#*:}
( ble/bin/mkdir -p "$_ble_base/src" && builtin cd "$_ble_base/src" &&
git clone --depth 1 https://github.com/akinomyoga/ble.sh "$_ble_base/src/ble.sh" -b "$branch" &&
builtin cd ble.sh && make all && make INSDIR="$_ble_base" install ) &&
builtin cd ble.sh && "$MAKE" all && "$MAKE" INSDIR="$_ble_base" install ) &&
ble-reload
return
fi

if [[ $_ble_base_repository && -d $_ble_base_repository/.git ]]; then
( ble/util/print "cd into $_ble_base_repository..." >&2 &&
builtin cd "$_ble_base_repository" &&
git pull && { ! make -q || builtin exit 6; } && make all &&
git pull && { ! "$MAKE" -q || builtin exit 6; } && "$MAKE" all &&
if [[ $_ble_base != "$_ble_base_repository"/out ]]; then
make INSDIR="$_ble_base" install
"$MAKE" INSDIR="$_ble_base" install
fi ); local ext=$?
((ext==6)) && return
((ext==0)) && ble-reload
Expand Down
4 changes: 2 additions & 2 deletions make_command.sh
Expand Up @@ -21,11 +21,11 @@ function sub:install {
local dst=$2
mkd "${dst%/*}"
if [[ $src == *.sh ]]; then
local nl=$'\n' q=\' script='1i# this script is a part of blesh (https://github.com/akinomyoga/ble.sh) under BSD-3-Clause license'
local nl=$'\n' q=\' script=$'1i\\\n# this script is a part of blesh (https://github.com/akinomyoga/ble.sh) under BSD-3-Clause license'
script=$script$nl'/^[[:space:]]*#/d;/^[[:space:]]*$/d'
[[ $flag_release ]] &&
script=$script$nl's/^\([[:space:]]*_ble_base_repository=\)'$q'.*'$q'\([[:space:]]*\)$/\1'${q}release:$dist_git_branch$q'/'
sed "$script" "$src" > "$dst"
sed "$script" "$src" > "$dst.part" && mv "$dst.part" "$dst"
else
cp "$src" "$dst"
fi
Expand Down

0 comments on commit 32c2e1a

Please sign in to comment.