Skip to content

Commit

Permalink
Merge pull request #128 from abap34/refactor/#126
Browse files Browse the repository at this point in the history
ビルドスクリプトの軽微な問題を修正
  • Loading branch information
abap34 authored May 21, 2024
2 parents 6ed7bc8 + 40e986a commit a512df9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ build: setup
pybind: setup
bash scripts/pybind.sh build/pyalmo.cpp almo.so

all: build pybind
all: clean build pybind

clean:
rm -rf build
rm almo.so
rm -f almo.so

19 changes: 14 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
# ワイルドカードが展開されるとカレントディレクトリのファイル名で展開されてマッチがおかしくなるので展開を抑制する.
# たとえばカレントディレクトリに `tmp.html` があると pettern が "tmp.html" と展開されてマッチしてしまうので抑制する必要がある。
# 今の set -f の状態を保存しておいて、最後に元に戻す
mode=$(set -o | grep noglob | awk '{print $2}')
set -f

src_dir="src/"
build_dir="build/"
Expand Down Expand Up @@ -37,17 +42,13 @@ mkdir -p "$build_dir"
cp -r "$src_dir" "$build_dir"


# ワイルドカードが展開されるとカレントディレクトリのファイル名で展開されてマッチがおかしくなるので展開を抑制する.
# たとえばカレントディレクトリに `tmp.html` があると pettern が "tmp.html" と展開されてマッチしてしまうので抑制する必要がある。
set -f

for file in $(find $build_dir -type f); do
vprint "----------------------------------------"
vprint "Check $file for data files"
for pettern in ${data_petterns[@]}; do
vprint " Check $pettern"
if [[ $file == $build_dir/*$pettern ]]; then
echo "$file is matching $pettern"
vprint "$file is matching $pettern"
echo "R\"(" > "$file.tmp"
cat "$file" >> "$file.tmp"
echo ")\"" >> "$file.tmp"
Expand All @@ -59,3 +60,11 @@ for file in $(find $build_dir -type f); do
vprint "$file is not matching any data file"
done


# 元に戻す
if [ $mode == "on" ]; then
set +f
fi


vprint "Finish setup."

0 comments on commit a512df9

Please sign in to comment.