[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How remove some pattern from variable and it must stay, recursively expa
From: |
Oleksandr Gavenko |
Subject: |
How remove some pattern from variable and it must stay, recursively expanded. |
Date: |
Tue, 12 Jan 2010 19:12:07 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 |
I need such behavior: remove some pattern from variable and it must stay
recursively expanded.
It seems impossible.
I have truble if variable have in its value some as ${@:.o=.s},
because
var = ... ${filter patern,${var}} ...
not allowed (recursive depends), and
var := ... ${filter patern,${var}} ...
subst ${@:.o=.s} to '' (nil string).
Here my working example:
...
CFLAGS += --asm ${@:.o=.s}
...
ifneq '' '$(filter -DHAVE_DEBUG_INTERFACE,$(CFLAGS))'
# first truble: address@hidden subst to nil
CFLAGS := $(filter-out --cpu Cortex-M3,$(CFLAGS))
endif
...
# second truble: CFLAGS already not recursive.
CFLAGS += --list ${@:.o=.lst}
When command was:
$(F_OBJ): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
it wonted to have on run some thing like:
$ aarmc ... --asm usb.s ... --list usb.lst ... -o usb.o usb.c
and option "--cpu Cortex-M3" not in command list, but when I remove
they by above code I lose --asm usb.s and --list usb.lst.
I see different way to solve problem, but they require
change Makefile *logical* structure.
One solution is move part that contain $(var)
syntax to another variable:
if 'yes' 'DEBUG'
# now in genlist_cmd, not in CFLAGS
genlist_cmd += --asm ${@:.o=.s} --list ${@:.o=.lst}
endif
and change command to:
$(CC) $(CFLAGS) $(genlist_cmd) -c -o $@ $<
So subj question: how safely remove some content from
recursively expanded variable with not going to simply expanded
variable?
--
Best regards!
- How remove some pattern from variable and it must stay, recursively expanded.,
Oleksandr Gavenko <=