1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

古き良き #Linux の makeコマンド + Malefile で開発環境構築とか docker-compose build / up / down とかテストとか rails console とかコマンド一発で実行できるようにしてみよう ( Mac開発におすすめ ) ( #linux #docker #rails )

Last updated at Posted at 2019-09-26

make コマンドとは

makeは、プログラムのコンパイルに広く使われているコマンドです。どのソースコードをどのようにコンパイルすれば良いかを判断し、コンパイルに必要なコマンドを実行してくれます。

第5章 Makeの基本

Makefile

  • Makefileという名前で、拡張子なしのファイルを作成しておくだけで良い。
  • make コマンドを叩くと、このMakefileを自動的に解釈してくれる。

build:
	docker-compose build
up:
	docker-compose up
down:
	docker-compose down
rspec:
	bundle exec rails rspec
console:
	bundle exec rails console

make コマンドの例

make build
make up

make コマンド + Makefile良さ

  • 長いコマンドを覚えなくて良い。叩かなくて良い。
  • makeコマンドが入っている環境では、なに一つせず、そのままコマンドが叩ける。 (開発環境構築コマンドを叩くために開発環境構築をしなくて良い) Macなら最初から入ってるはず。

makeコマンドってコンパイル用じゃないの?

そう思っていたんだけど、こんな別の使い方もできるっぽい。
ファイルにコマンドを羅列するだけで動くなんて。

Windowsだと

makeコマンド自体のインストールが必要っぽい?

参考

2016年だけどMakefileを使ってみる - Qiita

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?