This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: make and shell calls


OK, I tried the follwing:

Makefile-dirs reads:
export SB_ROOT=/cygdrive/c/sbroot
$(SB_ROOT)/bin :
        mkdir $(SB_ROOT)/bin

When I call make with the following command line:
  make -f Makefile-dirs /cygdrive/c/sbroot/bin

it works. I tried:
1. From the command line directly (CMD.EXE on W2K SR2)
2. Start CMD.EXE, call sh, and execute in sh.
3. Start CMD.EXE, call bash, and execute in bash.
All with the same (positive) result.

You have to be careful when escaping, since all three environments (sh, bash
and make) perform escaping in a different way. When using MAKE_MODE=unix,
the colon in a DOS-formatted path will confuse make, so you'd have to use
the 'cygdrive' notation anyway, and then fowrard slashes present no problem.
When backslashes are necessary, be aware that both the shell (command line!)
and make will perform escaping, so you'd probably need _four_ backslashes
for the command line, and two in your makefile (not tested, though, since
the colon-notation will not work anyhow...).
Also, be aware that 'sh' under CygWin effectively means 'ash', which is not
quite the same.

Regards,

Johan Bezem
CSK Software AG

Wendy Vanhonacker wrote:
> 
> Hi
> First, Thanks for your help!
> Here are some more details.
> I have make version 3.79.-7 and cygwin  1.3.12-2.
> I'm running the makefiles from MSDOS. So I added MAKE_MODE=unix and the
> cygwin/bin directory to the path.
> 
> When I run my program on cygwin it works. For all cases:
> export SB_ROOT=d:/sbroot
> $(SB_ROOT)/bin :
>       mkdir $(SB_ROOT)/bin
> 
> OR
> 
> export SB_ROOT=/cygdrive/d/sbroot
> $(SB_ROOT)/bin :
>       mkdir $(SB_ROOT)/bin
> 
> OR
> export SB_ROOT=d:\\sbroot
> $(SB_ROOT)\\bin :
>       mkdir $(SB_ROOT)\\bin
> 
> But the problems comes when I use MSDOS. If I type 'sh' in DOS, and then
> mkdir d:\sbroot\bin, it doesn't work, it says the usual:
> $ mkdir d:\sbroot\bin
> Extended Error 183
>    1753 [main] sh 922 proc_subproc: Couldn't duplicate my handle<0x38> for
> pid 1634226260, Win32 error 6
> 
> With mkdir d:/sbroot/bin, I get:
> $ mkdir d:/sbroot/bin
> Invalid switch - /sbroot
>    2311 [main] sh 967 proc_subproc: Couldn't duplicate my handle<0x38> for
> pid 1634226260, Win32 error 6
> 
> I don't think it's a cygwin interpretation problem...I tried all the
> possible cases.. how many // or \\... or cygdrive/d/...
> When I type sh in DOS I get the shell installed from cygwin (since it's
> shared by the environment setup that I have), but it doesn't understand the
> same commands!!!!
> I think the invalid switch problem is because I use this shell on DOS and
> it doesn't like it...
> Can you try that on your windows machine?try 'sh' on MSDOS and then mkdir
> ...
> I'm pretty much sure that my shell line is interpreted by sh, so it
> shouldn't be a make interpretation (like the colon problem as target)
> 
> The 'coudn't duplicate...' error comes whenever I put a unix command line
> like mkidr or rmdir or chmod... as a shell line . I don't think it is
> supposed to do this either.. It has nothing to do with backslashes or
> anything. If I type 'mkdir temp' it does so too..!!
> Where does the shell from Cygwin installation come from? Is it Bourne or
> Korn shell? What package installs sh.exe?
> 
> thanks
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]