-
Notifications
You must be signed in to change notification settings - Fork 61
Makefile Help
basically like a bash file with exceptions
To add new Makefile functions don't add them to the original Makefile. This will make pulling updates from the community difficult. Create an empty file named custom.Makefile. This file will automatically be imported into the original Makefile. It will act like it's directly embedded in the original file. This means it can see anything within the original Makefile. You can call a function from custom.Makefile without any special considerations.
.PHONY: foobar
.SILENT: foodbar
## Description of what Foobar does.
foobar:
docker-compose exec -T drupal bash -lc "drush cr"
## Description is a double hash then the Name of the function on the next line.
Name:
Indent the commands to run.
Minimal for make help
to show the description for the new custom function requires ##
on the line before the function name colon.
.PHONY: foobar
.SILENT: foodbar
## Description of what Foobar does.
foobar: run_before_something_whatnot
docker-compose exec -T drupal bash -lc "drush cr"
- Phony so it doesn’t create a file by the name foobar and won’t get confused if a foobar file exists https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
- Silent: silences/inhibit the display of commands during the function.
Typically you will replace
$(pwd)
with $(shell pwd)
shell fragments are one-liners.
- This can be for executing a command in shell
$$(docker-compose ...)
- This can also be calling a environment variable
$${DB_ROOT_USER}
Will run the function referenced after it every time make is run regardless.
Add “#” to comment out code
docker-compose up -d fcrepo
Add double “##” to declare the description of your custom makefile function.
## Dump fcrepo.
fcrepo-export:
docker-compose exec -T fcrepo with-contenv bash -lc "ls"
Without the ##
the make help
function won't print the description.
“-docker-compose….” mean it is allowed to fail without causing a crash