Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Building GNU Emacs as a sample of separate compilation in C

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,439
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on May 7, 2008

complex programs usually consist of multile source files. To understand the flow of compiling them and combining into the target object, I demonstrate how to build emacs (temacs, a vanilla emacs core) with make command, in this video.

*** これはプログラミング演習用の自習ビデオです ***

分割コンパイル(separate compilation)の実例
GNU Emacs 23.0.60はおおよそ125個のCファイル、合計34万行からなっている(C言語以外で記述されている部分については省略)。これをコンパイルするにはmakeコマン­ドを利用(入力)する。すると、それぞれのCファイルが:

gcc -c *.c -I*

でコンパイルされる(この時-Iは必要だが(大文字のアイ)-lは要らない(小文字のエル))。これで125個の*.oが作成される。-cを付けるとコンパイルするファイ­ルの中にmain関数はなくてよいし、リンクもされない。

*.oの生成が終ったら全てを目的プログラムtemacsにまとめるために:

gcc -o temacs *.oの羅列 -l各種ライブラリ

で結合(リンク)する。この際にはライブラリ関数を結合するために-lが必要になる(小文字のエル)。

なお、一連の動作を自動化するために、Makefileに生成手順のルールを記述してある。従って実際にユーザが入力するのは:

make temacs

である。(-j2はデュアルコアCPUでの並列コンパイル用の指示)。

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more