[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
arithmetic, e.g. $(word $(num)-1,$(list))
From: |
Markus Mauhart |
Subject: |
arithmetic, e.g. $(word $(num)-1,$(list)) |
Date: |
Thu, 17 Apr 2003 15:17:20 +0200 |
Hi, given ....
list = a b c
num = $(words $(list))
... how to compute the string for the arithmetic result of 'num - 1' ?
I tried the following but it didnt work as you can see:
//-----makefile-----
list := eins zwei drei
num := $(words $(list))
num_minus_1 := $(shell echo $$(($(num) - 1)))
all:
@echo num = $(num)
echo $$(($(num) - 1))
@echo num_minus_1 = $(num_minus_1)
//----inside cygwin's bash----
//1st test the shell's arithmetic directly:
$ echo $((3 - 1))
2
//now run make:
$ make
num = 3
echo $((3 - 1))
+ 3 - 1+
num_minus_1 = + 3 - 1+
$
//-----
Q1: is there another way for computing an arithmetic expression
except $(shell echo $$((expression))) ?
Q2: Does $(shell echo $$((expression))) work in some better
environment than mine ? (cygwin 1.3.20-1, bash 2.05b-9,
make-3.79.1-7 and make-3.80)
Thanks,
Markus.
- arithmetic, e.g. $(word $(num)-1,$(list)),
Markus Mauhart <=