Colmjude

/ notes
Notes
A collection of thoughts, things I've learnt and things I want to remember

If-else statements in Make

You can use if/else statements in your makefiles.

A good use case is to check a dependency is installed and available. It is an opportunity to warn the user about what is missing.

For example, the following checks datasette is available before executing the datasette command.

server:
ifeq (,$(shell which datasette))
    $(error datasette does not exist!)
endif
    datasette -m metadata.json view_model.db
Tags
development / make