%% Nehal Mistry <[EMAIL PROTECTED]> writes: nm> i have a variable: nm> OBJ = src/ai/ai_magic.o src/ai/ai_plan.o
nm> and so on... i want to convert it so that there is an '/obj' nm> between the basename and dirname... so it would be: nm> OBJ_2 = src/ai/obj/ai_magic.o src/ai/obj/ai_plan.o nm> so i tried doing this, but it did not work: nm> OBJ_2 = $(patsubst %, $(shell dirname %)/obj/$(shell basename %), $(OBJ)) Ouch. First, using $(shell ...) like this is very inefficient; it starts a new subshell for each invocation. Second, you can't do this because make expands from the inside out: that is, the arguments are expanded _first_, _then_ the pattern substitution is performed on the results. That means that the pattern in $(shell dirname %) is not replaced until _after_ the function is run, not before. nm> i think dirname and basename are not converting % correctly. nm> can someone help me out please How about this: OBJ_2 = $(join $(addsuffix obj/,$(dir $(OBJ))),$(notdir $(OBJ))) ? -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
