Ignore Exit Codes View article history Edit article

Published: , Updated:
Talks about: <a class="post-tag post-tag-exit-code" href="/tags/exit-code">exit code</a>, <a class="post-tag post-tag-make" href="/tags/make">make</a>, and <a class="post-tag post-tag-makefile" href="/tags/makefile">Makefile</a>

In case you are using a Makefile to define a complex build step - for example start database, run tests, stop database - consider using the - qualifier in front of your actual build step like this:

.PHONY: build
build:
	start-database
	-build-software
	stop-database

Thanks to -, the database will be stopped even if building your software fails, therefore making sure to clean up after ourselves once the build finishes.