LoginSignup
11
8

More than 3 years have passed since last update.

Makefileのファイル依存関係をGraphvizで可視化してくれるものを作った

Posted at

Makefileのファイルの関係を絵に書いて理解しようとしていたのですが、手作業じゃ無理〜となったので自動化を試みました。

image.png

LANG=C make -pによって出力されたMakefileのデータ構造をJSON形式へ変換してから、DOT形式で出力しています。
オリジナルのファイルがグレー、生成されるファイル(ターゲット)は白で表されています。

こちらの記事: Makefileの依存関係の可視化 を元にソースコードを改変させていただきました。

ソースコード

こちら→ https://github.com/souring001/makefile-visualizer

環境

GNU Make (3.81)
Python (3.5.2)
Graphviz (2.40.1)

実行

Makefileと関連するファイルをソースコードがあるフォルダに入れて以下を実行してください。

LANG=C make -p | python3 make_p_to_json.py | python3 json_to_dot.py | dot -Tpdf >| workflow.pdf

License

GPL version 3.

11
8
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
11
8