Skip to content

Commit 40fe9c9

Browse files
committed
make: support make variable "USE_DOC=no"
1 parent 5b9d9ab commit 40fe9c9

File tree

6 files changed

+81
-18
lines changed

6 files changed

+81
-18
lines changed

GNUmakefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,14 @@ removedfiles += \
152152
# documents
153153

154154
outdirs += $(OUTDIR)/doc
155-
outfiles-doc += $(OUTDIR)/doc/README.md
156-
outfiles-doc += $(OUTDIR)/doc/README-ja_JP.md
157-
outfiles-doc += $(OUTDIR)/doc/CONTRIBUTING.md
158-
outfiles-doc += $(OUTDIR)/doc/ChangeLog.md
159-
outfiles-doc += $(OUTDIR)/doc/Release.md
160155
outfiles-license += $(OUTDIR)/doc/LICENSE.md
156+
ifneq ($(USE_DOC),no)
157+
outfiles-doc += $(OUTDIR)/doc/README.md
158+
outfiles-doc += $(OUTDIR)/doc/README-ja_JP.md
159+
outfiles-doc += $(OUTDIR)/doc/CONTRIBUTING.md
160+
outfiles-doc += $(OUTDIR)/doc/ChangeLog.md
161+
outfiles-doc += $(OUTDIR)/doc/Release.md
162+
endif
161163

162164
# Note #D2065: make-3.81 のバグにより以下の様に記述すると、より長く一致するパター
163165
# ンを持った規則よりも優先されてしまう。3.82 では問題は発生しない。% の代わりに
@@ -245,9 +247,11 @@ uninstall:
245247

246248
$(INSDIR)/%: $(OUTDIR)/%
247249
bash make_command.sh install $(opt_strip_comment) "$<" "$@"
250+
ifneq ($(INSDIR_DOC),$(INSDIR))
248251
$(INSDIR_DOC)/%: $(OUTDIR)/doc/%
249252
bash make_command.sh install "$<" "$@"
250-
ifneq ($(INSDIR_DOC),$(INSDIR_LICENSE))
253+
endif
254+
ifneq ($(findstring $(INSDIR_LICENSE),$(INDDIR) $(INSDIR_DOC)),)
251255
$(INSDIR_LICENSE)/%: $(OUTDIR)/doc/%
252256
bash make_command.sh install "$<" "$@"
253257
endif

README-ja_JP.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,35 @@ make install
295295
# 指定したディレクトリにインストール
296296
make install INSDIR=/path/to/blesh
297297

298-
# パッケージ作成用 (パッケージ管理者用)
298+
# パッケージ作成 (パッケージ管理者用) - 例1
299299
make install DESTDIR=/tmp/blesh-package PREFIX=/usr/local
300+
301+
# パッケージ作成 - 例2
302+
make install DESTDIR="$build" PREFIX="$prefix" \
303+
INSDIR_LICENSE="$build/$prefix/licenses/blesh"
304+
305+
# パッケージ作成 - 例3
306+
make install DESTDIR="$build" PREFIX="$prefix" \
307+
INSDIR_LICENSE="$build/$prefix/share/blesh/doc" \
308+
INSDIR_DOC="$build/$prefix/share/blesh/doc"
309+
310+
# パッケージ作成 - 例4
311+
make install USE_DOC=no DESTDIR="$build" PREFIX="$prefix" \
312+
INSDIR_LICENSE="$build/$prefix/share/blesh"
300313
```
301314

302-
Make 変数 `DESTDIR` または `PREFIX` が指定されている時、`ble.sh``$DESTDIR/$PREFIX/share/blesh` にコピーされます。
303-
それ以外で Make 変数 `INSDIR` が指定されている時、直接 `$INSDIR` にインストールされます。
304-
更にそれ以外で環境変数 `$XDG_DATA_HOME` が指定されている時、`$XDG_DATA_HOME/blesh` にインストールされます。
305-
以上の変数が何れも指定されていない時の既定のインストール先は `~/.local/share/blesh` です。
315+
Make 変数 `DESTDIR` または `PREFIX` が指定されている時、
316+
`ble.sh` 及び関連ファイルは `$DESTDIR/$PREFIX/share/blesh` に、
317+
ライセンス及びドキュメントは `$DESTDIR/$PREFIX/share/doc/blesh` にコピーされます。
318+
それ以外で Make 変数 `INSDIR` が指定されている時、
319+
`ble.sh` 及び関連ファイルは直接 `$INSDIR` に配置され、
320+
ライセンス及びドキュメントは `$INSDIR/doc` にコピーされます。
321+
以上の Make 変数が指定されていない時は、
322+
`ble.sh` 及び関連ファイルは `${XDG_DATA_HOME:-$HOME/.local/share}/blesh` に、
323+
ライセンス及びドキュメントは `${XDG_DATA_HOME:-$HOME/.local/share}/doc/blesh` にインストールされます。
324+
325+
ライセンス及びドキュメントのインストール先は Make 変数 `INSDIR_LICENSE``INSDIR_DOC` を用いて上書きできます。
326+
Make 変数 `USE_DOC=no` が指定されている場合は、ドキュメントファイルの処理が無効化されます。
306327

307328
インストール時にコード中のコメントは自動で削除されますが、コメントを保持したい場合は `strip_comment=no``make` の引数に指定して下さい。
308329

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,36 @@ make install
329329
# INSTALL to a specified directory
330330
make install INSDIR=/path/to/blesh
331331

332-
# PACKAGE (for package maintainers)
332+
# PACKAGE (for package maintainers) - Example 1
333333
make install DESTDIR=/tmp/blesh-package PREFIX=/usr/local
334-
```
335334

336-
If either the make variables `DESTDIR` or `PREFIX` is supplied, `ble.sh` will be copied to `$DESTDIR/$PREFIX/share/blesh`.
337-
Otherwise, if the make variables `INSDIR` is specified, it will be installed directly on `$INSDIR`.
338-
Otherwise, if the environment variable `$XDG_DATA_HOME` is defined, the install location will be `$XDG_DATA_HOME/blesh`.
339-
If none of these variables are specified, the default install location is `~/.local/share/blesh`.
335+
# PACKAGE - Example 2
336+
make install DESTDIR="$build" PREFIX="$prefix" \
337+
INSDIR_LICENSE="$build/$prefix/licenses/blesh"
338+
339+
# PACKAGE - Example 3
340+
make install DESTDIR="$build" PREFIX="$prefix" \
341+
INSDIR_LICENSE="$build/$prefix/share/blesh/doc" \
342+
INSDIR_DOC="$build/$prefix/share/blesh/doc"
343+
344+
# PACKAGE - Example 4
345+
make install USE_DOC=no DESTDIR="$build" PREFIX="$prefix" \
346+
INSDIR_LICENSE="$build/$prefix/share/blesh"
347+
```
348+
349+
If make variable `DESTDIR` or `PREFIX` is supplied, `ble.sh` and related files
350+
will be copied into `$DESTDIR/$PREFIX/share/blesh`, and the license and
351+
documentation files will be copied into `$DESTDIR/$PREFIX/share/doc/blesh`.
352+
Otherwise, if make variable `INSDIR` is specified, `ble.sh` and related files
353+
will be installed directly in `$INSDIR`, and the license and documentation
354+
files will be copied into `$INSDIR/doc`. If none of these make variables are
355+
defined, `ble.sh` and related files are installed in
356+
`${XDG_DATA_HOME:-$HOME/.local/share}/blesh`, and the license and document
357+
files are installed in `${XDG_DATA_HOME:-$HOME/.local/share}/doc/blesh`.
358+
359+
The install locations of the license and documentation files can be overridden
360+
by make variables `INSDIR_LICENSE` and `INSDIR_DOC`. If `USE_DOC=no` is
361+
specified, the documentation files are disabled.
340362

341363
The comment lines and blank lines in the script files are stripped in the installation process.
342364
If you would like to keep these lines in the script files, please specify the argument `strip_comment=no` to `make`.

contrib

Submodule contrib updated 1 file

docs/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
- color: adjust default fg values in faces and add `bleopt color_scheme` (requested by mattmc3) `#D2248` e4cce0ea 5f5554a8 `#D2258` xxxxxxxx
5656
- highlight: add `bleopt highlight_eval_word_limit` (motivated by orionalves) `#D2256` 6833bdf8
5757
- progcomp: support `complete -E` `#D2257` xxxxxxxx
58+
- make: support make variable `USE_DOC=no` `#D2259` xxxxxxxx
5859

5960
## Changes
6061

note.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7373,6 +7373,21 @@ bash_tips
73737373

73747374
2024-08-23
73757375

7376+
* make: make variable "USE_DOC=no" (requested by blackteahamburger) [#D2260]
7377+
https://github.com/akinomyoga/ble.sh/issues/485
7378+
7379+
取り敢えず実装した。USE_DOC=no で指定できる。最初は INSDIR_DOC=none 等を指
7380+
定した時に無効化できるようにしようと思ったが、それだと make install だけし
7381+
か影響を受けない機能のようだし、やはり任意の値を指定できるはずのパス名の設
7382+
定に特別な値を導入するのは良くない気がする。なので、USE_DOC という変数名に
7383+
する事にする。
7384+
7385+
* done: README をもう少し詳しく記述する。
7386+
* done: README-ja_JP も同様に更新する。
7387+
7388+
* fixed: INSDIR_LICENSE と INSDIR_DOC が同じ場合の対策はしているが、それら
7389+
が INSDIR と一致する場合の対策がされていない気がする。修正する。
7390+
73767391
* contrib: fzf-menu 修正 (reported by pallaswept) [#D2259]
73777392
https://github.com/akinomyoga/ble.sh/issues/479#issuecomment-2305871596
73787393
Ref: #D2251

0 commit comments

Comments
 (0)