Emacs, scripting and anything text oriented.

How to do math in Makefile?

Kaushal Modi

If you have bc installed, you can use it to do math operations on variables in a Makefile.

For me, it was installed in /usr/bin/bc.

VAR_A = 10
VAR_B = 11
VAR_C = $(shell echo $(VAR_A)\*$(VAR_B) | bc)

default:
	echo $(VAR_C)

If you have written a response to this, enter your response post's URL below.

Or, you can send a "comment" webmention (it's OK if you don't know what that means). When asked about your website on an IndieAuth login screen, simply type https://commentpara.de.

Markdown Support**bold**, _italics_, ~~strikethrough~~, [descr](link), `monospace`, ```LANG\nline1\nline2\n``` (Yep, multi-line code blocks too, with syntax highlighting!), auto-hyperlinking.

Webmentions #