How to handle user variable in a Makefile

Problematic

Solution

VARIABLE ?= DEFAULT_VALUE command: echo "${VARIABLE}"
make foo # uses the default value specified in the Makefile for VARIABLE make foo VARIABLE= # set VARIABLE to an empty value make foo VARIABLE=SPECIFIC_VALUE # set VARIABLE to a SPECIFIC_VALUE

Interesting links

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Node.js Oauth 2 Server using redis database

Structure a Large Scale Vue.js Application

NextAuth Part 10 —Auth0 provider

Create a Rich Text Editor With React

Case Study: SSR and Web Animations.

Handling User Input in React  — CRUD

Frontend Pattern — Atomic Business Components (ABC)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Xavier Jouvenot

Xavier Jouvenot

More from Medium

DevOps Life Cycle

SonarLint

Why git commit messages matter

Why git commit messages matter

Little Little Troubleshooting for Various Things