Winston C. Yang
Winston C. Yang

Reputation: 1507

Makefile error: Unexpected end of line seen

Trying to install Git, I ran configure and make, but got the following error message:

make: Fatal error in reader: Makefile, line 221: Unexpected end of line seen

The Makefile looks like:

218:    GIT-VERSION-FILE: FORCE
219:            @$(SHELL_PATH) ./GIT-VERSION-GEN
220:    -include GIT-VERSION-FILE
221:
222:    uname_S := $(shell sh -c 'uname -s 2>/dev/null øø echo not')

What's causing the error?

The following information may or may not be relevant:

Upvotes: 12

Views: 18905

Answers (6)

Ate Somebits
Ate Somebits

Reputation: 321

I came to this error with 2 simple makefiles, one of which was working, and one which produced the error.

Both had properly tabbed lines, and both had "CRLF" line endings.

For one reason or another, I managed to fix the problem by changing the line endings to "LF", but I am confused as to why the other makefile was parsed successfully even though it had "CRLF" endings. There is, however, a clue: the first one or two times, "make" gave another error:

mksh: Warning: newline is not last character...

After opening the makefile in a text-editor, and adding a line ending at the end, it started producing the OP's error.

In this situation, it's good to have an editor that can display line endings and tabs.

Upvotes: 1

rashok
rashok

Reputation: 13474

Use gmake instead of make.

Genrally solaris has two command, gmake and make. In this gmake is GNU style make command, and make is solaris style make command. I hope you have written your makefile in GNU style. So use gmake command.

Upvotes: 6

Paulus
Paulus

Reputation: 1457

This might be due to DOS line endings (CRLF) in your makefile. I have just had a similar problem and solved it by running dos2unix on the makefile. Linux make seems unfazed by the same makefile.

Upvotes: 2

user2554726
user2554726

Reputation: 179

Using gmake on SunOS instead of make fixed this issue for me.

Upvotes: 11

xpert
xpert

Reputation: 19

Its a problem with your "make", install "make-3.81.tar" and then try

Upvotes: 1

Diavolche
Diavolche

Reputation: 21

Make sure that you have actually tabbed the line and it is not all spaces. I had this issue but I found out the command was not properly tabbed in and that is why I was running into this error.

Upvotes: 1

Related Questions