Qiita Conference 2025

こにふぁー (@konifar)

提案のレベルを上げる - 推進力のあるエンジニアになるための思考法

2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Makeのhelpコマンドでターゲットの一覧を出す。

Posted at

Makeファイルを便利なタスクランナーとして使ってると、ターゲットがいっぱい増えてきて、何がなんだかわからなくなっちゃうので、簡単なhelpコマンドを作ると良い。

Makefile
# : ヘルプコマンド
help:
	@grep -A1 -E "^#:" Makefile \
	| grep -v -- -- \
	| sed 'N;s/\n/###/' \
	| sed -n 's/^#: \(.*\)###\(.*\):.*/\2###\1/p' \
	| column -t  -s '###'

# : ビルド
build:
    buid command

Makefileに↑こんな感じで、helpコマンドを実装。
ターゲットの1行上に#: に続けてコメントを書いておくと、

$ make help
help                  ヘルプコマンド
build                 ビルド

こんなかんじで、一覧を出力してくれる。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?