%% Robin Clark <[EMAIL PROTECTED]> writes: rc> SRCS.cpp: sh =if [ -f *.cpp ]; then ls *.cpp; fi
The way to run shell scripts in GNU make is by using the $(shell ) function: SRCS.cpp := $(shell if [ -f *.cpp ]; then ls *.cpp; fi) However, as you point out the more efficient way to do this in GNU make is using the $(wildcard) function. rc> I see in the manual that you can use the wildcard rc> function to obtain similar results. If I use the rc> syntax rc> SRCS.cpp: $(wildcard *.cpp) rc> will I get the correct results? No. You are declaring a target SRCS.cpp above, which depends on all the *.cpp files in the directory. If you want to set a variable SRCS.cpp to contain a list of the *.cpp files in the directory, use this: SRCS.cpp := $(wildcard *.cpp) (note that := and = both assign variables: the former is more efficient in these cases). rc> I am sorry to ask this question without trying it, but rc> I do not have access to the Linux machine presently. GNU make is free software and you can easily run it on your Solaris system as well. You can download the source from ftp://ftp.gnu.org/make/ and build it yourself, or you can get prebuilt versions from places like http://sunfreeware.com/ No need to wait for a Linux box to use GNU make... -- ------------------------------------------------------------------------------- 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
