Hello Eric, Your suggestion to use the function $(file ...) worked for me! This function appears new in 4.0 looks like. It appeared to me that the reasons $(file...) was brought forth is to end the misery of the new-line issues!
What I have observed in gnu make is that the variables (make variables) are used in 3 locations: Inside of other make variables or code. e.g., $(info ...$(make_var)...) Inside the recipe section (shell). e.g., echo $(make_var) Inside the shell but that shell is within the make code. e.g., $(shell echo $(make_var)...) Maybe there might be other cases, but I am not aware of those. And what I see is that there's great non-uniformity in the way gnu make processes these cases, thereby adding to the errors. Thanks, Rakesh > Date: Wed, 9 Apr 2014 12:52:50 -0700 > From: [email protected] > To: [email protected] > Subject: Re: Detect unset variables in gnu make > > On 04/09/2014 11:40 AM, Rakesh Sharma wrote: > > Hello Guenther, > > > > Thanks for the tips about the $(origin varname) function. That is solving > > the problems I was having. As regards the value of the variable I like to > > keep them in 3 domains: > > > > unset <- never been defined (or undefined midway) > > null <- defined but set to an empty value (/^$/) => length($var) = 0 > > nonnull <- defined & set to a nonnull value(even if all spaces /^\s+$/ or > > /\S/ or better still /./) => length($var) > 0 > > > > But like you mentioned, I am coming around to the fact that null or unset > > variables need to be clubbed together in make. > > > > I am finding a great dichotomy in the way make handles newlines embedded > > within make variables. $(info ...$(string_with_NLs_) outputs ok, > > but the same string when used inside recipies (i.e., shell) creates untold > > misery. No amount of escaping, subst, etc. seem to help here. > > Rakesh, > > It can be quite tricky to use variables with embedded newlines in make. > If you're using GNU make 4.0, the $(file) function may provide you a > solution. Otherwise, this answer on StackOverflow may help: > > http://stackoverflow.com/a/649462/77345 > > Best regards, > > Eric Melski > Chief Architect > Electric Cloud, Inc. > http://blog.melski.net > > > > _______________________________________________ > Help-make mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-make _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
