[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Remove whitespace from the output of foreach
From: |
Rakesh Sharma |
Subject: |
Remove whitespace from the output of foreach |
Date: |
Thu, 18 Oct 2012 21:32:57 -0700 |
Hello Makers,
I have a niggling query regarding how to remove the spaces from the output of a
foreach command in GNU Make.
I have this code:
###### begin make file ###
SHELL := /bin/sh
empty :=
sp ;= $(empty) $(empty)
k0 := $(empty)
k1 := x
k2 := $(k1) x
k3 := $(k2) x
k4 := $(k3) x
k5 := $(k4) x
k6 := $(k5) x
k7 := $(k6) x
k8 := $(k7) x
k9 := $(k8) x
# $(call replicate,char,kount)
replicate = $(subst $(sp),$(empty),$(foreach i,$(k$(2)),$1))
nop:
@echo "[$(call replicate,*,4)]";
############################## end of make file
Output is:
[* * * *]
As we can see the spaces are intact & should have been deleted by the subst
function but for some reason weren't.
How can I fix this anomaly?
I am using GNU Make 3.81.
Cygwin Platform
Thanks in advance,
Rakesh
- Remove whitespace from the output of foreach,
Rakesh Sharma <=