On Wed, 2010-06-09 at 00:05 -0400, Anthony Penniston wrote:
> Hello,
> I need to expand a variable as an argument to patsubst, as in the following
> code snippet:
>
> SRC := src
> SRCEXT := .c .cpp
> OBJEXT := .o .o
> comma := ,
> SUB = $(join $(addsuffix $(comma),$(addprefix %%,$(SRCEXT))),$(addprefix
> %%,$(OBJEXT)))
> OBJ = $(patsubst $(SUB),$(wildcard $(addprefix $(SRC)/*,$(SRCEXT))))
Commas have to be "top-level" tokens. The arguments to a function are
parsed BEFORE they are expanded, so the comma separating an argument
cannot appear inside a variable.
Assuming the suffix is always the same (.o), why not just use:
SRCFILES := foo.c bar.c baz.cpp
OBJFILES := $(addsuffix .o,$(basename $(SRCFILES))
--
-------------------------------------------------------------------------------
Paul D. Smith <[email protected]> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make