bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling Bash with /S


From: sweinberger
Subject: Re: Calling Bash with /S
Date: Thu, 23 Jun 2011 08:04:54 -0700 (PDT)

Hi All,

With help from a colleague, I found out part of the problem.   First,
though, I should give some background for anyone that may run into the same
problem.

Environment:
dmake: downloaded latest version: dmake.exe - Version 4.12-20090907-SHAY
Cygwin: latest version: 1.7.9-1

The /S /c comes from dmake.  The "/" is the SWITCHAR environment variable,
set to "/" on my Windows box.  I had nothng to do with that setting.  The S
command comes from dmake.  There is a file.  I do not remember the name, but
my colleague grepped it.  The command options /S /c is the SHELLOPTIONS
environment variable.

Changing these variables changed the command line options to bash, but did
not solve the problem.  The cause was a new addition that Maxim added to
their new version of the make file (in version 5.04 of their SDK).  In
rules.mk, they have the following:

GROUPSHELL=/bin/bash
SHELL=/bin/bash

# this % rule will find any file in $SRC or $SRCDIRS paths with the same
file
# name as the .o file that the rule is updating
"$(OBJ)/%.o" :| "$(SRC)/%.c" $(SRCDIRS:+"/%.c")
@[
    if [ `expr "$(NOOPTSRCS)" : '.*\b$(<:f)\b'` == 0 ]; then 
       echo ---- Compiling: $(<:f)
       $+bash -c '(CC) $(CFLAGS)=$(@:b:^"/":^$(OBJ):+".lst") $(WOPTS) \
              -MD $(MIPSOPTS) $(INCS) -o "$(@:b:^"/":^$(OBJ):+".o")" "$<"'
    else 
       echo ---- Compiling -O0: $(<:f)
       $+bash -c '(CC) $(CFLAGS)=$(@:b:^"/":^$(OBJ):+".lst") $(WOPTS) \
              -MD $(MIPSOPTS) $(INCS) -O0 -o "$(@:b:^"/":^$(OBJ):+".o")"
"$<"'  
    fi
]

They added those two environment variables overriding the default.  I sound
like Jamie Oliver (of Food Revolution fame) when I say that I totally get
it.  The regular bash handler that comes integrated with dmake does not
support if-statements, which Maxim wants processed.  Since -O0 is the
default according to the man-page for mips-elf-gcc, both variants are the
same, but it is not to wonder why but to do, to borrow an adage.

I presume running on a Linux box makes the command work nicely, but here in
Cygwin land, things do not work as expected.  Dmake in Cygwin wants a tab
character to define the task of a rule, whereas in Linux a space is okay. 
In Linux, one does not have to double quote every path name, whereas in
Cygwin one has to, as path names like "C:\Some Folder\With Some Sub
Folder\Whatever.c" are the norm.  Please note the colon and the backslash,
both big no-nos in dmake, as the colon implies a rule, not a path, and the
backslash is a special character.

Similarly, bash processing does not work as expected.  Once I commented out
the two environment variables and temporarily getting rid of the
if-statement and just using one of the compiler variants, files compiled
fine.

The internal bash handler for dmake does not support if-statements, hence
replacing bash with /bin/bash, but that causes other problems, namely an
"Invalid File or Directory" error.  The presence of any special characters
or the /S option, for that matter, reeks havoc.

The problem is that the make file needs to execute the embedded
if-statement, so I need to find some resolution to that.

Maybe the /S option is for the internal bash editor that comes with dmake;
just a thought.  In the end, who cares.  The problem is overriding the
macros.

If any of you have thoughts, let me know.

Thanks and pushing forward,

Sarah
-- 
View this message in context: 
http://old.nabble.com/Calling-Bash-with--S-tp31904926p31911106.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]