[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Expanding variables as part of function arguments
From: |
Anthony Penniston |
Subject: |
Expanding variables as part of function arguments |
Date: |
Wed, 9 Jun 2010 00:05:04 -0400 |
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))))
test :
echo $(OBJ)
Expansion of $(OBJ) fails when make discovers patsubst is missing an argument
(though the expanded contents of $(SUB) are "%.c,%.o"). Trying various
combinations of $(eval $(value OBJ)) doesn't seem any closer to working. The
goal is to gather source files and turn them into targets (i.e. list of files
"foo.c bar.c baz.cpp", becomes list of targets "foo.o bar.o baz.o")
Am I approaching this in the right way? if so, how can I expand variables as
arguments to functions?
Thanks,
Anthony
_________________________________________________________________
Learn more ways to connect with your buddies now
http://go.microsoft.com/?linkid=9734388
- Expanding variables as part of function arguments,
Anthony Penniston <=