Unable to execute all prerequisites for a target in makefile

Viewed 227

I have been trying to execute all prerequisites for a particular target in makefile. But whenever the prerequisite is a target with single/multiple info values, I find that the other prerequisites are not executed(which come after the 'info' based target)

I have tried reducing the number of info in values in prerequisites to just 1. in that case also i could not find other prerequisites to execute. Thus my problem is to understand how to execute a single/multi-line info based prerequisite and continue executing other prerequisites.

# Define new line and separator
.PHONY:newline
newline:
    @echo 

.PHONY:separator
separator:
    $(info -------------------------------)

# Print the project details
.PHONY:project
project:
    $(info Project Details)
    $(info Author  : xyz)

# Help menu 
.PHONY:help
help: newline separator project separator newline 



Expected outcome 
$ make help

-------------------------------
Project Details
Author  : xyz
-------------------------------

Outcome received

$ make help

-------------------------------
Project Details
Author  : xyz
1 Answers

In make any target's recipe is executed at most once per build. So just don't do this, it's very very wrong.

Also, $(info ...) is a text substitution, which is executed before any external command in the same recipe, so mixing it with echo generally is a bad idea.

If you're trying to avoid repeating long dash lines, you can always do this with variables:

sep := --------------------
define nl :=


endef

...

help:
    $(info $(nl)$(sep))
    $(info Project details)
    ...
    $(info $(sep)$(nl))
Related