> -----Original Message----- > From: cygwin-owner On Behalf Of Prasad, Kanuparthi > Sent: 11 November 2004 11:16
> In my make file I am trying to check whether a directory > exists or not > then set a path differently if doesn't exist. > I am using cygwin installed on windows 2000. > The if construct I have is as follows. > > if test [-dc:/tools]; then DRIVE = c:/tools; else DRIVE = > c:/altTools; fi Oh, and by the way, another way you can do this, using only makefile syntax so it doesn't involve the shell at all, is to use the $(wildcard ...) function with a full filename to see if it exists, and then use that in a $(if ...) test. Like so: DRIVE=$(if $(wildcard c:/tools), c:/tools, c:/altTools) This technique has the advantage of working whether you're using make in --win32 or --unix mode: [EMAIL PROTECTED] /tmp/bgcc> ls -la C:/tools ls: C:/tools: No such file or directory [EMAIL PROTECTED] /tmp/bgcc> cat makefoo DRIVE=$(if $(wildcard c:/tools), c:/tools, c:/altTools) all: echo drive is ${DRIVE} [EMAIL PROTECTED] /tmp/bgcc> make -f makefoo echo drive is c:/altTools drive is c:/altTools [EMAIL PROTECTED] /tmp/bgcc> make --win32 -f makefoo echo drive is c:/altTools drive is c:/altTools [EMAIL PROTECTED] /tmp/bgcc> mkdir C:/tools [EMAIL PROTECTED] /tmp/bgcc> make -f makefoo echo drive is c:/tools drive is c:/tools [EMAIL PROTECTED] /tmp/bgcc> make --win32 -f makefoo echo drive is c:/tools drive is c:/tools [EMAIL PROTECTED] /tmp/bgcc> since it depends only on the cygwin dll's path-handling abilities, and not on the nature of the shell that is being used to execute the commands. cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/