This is the mail archive of the 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]

B20.1/NT: Make 3.75 -- trailing spaces in makefile macros cause weird problems


A variety of problems including endless looping on recursive makes and a 
message saying "HOME not defined" (or similar) is caused by having trailing 
spaces in makefiles on macro definition lines like:

MY_MACRO = this that theother

(If you want more detail see below.)

I have discovered a workaround to this, but felt that it should be 
recorded, and this appears to be the "journal of record". I believe it 
should be fixed because the time spent figuring out the seemingly unrelated 
problem and contorting the configuration places others at risk. (I almost 
gave up on make entirely after downloading the source and realizing I can't 
quickly decipher the structure of the source.)

The workaround is simply to remove trailing spaces from at least macro 
definition lines. I wrote a shell/sed combo to remove them from every line 
in every makefile (of which I have many).

If anyone needs further details, please don't hesitate to email me.

Thank you for your consideration,


------------ DETAIL -------------
Having just downloaded the most recent "full.exe" a few days ago, I set 
about to convert, if necessary, my makefiles that worked with Sun Solaris 
onto my NT machine until I could get my Linux server installed. I chose 
cygwin over DJGPP (which I also tried) because it appears that cygwin does 
a more complete job making paths and filenames transparent (i.e. slashes, 
drives, and length). This is what I needed.

I ran into a variety of problems seemingly related to my development 
environment complexity. Essentially, I have multiple languages and 
intermediate tools (e.g. parser generators, schema generators and the like) 
in a moderately deep (2 to 5 levels) directory hierarchy, where every 
directory has a make file that includes the somewhat complex shared ruleset 
I use to produce a finished product set consisting of libraries, 
applications, 3rd party tool inputs, help files, DB configurations and so 
forth. (This is why I don't use tools like, say, Java Workshop that are too 
structure for what I need). Make is invoked recursively on each directory.

The first thing I noticed is that for a given directory, the makefile would 
run through all the sub-directories, and then it would try running a make 
on a blank directory (i.e. it said it was building sub-library ""). This 
was accompanied by an error message saying "HOME" wasn't defined. I never 
recalled make needing a home directory, but to oblige it I set HOME to the 
top-level project directory and retried. This time at the bottom level of 
the first leg it did the same thing but also looped forever starting at the 
top directory and going down the same path it had been before.

Then I created a test case in a separate directory tree and retried. It 
went down the first leg as above and after the blank directory, it started 
making the original project! There was no reference in the test makefiles 
to that project at all.

This led to the conclusion that (1) the trailing spaces create an 
additional blank "word" if the macro is used as a wordlist (say, a list of 
libraries to make); and (2) that invoking make on the blank library caused 
a "cd" with no arguments, thus ending up in the HOME directory.

Want to unsubscribe from this list?
Send a message to

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