[Makefile] 「Hello World!」する方法
概要
Makefile を vim で編集し、「Hello World」と表示する方法についてまとめる。
手順
makefile の作成
作業用フォルダー(ここでは、「workspace」)にmakefile を作成
workspace $ touch makefile //makefile の作成
vim で編集
workspace $ vi makefile //vim で makefile を開く
黒い画面が表示されるので「i」をタイプすると、画面下部に「-- INSERT --」と表示され、文字の入力が可能になる
makefile に以下のように入力
makefile
message = Hello World!!
helloWorld:
echo $(message)
入力終了後は [esc] キーで insert モードを終了し、「:wq」(write quit) を入力してターミナルに戻る
makefile の書き方
target名:
実行するコマンド
コマンドは Unix コマンド
半角スペースではなく、タブを利用する
ターミナルで実行
ターミナル
workspace $ make helloWorld
echo Hello World!! //実行されたコマンド
Hello World!! //返り値
makefile で指定したターゲットの実行方法
make ターゲット名
参考資料
Author And Source
この問題について([Makefile] 「Hello World!」する方法), 我々は、より多くの情報をここで見つけました https://qiita.com/ub0t0/items/dd5997bdbea14e8f3071著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .