makefileいらず
View Outline
http://www.imasy.or.jp/~yotti/lang_c/c_quiz.html の内容を実際にやってみた。
目的
makefileを作るのが面倒な、1本のソースファイルから成るコマンドにコンパイルコマンド自体を組み込む。
プログラムを自分でコンパイルした後実行することも出来る。
ソース(hello.c)
#if 0 /* # ここにmakeに必要なコマンドを記述する cc -o hello hello.c exit # ここまで */ #endif #include <stdio.h> int main(int argc, char* argv[]) { printf("hello world\n"); return(0); }
実行結果
$ ll hello.c -rw-rw-rw- 1 user user 212 2月 20日 22:24 hello.c $ sh hello.c $ ./hello hello world $