回答編集履歴

1

追記

2019/06/13 12:31

投稿

KSwordOfHaste
KSwordOfHaste

スコア18394

test CHANGED
@@ -58,6 +58,50 @@
58
58
 
59
59
 
60
60
 
61
+ **追記: asmさんにご指摘いただいたようにgccだと-Hの方がずっと見やすいです**。-Hですとヘッダーの場所がどこかとヘッダーの依存関係が視覚的にわかりやすく出てきます。
62
+
63
+ ```bash
64
+
65
+ $ gcc -H -c ss.c
66
+
67
+ . /usr/include/sys/time.h
68
+
69
+ .. /usr/include/_ansi.h
70
+
71
+ ... /usr/include/newlib.h
72
+
73
+ .... /usr/include/_newlib_version.h
74
+
75
+ ... /usr/include/sys/config.h
76
+
77
+ 以下省略
78
+
79
+ ```
80
+
81
+ そういえばmakefileのヘッダーの依存関係を自動生成する方法があったと思い、も少し調べてみると-Mオプションなんかもいいと思いました。
82
+
83
+ ```bash
84
+
85
+ $ gcc -M ss.c
86
+
87
+ ss.o: ss.c /usr/include/sys/time.h /usr/include/_ansi.h \
88
+
89
+ /usr/include/newlib.h /usr/include/_newlib_version.h \
90
+
91
+ /usr/include/sys/config.h /usr/include/machine/ieeefp.h \
92
+
93
+ 以下省略
94
+
95
+ ```
96
+
97
+ こちらはmakeのための依存行をもろに出すものですが-Hと同様どこにヘッダーがあるかそのものを出力してくれます。自動的に依存関係を考慮するようなmakefileをほとんど書いたことがないので-Mがすぐに出てきませんでした。また-Hの方は全然知りませんでした(^^;
98
+
99
+
100
+
101
+ ご指摘ありがとうございました。>asmさん
102
+
103
+
104
+
61
105
  ### -vオプション
62
106
 
63
107