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: $...@} 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!


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to