make is a widely used and powerful tool for running common tasks in a project.
I often look at the
Makefile of a project in order to see how a project perform regular tasks such as running tests, compiling and starting db, etc.
I want to run 2 local servers at the same time. I can run them on separate terminal windows but I don't want to do that. I'm a lazy developer and want to use one line solution.
For instance I want to run a
python backend server and
live reload — if there is any change in static assets like
# Makefile django-server: ## Run the Django server python manage.py runserver 8000 npm-server: ## Run npm server to live reload npm run dev
You can run them concurrently like below:
$ make -j 2 npm-server django-server
Or you can use a
target for it as well:
# Makefile servers: make -j 2 npm-server django-server django-server: ## Run the Django server python manage.py runserver 8000 npm-server: ## Run npm server to live reload npm run dev
I want to run a local server and open a browser related to it. I don't want to manually click my browser and type
# Makefile local-dev: django-server browser django-server: ## Run the Django server python manage.py runserver 8000 browser: google-chrome --new-window http://localhost:8000 # or if you use firefox # firefox --new-window localhost:8000