简体   繁体   中英

echo in makefile.am if loop

I am trying to have a prompt in Makefile.am if a condition is not true. I am trying as:

if FOUND_MAKEDEPF90
<compilation condition if true>
else
@echo "Create the dependencies Manually\n"
@echo "e.g. ./src/main.o:./src/main.f90"
endif

The true branch is working properly, but, while running the else branch, I am getting error:

 *** missing separator.  Stop.

Is it not valid to put an echo statement in the loop? What is going wrong here? any idea please?

I am using:

$ make --version
GNU Make 4.0
Built for x86_64-redhat-linux-gnu

You don't have a loop here. You have an make level if statement and yes, echo is a shell command and cannot be at the top-level of a makefile.

If you are just trying to display a message (at make run time) if that condition isn't met then you can use the make $(info) function (or $(warning) or $(error) which causes make to exit with an error).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM