Operating System - HP-UX
1758027 Members
2087 Online
108866 Solutions
New Discussion юеВ

Re: Make: Must be a separator on rules line 4. Stop.

 
SOLVED
Go to solution
David Webb (MAX)
Occasional Contributor

Make: Must be a separator on rules line 4. Stop.

Could anyone help with the following. I want to add a conditional to a Makefile to allow it to run on several platforms. On HP-UX I cannot use gmake. The test case has been reduced to:

db34_pnr.log : foo
@echo "linux0"
ifeq (linux, linux)
@echo "linux1"
else
@echo "linux2"
end if


Running the makefile results in:

engserv3% touch foo; make db34_pnr.log
Make: Must be a separator on rules line 4. Stop.

I tried various forms of conditional statement and can't seem to get any of them to work on HP-UX. I believe the syntax is fine there are tabs before each of the echo statements.

Any help welcome.

Thanks.

Dave
5 REPLIES 5
Peter Godron
Honored Contributor

Re: Make: Must be a separator on rules line 4. Stop.

Dave,
I bet you look at this already:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1036381

Does your code stop with an endif or end if ?
Also, have you got a carrige return right at the end of the code. I am assuming you did not copy/paste the file as this may have upset the space/tab.
David Webb (MAX)
Occasional Contributor

Re: Make: Must be a separator on rules line 4. Stop.

Hi Peter, thanks for your post.

I tried with "endif" and "end if", but got the same error message in both cases (suggests make isn't getting that far anyway, because presumably only one syntax should be correct).

As for carriage returns, I created the file again from scratch (on HP-UX) just in case there had been a copy/paste some time in the past, but this didn't change anything.

Yes, I had taken a look at the post you suggested but it didn't obviously suggest the cause of my problem.

Any other thoughts?

Dave

Peter Nikitka
Honored Contributor

Re: Make: Must be a separator on rules line 4. Stop.

Hi,

I have never seen these conditionals working in standard make environments, if not running in a (whatever called) 'GNU-compatibility mode'.

ALWAYS necessary however is a -character at the start of a execution statement:

db34_pnr.log : foo
@echo "linux0"
ifeq (linux, linux)
@echo "linux1"
else
@echo "linux2"
endif


The end of a conditional ifXXX-statement is 'endif'.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Gregory Fruth
Esteemed Contributor
Solution

Re: Make: Must be a separator on rules line 4. Stop.

ifeq/else/endif are GNU make extensions.
Either install GNU make (gmake) or change
your makefile to do conditionals some
other way. Perhaps something like this:

default:
make `echo target_foo`
target_foo:
@echo this is foo
target_bar:
@echo this is bar

The stuff inside the `` can be any shell
command.
David Webb (MAX)
Occasional Contributor

Re: Make: Must be a separator on rules line 4. Stop.

Greg,
Thanks for the response, I got a conditional working based on your response & uname. It does what I need - thanks a lot.

Dave